2019-11-08 22:55:55 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
|
|
|
|
2020-08-12 12:42:31 -05:00
|
|
|
HealFrequency = 30.0
|
|
|
|
|
|
|
|
|
2019-11-08 22:55:55 -06:00
|
|
|
class SafeZoneManagerAI(DistributedObjectAI):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('SafeZoneManagerAI')
|
2020-08-12 12:42:31 -05:00
|
|
|
|
|
|
|
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()
|