2019-11-10 18:46:41 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
2019-12-01 18:25:05 -06:00
|
|
|
from panda3d.core import *
|
2019-11-26 22:59:12 -06:00
|
|
|
|
|
|
|
from libtoontown import *
|
2019-11-17 15:29:23 -06:00
|
|
|
from otp.ai.AIZoneData import AIZoneDataStore
|
2019-11-22 21:11:12 -06:00
|
|
|
from otp.ai.TimeManagerAI import TimeManagerAI
|
2019-11-17 15:29:23 -06:00
|
|
|
from otp.distributed.OtpDoGlobals import *
|
|
|
|
from toontown.ai.HolidayManagerAI import HolidayManagerAI
|
2019-11-17 15:57:18 -06:00
|
|
|
from toontown.ai.NewsManagerAI import NewsManagerAI
|
2019-12-05 20:38:58 -06:00
|
|
|
from toontown.ai.WelcomeValleyManagerAI import WelcomeValleyManagerAI
|
2019-11-22 19:58:35 -06:00
|
|
|
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
2019-11-17 15:29:23 -06:00
|
|
|
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
2020-01-08 14:51:15 -06:00
|
|
|
from toontown.coghq.FactoryManagerAI import FactoryManagerAI
|
2019-11-27 20:10:20 -06:00
|
|
|
from toontown.coghq.PromotionManagerAI import PromotionManagerAI
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
|
|
|
|
from toontown.distributed.ToontownDistrictStatsAI import ToontownDistrictStatsAI
|
|
|
|
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
2019-11-22 19:58:35 -06:00
|
|
|
from toontown.hood import ZoneUtil
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.hood.BRHoodDataAI import BRHoodDataAI
|
2020-01-08 14:51:15 -06:00
|
|
|
from toontown.hood.CSHoodDataAI import CSHoodDataAI
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.hood.DDHoodDataAI import DDHoodDataAI
|
|
|
|
from toontown.hood.DGHoodDataAI import DGHoodDataAI
|
|
|
|
from toontown.hood.DLHoodDataAI import DLHoodDataAI
|
2019-12-01 18:25:05 -06:00
|
|
|
from toontown.hood.GSHoodDataAI import GSHoodDataAI
|
2020-01-07 20:12:08 -06:00
|
|
|
from toontown.hood.GZHoodDataAI import GZHoodDataAI
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.hood.MMHoodDataAI import MMHoodDataAI
|
2020-01-08 00:40:54 -06:00
|
|
|
from toontown.hood.OZHoodDataAI import OZHoodDataAI
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.hood.TTHoodDataAI import TTHoodDataAI
|
2019-11-22 19:58:35 -06:00
|
|
|
from toontown.pets.PetManagerAI import PetManagerAI
|
2019-11-27 20:10:20 -06:00
|
|
|
from toontown.quest.QuestManagerAI import QuestManagerAI
|
2020-01-01 18:55:54 -06:00
|
|
|
from toontown.racing import RaceGlobals
|
2019-12-05 21:03:12 -06:00
|
|
|
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
|
2019-12-05 21:42:29 -06:00
|
|
|
from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
|
2020-01-02 11:46:49 -06:00
|
|
|
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI
|
|
|
|
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
|
2019-12-05 21:42:29 -06:00
|
|
|
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
|
2019-12-05 21:17:10 -06:00
|
|
|
from toontown.racing.RaceManagerAI import RaceManagerAI
|
2019-11-27 20:10:20 -06:00
|
|
|
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
|
2019-11-22 19:58:35 -06:00
|
|
|
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
|
2019-11-22 21:11:12 -06:00
|
|
|
from toontown.toon import NPCToons
|
2019-11-22 19:58:35 -06:00
|
|
|
from toontown.toonbase import ToontownGlobals
|
2019-11-26 22:59:12 -06:00
|
|
|
from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
|
|
|
|
|
2019-11-10 18:46:41 -06:00
|
|
|
|
|
|
|
class ToontownAIRepository(ToontownInternalRepository):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
|
|
|
|
|
|
|
|
def __init__(self, baseChannel, serverId, districtName):
|
|
|
|
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
|
|
|
|
self.districtName = districtName
|
2019-11-20 16:05:59 -06:00
|
|
|
self.doLiveUpdates = config.GetBool('want-live-updates', True)
|
2019-11-22 19:58:35 -06:00
|
|
|
self.wantCogdominiums = config.GetBool('want-cogdominiums', True)
|
2019-12-30 21:43:40 -06:00
|
|
|
self.useAllMinigames = config.GetBool('want-all-minigames', True)
|
2019-11-10 18:46:41 -06:00
|
|
|
self.districtId = None
|
|
|
|
self.district = None
|
2019-11-22 19:18:26 -06:00
|
|
|
self.districtStats = None
|
2019-11-17 15:29:23 -06:00
|
|
|
self.holidayManager = None
|
|
|
|
self.zoneDataStore = None
|
2019-11-22 19:58:35 -06:00
|
|
|
self.petMgr = None
|
|
|
|
self.suitInvasionManager = None
|
2019-12-30 21:43:40 -06:00
|
|
|
self.zoneAllocator = None
|
|
|
|
self.zoneId2owner = {}
|
2019-11-27 20:10:20 -06:00
|
|
|
self.questManager = None
|
|
|
|
self.promotionMgr = None
|
|
|
|
self.cogPageManager = None
|
2019-12-05 21:17:10 -06:00
|
|
|
self.raceMgr = None
|
2020-01-08 14:51:15 -06:00
|
|
|
self.factoryMgr = None
|
2019-11-22 21:11:12 -06:00
|
|
|
self.timeManager = None
|
2019-11-20 16:05:59 -06:00
|
|
|
self.newsManager = None
|
2019-12-05 20:38:58 -06:00
|
|
|
self.welcomeValleyManager = None
|
2019-11-17 15:29:23 -06:00
|
|
|
self.inGameNewsMgr = None
|
|
|
|
self.catalogManager = None
|
2019-11-22 19:58:35 -06:00
|
|
|
self.trophyMgr = None
|
|
|
|
self.zoneTable = {}
|
|
|
|
self.dnaStoreMap = {}
|
|
|
|
self.dnaDataMap = {}
|
|
|
|
self.hoods = []
|
|
|
|
self.buildingManagers = {}
|
|
|
|
self.suitPlanners = {}
|
2019-11-10 18:46:41 -06:00
|
|
|
|
|
|
|
def handleConnected(self):
|
|
|
|
ToontownInternalRepository.handleConnected(self)
|
|
|
|
|
|
|
|
# Generate our district...
|
|
|
|
self.districtId = self.allocateChannel()
|
|
|
|
self.district = ToontownDistrictAI(self)
|
|
|
|
self.district.setName(self.districtName)
|
|
|
|
self.district.generateWithRequiredAndId(self.districtId, self.getGameDoId(), OTP_ZONE_ID_DISTRICTS)
|
2019-11-10 19:50:13 -06:00
|
|
|
|
|
|
|
# Claim ownership of that district...
|
|
|
|
self.district.setAI(self.ourChannel)
|
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
# Create our local objects.
|
|
|
|
self.createLocals()
|
|
|
|
|
|
|
|
# Create our global objects.
|
|
|
|
self.createGlobals()
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
# Create our zones.
|
|
|
|
self.createZones()
|
|
|
|
|
2019-11-10 19:50:13 -06:00
|
|
|
# Make our district available, and we're done.
|
|
|
|
self.district.b_setAvailable(True)
|
|
|
|
self.notify.info('Done.')
|
2019-11-17 15:29:23 -06:00
|
|
|
|
|
|
|
def createLocals(self):
|
|
|
|
"""
|
|
|
|
Creates "local" (non-distributed) objects.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Create our holiday manager...
|
|
|
|
self.holidayManager = HolidayManagerAI(self)
|
|
|
|
|
|
|
|
# Create our zone data store...
|
|
|
|
self.zoneDataStore = AIZoneDataStore()
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
# Create our pet manager...
|
|
|
|
self.petMgr = PetManagerAI(self)
|
|
|
|
|
|
|
|
# Create our suit invasion manager...
|
|
|
|
self.suitInvasionManager = SuitInvasionManagerAI(self)
|
|
|
|
|
2019-12-30 21:43:40 -06:00
|
|
|
# Create our zone allocator...
|
|
|
|
self.zoneAllocator = UniqueIdAllocator(ToontownGlobals.DynamicZonesBegin, ToontownGlobals.DynamicZonesEnd)
|
|
|
|
|
2019-11-27 20:10:20 -06:00
|
|
|
# Create our quest manager...
|
|
|
|
self.questManager = QuestManagerAI(self)
|
|
|
|
|
|
|
|
# Create our promotion manager...
|
|
|
|
self.promotionMgr = PromotionManagerAI(self)
|
|
|
|
|
|
|
|
# Create our Cog page manager...
|
|
|
|
self.cogPageManager = CogPageManagerAI(self)
|
|
|
|
|
2019-12-05 21:17:10 -06:00
|
|
|
# Create our race manager...
|
|
|
|
self.raceMgr = RaceManagerAI(self)
|
|
|
|
|
2020-01-08 14:51:15 -06:00
|
|
|
# Create our factory manager...
|
|
|
|
self.factoryMgr = FactoryManagerAI(self)
|
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
def createGlobals(self):
|
|
|
|
"""
|
|
|
|
Creates "global" (distributed) objects.
|
|
|
|
"""
|
|
|
|
|
2019-11-22 19:18:26 -06:00
|
|
|
# Generate our district stats...
|
|
|
|
self.districtStats = ToontownDistrictStatsAI(self)
|
|
|
|
self.districtStats.settoontownDistrictId(self.districtId)
|
|
|
|
self.districtStats.generateWithRequiredAndId(self.allocateChannel(), self.district.getDoId(),
|
|
|
|
OTP_ZONE_ID_DISTRICTS_STATS)
|
|
|
|
|
2019-11-22 21:11:12 -06:00
|
|
|
# Generate our time manager...
|
|
|
|
self.timeManager = TimeManagerAI(self)
|
|
|
|
self.timeManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
|
|
|
|
2019-11-17 15:57:18 -06:00
|
|
|
# Generate our news manager...
|
|
|
|
self.newsManager = NewsManagerAI(self)
|
|
|
|
self.newsManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
|
|
|
|
2019-12-05 20:38:58 -06:00
|
|
|
# Generate our Welcome Valley manager...
|
|
|
|
self.welcomeValleyManager = WelcomeValleyManagerAI(self)
|
|
|
|
self.welcomeValleyManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
# Generate our in-game news manager...
|
|
|
|
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
|
|
|
|
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
|
|
|
|
|
|
|
# Generate our catalog manager...
|
|
|
|
self.catalogManager = CatalogManagerAI(self)
|
2019-11-20 14:12:05 -06:00
|
|
|
self.catalogManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
2019-11-17 15:29:23 -06:00
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
# Generate our trophy manager...
|
|
|
|
self.trophyMgr = DistributedTrophyMgrAI(self)
|
|
|
|
self.trophyMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
|
|
|
|
|
|
|
def generateHood(self, hoodConstructor, zoneId):
|
|
|
|
# Bossbot HQ doesn't use DNA, so we skip over that.
|
|
|
|
if zoneId != ToontownGlobals.BossbotHQ:
|
|
|
|
self.dnaStoreMap[zoneId] = DNAStorage()
|
|
|
|
self.dnaDataMap[zoneId] = loadDNAFileAI(self.dnaStoreMap[zoneId], self.genDNAFileName(zoneId))
|
|
|
|
if zoneId in ToontownGlobals.HoodHierarchy:
|
|
|
|
for streetId in ToontownGlobals.HoodHierarchy[zoneId]:
|
|
|
|
self.dnaStoreMap[streetId] = DNAStorage()
|
|
|
|
self.dnaDataMap[streetId] = loadDNAFileAI(self.dnaStoreMap[streetId], self.genDNAFileName(streetId))
|
|
|
|
|
|
|
|
hood = hoodConstructor(self, zoneId)
|
|
|
|
hood.startup()
|
|
|
|
self.hoods.append(hood)
|
|
|
|
|
|
|
|
def createZones(self):
|
2019-11-22 21:11:12 -06:00
|
|
|
# First, generate our zone2NpcDict...
|
|
|
|
NPCToons.generateZone2NpcDict()
|
2019-11-22 22:51:24 -06:00
|
|
|
|
2019-11-26 22:59:12 -06:00
|
|
|
# Donald's Dock
|
|
|
|
self.zoneTable[ToontownGlobals.DonaldsDock] = (
|
|
|
|
(ToontownGlobals.DonaldsDock, 1, 0), (ToontownGlobals.BarnacleBoulevard, 1, 1),
|
|
|
|
(ToontownGlobals.SeaweedStreet, 1, 1), (ToontownGlobals.LighthouseLane, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(DDHoodDataAI, ToontownGlobals.DonaldsDock)
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
# Toontown Central
|
|
|
|
self.zoneTable[ToontownGlobals.ToontownCentral] = (
|
|
|
|
(ToontownGlobals.ToontownCentral, 1, 0), (ToontownGlobals.SillyStreet, 1, 1),
|
|
|
|
(ToontownGlobals.LoopyLane, 1, 1), (ToontownGlobals.PunchlinePlace, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(TTHoodDataAI, ToontownGlobals.ToontownCentral)
|
|
|
|
|
2019-11-26 22:59:12 -06:00
|
|
|
# The Brrrgh
|
|
|
|
self.zoneTable[ToontownGlobals.TheBrrrgh] = (
|
|
|
|
(ToontownGlobals.TheBrrrgh, 1, 0), (ToontownGlobals.WalrusWay, 1, 1),
|
|
|
|
(ToontownGlobals.SleetStreet, 1, 1), (ToontownGlobals.PolarPlace, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(BRHoodDataAI, ToontownGlobals.TheBrrrgh)
|
|
|
|
|
|
|
|
# Minnie's Melodyland
|
|
|
|
self.zoneTable[ToontownGlobals.MinniesMelodyland] = (
|
|
|
|
(ToontownGlobals.MinniesMelodyland, 1, 0), (ToontownGlobals.AltoAvenue, 1, 1),
|
|
|
|
(ToontownGlobals.BaritoneBoulevard, 1, 1), (ToontownGlobals.TenorTerrace, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(MMHoodDataAI, ToontownGlobals.MinniesMelodyland)
|
|
|
|
|
|
|
|
# Daisy Gardens
|
|
|
|
self.zoneTable[ToontownGlobals.DaisyGardens] = (
|
|
|
|
(ToontownGlobals.DaisyGardens, 1, 0), (ToontownGlobals.ElmStreet, 1, 1),
|
|
|
|
(ToontownGlobals.MapleStreet, 1, 1), (ToontownGlobals.OakStreet, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(DGHoodDataAI, ToontownGlobals.DaisyGardens)
|
|
|
|
|
2020-01-08 00:40:54 -06:00
|
|
|
# Chip 'n Dale's Acorn Acres
|
|
|
|
self.zoneTable[ToontownGlobals.OutdoorZone] = (
|
|
|
|
(ToontownGlobals.OutdoorZone, 1, 0),
|
|
|
|
)
|
|
|
|
self.generateHood(OZHoodDataAI, ToontownGlobals.OutdoorZone)
|
|
|
|
|
2019-12-01 18:25:05 -06:00
|
|
|
# Goofy Speedway
|
|
|
|
self.zoneTable[ToontownGlobals.GoofySpeedway] = (
|
|
|
|
(ToontownGlobals.GoofySpeedway, 1, 0),
|
|
|
|
)
|
|
|
|
self.generateHood(GSHoodDataAI, ToontownGlobals.GoofySpeedway)
|
|
|
|
|
2019-11-26 22:59:12 -06:00
|
|
|
# Donald's Dreamland
|
|
|
|
self.zoneTable[ToontownGlobals.DonaldsDreamland] = (
|
|
|
|
(ToontownGlobals.DonaldsDreamland, 1, 0), (ToontownGlobals.LullabyLane, 1, 1),
|
|
|
|
(ToontownGlobals.PajamaPlace, 1, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(DLHoodDataAI, ToontownGlobals.DonaldsDreamland)
|
|
|
|
|
2020-01-08 14:51:15 -06:00
|
|
|
# Sellbot HQ
|
|
|
|
self.zoneTable[ToontownGlobals.SellbotHQ] = (
|
|
|
|
(ToontownGlobals.SellbotHQ, 0, 1), (ToontownGlobals.SellbotFactoryExt, 0, 1)
|
|
|
|
)
|
|
|
|
self.generateHood(CSHoodDataAI, ToontownGlobals.SellbotHQ)
|
|
|
|
|
2020-01-07 20:12:08 -06:00
|
|
|
# Chip 'n Dale's MiniGolf
|
|
|
|
self.zoneTable[ToontownGlobals.GolfZone] = (
|
|
|
|
(ToontownGlobals.GolfZone, 1, 0),
|
|
|
|
)
|
|
|
|
self.generateHood(GZHoodDataAI, ToontownGlobals.GolfZone)
|
|
|
|
|
2019-12-05 20:38:58 -06:00
|
|
|
# Welcome Valley zones
|
|
|
|
self.welcomeValleyManager.createWelcomeValleyZones()
|
|
|
|
|
2019-11-27 20:10:20 -06:00
|
|
|
# Assign the initial suit buildings.
|
2019-12-30 00:07:56 -06:00
|
|
|
for suitPlanner in list(self.suitPlanners.values()):
|
2019-11-27 20:10:20 -06:00
|
|
|
suitPlanner.assignInitialSuitBuildings()
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
def genDNAFileName(self, zoneId):
|
|
|
|
canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
|
|
|
|
canonicalHoodId = ZoneUtil.getCanonicalHoodId(canonicalZoneId)
|
|
|
|
hood = ToontownGlobals.dnaMap[canonicalHoodId]
|
|
|
|
if canonicalHoodId == canonicalZoneId:
|
|
|
|
canonicalZoneId = 'sz'
|
|
|
|
phase = ToontownGlobals.phaseMap[canonicalHoodId]
|
|
|
|
else:
|
|
|
|
phase = ToontownGlobals.streetPhaseMap[canonicalHoodId]
|
|
|
|
|
2020-01-07 20:16:42 -06:00
|
|
|
if 'outdoor_zone' in hood or 'golf_zone' in hood:
|
|
|
|
phase = '6'
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
return 'phase_%s/dna/%s_%s.dna' % (phase, hood, canonicalZoneId)
|
|
|
|
|
2019-12-01 18:25:05 -06:00
|
|
|
def lookupDNAFileName(self, dnaFileName):
|
|
|
|
searchPath = DSearchPath()
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_3.5/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_4/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_5/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_5.5/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_6/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_8/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_9/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_10/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_11/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_12/dna'))
|
|
|
|
searchPath.appendDirectory(Filename('resources/phase_13/dna'))
|
|
|
|
filename = Filename(dnaFileName)
|
|
|
|
found = vfs.resolveFilename(filename, searchPath)
|
|
|
|
if not found:
|
|
|
|
self.notify.warning('lookupDNAFileName - %s not found on:' % dnaFileName)
|
2019-12-30 00:07:56 -06:00
|
|
|
print(searchPath)
|
2019-12-01 18:25:05 -06:00
|
|
|
else:
|
|
|
|
return filename.getFullpath()
|
|
|
|
|
2019-11-22 19:58:35 -06:00
|
|
|
def loadDNAFileAI(self, dnaStore, dnaFileName):
|
|
|
|
return loadDNAFileAI(dnaStore, dnaFileName)
|
|
|
|
|
|
|
|
def findFishingPonds(self, dnaData, zoneId, area):
|
|
|
|
return [], [] # TODO
|
|
|
|
|
|
|
|
def findPartyHats(self, dnaData, zoneId):
|
|
|
|
return [] # TODO
|
|
|
|
|
2019-12-05 21:42:29 -06:00
|
|
|
def findRacingPads(self, dnaData, zoneId, area, type='racing_pad', overrideDNAZone=False):
|
|
|
|
kartPads, kartPadGroups = [], []
|
|
|
|
if type in dnaData.getName():
|
|
|
|
if type == 'racing_pad':
|
2020-01-01 18:55:54 -06:00
|
|
|
nameSplit = dnaData.getName().split('_')
|
2019-12-05 21:42:29 -06:00
|
|
|
racePad = DistributedRacePadAI(self)
|
|
|
|
racePad.setArea(area)
|
2020-01-01 18:55:54 -06:00
|
|
|
racePad.index = int(nameSplit[2])
|
|
|
|
racePad.genre = nameSplit[3]
|
|
|
|
trackInfo = RaceGlobals.getNextRaceInfo(-1, racePad.genre, racePad.index)
|
|
|
|
racePad.setTrackInfo([trackInfo[0], trackInfo[1]])
|
|
|
|
racePad.laps = trackInfo[2]
|
2019-12-05 21:42:29 -06:00
|
|
|
racePad.generateWithRequired(zoneId)
|
|
|
|
kartPads.append(racePad)
|
|
|
|
kartPadGroups.append(dnaData)
|
|
|
|
elif type == 'viewing_pad':
|
|
|
|
viewPad = DistributedViewPadAI(self)
|
|
|
|
viewPad.setArea(area)
|
|
|
|
viewPad.generateWithRequired(zoneId)
|
|
|
|
kartPads.append(viewPad)
|
|
|
|
kartPadGroups.append(dnaData)
|
|
|
|
|
2019-12-30 00:07:56 -06:00
|
|
|
for i in range(dnaData.getNumChildren()):
|
2019-12-05 21:42:29 -06:00
|
|
|
foundKartPads, foundKartPadGroups = self.findRacingPads(dnaData.at(i), zoneId, area, type, overrideDNAZone)
|
|
|
|
kartPads.extend(foundKartPads)
|
|
|
|
kartPadGroups.extend(foundKartPadGroups)
|
|
|
|
|
|
|
|
return kartPads, kartPadGroups
|
|
|
|
|
2020-01-02 13:19:22 -06:00
|
|
|
def findStartingBlocks(self, dnaData, kartPad):
|
2020-01-02 11:46:49 -06:00
|
|
|
startingBlocks = []
|
|
|
|
for i in range(dnaData.getNumChildren()):
|
|
|
|
groupName = dnaData.getName()
|
|
|
|
block = dnaData.at(i)
|
|
|
|
blockName = block.getName()
|
|
|
|
if 'starting_block' in blockName:
|
|
|
|
cls = DistributedStartingBlockAI if 'racing_pad' in groupName else DistributedViewingBlockAI
|
|
|
|
x, y, z = block.getPos()
|
|
|
|
h, p, r = block.getHpr()
|
|
|
|
padLocationId = int(blockName[-1])
|
2020-01-02 13:19:22 -06:00
|
|
|
startingBlock = cls(self, kartPad, x, y, z, h, p, r, padLocationId)
|
|
|
|
startingBlock.generateWithRequired(kartPad.zoneId)
|
2020-01-02 11:46:49 -06:00
|
|
|
startingBlocks.append(startingBlock)
|
|
|
|
|
|
|
|
return startingBlocks
|
2019-12-01 18:25:05 -06:00
|
|
|
|
|
|
|
def findLeaderBoards(self, dnaData, zoneId):
|
2019-12-05 21:03:12 -06:00
|
|
|
leaderBoards = []
|
|
|
|
if 'leaderBoard' in dnaData.getName():
|
|
|
|
x, y, z = dnaData.getPos()
|
|
|
|
h, p, r = dnaData.getHpr()
|
|
|
|
leaderBoard = DistributedLeaderBoardAI(self, dnaData.getName(), x, y, z, h, p, r)
|
|
|
|
leaderBoard.generateWithRequired(zoneId)
|
|
|
|
leaderBoards.append(leaderBoard)
|
|
|
|
|
2019-12-30 00:07:56 -06:00
|
|
|
for i in range(dnaData.getNumChildren()):
|
2019-12-05 21:03:12 -06:00
|
|
|
foundLeaderBoards = self.findLeaderBoards(dnaData.at(i), zoneId)
|
|
|
|
leaderBoards.extend(foundLeaderBoards)
|
|
|
|
|
|
|
|
return leaderBoards
|
2019-12-01 18:25:05 -06:00
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
def getTrackClsends(self):
|
|
|
|
return False
|
|
|
|
|
|
|
|
def getAvatarExitEvent(self, avId):
|
|
|
|
return 'distObjDelete-%d' % avId
|
|
|
|
|
2019-11-27 19:14:30 -06:00
|
|
|
def getAvatarDisconnectReason(self, avId):
|
|
|
|
return self.timeManager.avId2disconnectcode.get(avId, ToontownGlobals.DisconnectUnknown)
|
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
def getZoneDataStore(self):
|
|
|
|
return self.zoneDataStore
|
|
|
|
|
|
|
|
def incrementPopulation(self):
|
2019-11-22 19:18:26 -06:00
|
|
|
self.districtStats.b_setAvatarCount(self.districtStats.getAvatarCount() + 1)
|
2019-11-17 15:29:23 -06:00
|
|
|
|
|
|
|
def decrementPopulation(self):
|
2019-11-22 19:18:26 -06:00
|
|
|
self.districtStats.b_setAvatarCount(self.districtStats.getAvatarCount() - 1)
|
2019-11-17 15:29:23 -06:00
|
|
|
|
2019-12-30 21:43:40 -06:00
|
|
|
def allocateZone(self, owner=None):
|
|
|
|
zoneId = self.zoneAllocator.allocate()
|
|
|
|
if owner:
|
|
|
|
self.zoneId2owner[zoneId] = owner
|
|
|
|
|
|
|
|
return zoneId
|
|
|
|
|
|
|
|
def deallocateZone(self, zone):
|
|
|
|
if self.zoneId2owner.get(zone):
|
|
|
|
del self.zoneId2owner[zone]
|
|
|
|
|
|
|
|
self.zoneAllocator.free(zone)
|
|
|
|
|
2019-11-17 15:29:23 -06:00
|
|
|
def sendQueryToonMaxHp(self, avId, callback):
|
|
|
|
pass # TODO?
|