safezone: Generate our safezone manager
This commit is contained in:
parent
7a16ad3662
commit
7eeedfab1d
2 changed files with 32 additions and 0 deletions
|
@ -42,6 +42,7 @@ from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockA
|
|||
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
|
||||
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
|
||||
from toontown.racing.RaceManagerAI import RaceManagerAI
|
||||
from toontown.safezone.SafeZoneManagerAI import SafeZoneManagerAI
|
||||
from toontown.shtiker.CogPageManagerAI import CogPageManagerAI
|
||||
from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
|
||||
from toontown.toon import NPCToons
|
||||
|
@ -82,6 +83,7 @@ class ToontownAIRepository(ToontownInternalRepository):
|
|||
self.inGameNewsMgr = None
|
||||
self.catalogManager = None
|
||||
self.trophyMgr = None
|
||||
self.safeZoneManager = None
|
||||
self.zoneTable = {}
|
||||
self.dnaStoreMap = {}
|
||||
self.dnaDataMap = {}
|
||||
|
@ -196,6 +198,10 @@ class ToontownAIRepository(ToontownInternalRepository):
|
|||
self.trophyMgr = DistributedTrophyMgrAI(self)
|
||||
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):
|
||||
# Bossbot HQ doesn't use DNA, so we skip over that.
|
||||
if zoneId != ToontownGlobals.BossbotHQ:
|
||||
|
|
|
@ -1,5 +1,31 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
|
||||
HealFrequency = 30.0
|
||||
|
||||
|
||||
class SafeZoneManagerAI(DistributedObjectAI):
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue