mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 03:35:12 -06:00
49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
from direct.task.Task import Task
|
|
from otp.ai.AIBaseGlobal import *
|
|
from toontown.toonbase import ToontownGlobals
|
|
import DistributedAnimatedPropAI
|
|
import time
|
|
|
|
class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedPropAI):
|
|
def __init__(self, air, propId):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.__init__(self, air, propId)
|
|
self.fsm.setName('DistributedKnockKnockDoor')
|
|
self.propId = propId
|
|
self.doLaterTask = None
|
|
|
|
def delete(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.delete(self)
|
|
|
|
def enterOff(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.enterOff(self)
|
|
|
|
def exitOff(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitOff(self)
|
|
|
|
def attractTask(self, task):
|
|
self.fsm.request('attract')
|
|
return Task.done
|
|
|
|
def enterAttract(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.enterAttract(self)
|
|
|
|
def exitAttract(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitAttract(self)
|
|
|
|
def enterPlaying(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.enterPlaying(self)
|
|
self.doLaterTask = taskMgr.doMethodLater(9, self.attractTask, self.uniqueName('knockKnock-timer'))
|
|
|
|
def exitPlaying(self):
|
|
DistributedAnimatedPropAI.DistributedAnimatedPropAI.exitPlaying(self)
|
|
taskMgr.remove(self.doLaterTask)
|
|
self.doLaterTask = None
|
|
|
|
def requestToonup(self):
|
|
av = self.air.doId2do.get(self.air.getAvatarIdFromSender())
|
|
|
|
if (not av) or av.getHp() == av.getMaxHp() or av.getNextKnockHeal() > time.time():
|
|
return
|
|
|
|
av.toonUp(ToontownGlobals.KnockKnockHeal)
|
|
av.b_setNextKnockHeal(int(time.time() + ToontownGlobals.KnockKnockCooldown))
|