historical/toontown-classic.git/toontown/safezone/SafeZoneManagerAI.py

32 lines
763 B
Python
Raw Normal View History

2024-01-16 17:20:27 +00:00
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()