safezone: Generate our safezone manager

This commit is contained in:
John Cote 2020-08-12 13:42:31 -04:00
parent 7a16ad3662
commit 7eeedfab1d
No known key found for this signature in database
GPG key ID: 441B09E8E9A41873
2 changed files with 32 additions and 0 deletions

View file

@ -42,6 +42,7 @@ from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockA
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
from toontown.racing.RaceManagerAI import RaceManagerAI from toontown.racing.RaceManagerAI import RaceManagerAI
from toontown.safezone.SafeZoneManagerAI import SafeZoneManagerAI
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
from toontown.toon import NPCToons from toontown.toon import NPCToons
@ -82,6 +83,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.inGameNewsMgr = None self.inGameNewsMgr = None
self.catalogManager = None self.catalogManager = None
self.trophyMgr = None self.trophyMgr = None
self.safeZoneManager = None
self.zoneTable = {} self.zoneTable = {}
self.dnaStoreMap = {} self.dnaStoreMap = {}
self.dnaDataMap = {} self.dnaDataMap = {}
@ -196,6 +198,10 @@ class ToontownAIRepository(ToontownInternalRepository):
self.trophyMgr = DistributedTrophyMgrAI(self) self.trophyMgr = DistributedTrophyMgrAI(self)
self.trophyMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT) self.trophyMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
# Generate our safezone manager...
self.safeZoneManager = SafeZoneManagerAI(self)
self.safeZoneManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
def generateHood(self, hoodConstructor, zoneId): def generateHood(self, hoodConstructor, zoneId):
# Bossbot HQ doesn't use DNA, so we skip over that. # Bossbot HQ doesn't use DNA, so we skip over that.
if zoneId != ToontownGlobals.BossbotHQ: if zoneId != ToontownGlobals.BossbotHQ:

View file

@ -1,5 +1,31 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.DistributedObjectAI import DistributedObjectAI
HealFrequency = 30.0
class SafeZoneManagerAI(DistributedObjectAI): class SafeZoneManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('SafeZoneManagerAI') notify = DirectNotifyGlobal.directNotify.newCategory('SafeZoneManagerAI')
def enterSafeZone(self):
avId = self.air.getAvatarIdFromSender()
if not avId:
return
av = self.air.doId2do.get(avId)
if not av:
return
if not av.isToonedUp():
av.startToonUp(HealFrequency)
def exitSafeZone(self):
avId = self.air.getAvatarIdFromSender()
if not avId:
return
av = self.air.doId2do.get(avId)
if not av:
return
av.stopToonUp()