Merge pull request #86 from demiurgeQuantified/playground-npcs

Add NPC toons to playgrounds/streets
This commit is contained in:
Little Cat 2023-05-23 23:51:34 -03:00 committed by GitHub
commit 4c9cce887f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View file

@ -36,12 +36,14 @@ from toontown.hood.TTHoodDataAI import TTHoodDataAI
from toontown.pets.PetManagerAI import PetManagerAI
from toontown.quest.QuestManagerAI import QuestManagerAI
from toontown.racing import RaceGlobals
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
from toontown.racing.RaceManagerAI import RaceManagerAI
from toontown.uberdog.DistributedPartyManagerAI import DistributedPartyManagerAI
from toontown.safezone.SafeZoneManagerAI import SafeZoneManagerAI
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
from toontown.spellbook.ToontownMagicWordManagerAI import ToontownMagicWordManagerAI
@ -91,6 +93,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.trophyMgr = None
self.safeZoneManager = None
self.magicWordManager = None
self.partyManager = None
self.zoneTable = {}
self.dnaStoreMap = {}
self.dnaDataMap = {}
@ -225,6 +228,10 @@ class ToontownAIRepository(ToontownInternalRepository):
self.tutorialManager = TutorialManagerAI(self)
self.tutorialManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
# Generate our party manager...
self.partyManager = DistributedPartyManagerAI(self)
self.partyManager.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:
@ -374,7 +381,29 @@ class ToontownAIRepository(ToontownInternalRepository):
return loadDNAFileAI(dnaStore, dnaFileName)
def findFishingPonds(self, dnaData, zoneId, area):
return [], [] # TODO
fishingPonds, fishingPondGroups = [], []
if "fishing_pond" in dnaData.getName():
fishingPondGroups.append(dnaData)
pond = DistributedFishingPondAI(self)
pond.setArea(area)
pond.generateWithRequired(zoneId)
fishingPonds.append(pond)
else:
if isinstance(dnaData, DNAVisGroup):
name = dnaData.getName()
visId = int(name.split(":", 1)[0]) % 1000
zoneId = ZoneUtil.getHoodId(zoneId) + visId
for i in range(dnaData.getNumChildren()):
foundFishingPonds, foundFishingPondGroups = self.findFishingPonds(dnaData.at(i), zoneId, area)
fishingPonds.extend(foundFishingPonds)
fishingPondGroups.extend(foundFishingPondGroups)
return fishingPonds, fishingPondGroups
def findFishingSpots(self, dnaData, pond):
return [] # TODO
def findPartyHats(self, dnaData, zoneId):
return [] # TODO

View file

@ -3,3 +3,13 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedFishingPondAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFishingPondAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.area = None
def setArea(self, area):
self.area = area
def getArea(self):
return self.area

View file

@ -3,3 +3,6 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedPartyManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPartyManagerAI')
def canBuyParties(self):
return False # TODO