mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-31 00:37:54 +00:00
42 lines
1.7 KiB
Python
Executable file
42 lines
1.7 KiB
Python
Executable file
from otp.ai.AIBase import *
|
|
from direct.interval.IntervalGlobal import *
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
import DistributedCrusherEntityAI
|
|
import StomperGlobals
|
|
from direct.distributed import ClockDelta
|
|
from toontown.coghq import CrusherCellAI
|
|
|
|
class DistributedStomperAI(DistributedCrusherEntityAI.DistributedCrusherEntityAI):
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedStomperAI')
|
|
|
|
def __init__(self, level, entId, pairId = -1):
|
|
DistributedCrusherEntityAI.DistributedCrusherEntityAI.__init__(self, level, entId)
|
|
self.pairId = pairId
|
|
|
|
def generate(self):
|
|
DistributedCrusherEntityAI.DistributedCrusherEntityAI.generate(self)
|
|
if self.switchId != 0:
|
|
self.accept(self.getOutputEventName(self.switchId), self.reactToSwitch)
|
|
self.d_startStomper()
|
|
|
|
def delete(self):
|
|
del self.pos
|
|
self.ignoreAll()
|
|
DistributedCrusherEntityAI.DistributedCrusherEntityAI.delete(self)
|
|
|
|
def d_startStomper(self):
|
|
self.sendUpdate('setMovie', [StomperGlobals.STOMPER_START, ClockDelta.globalClockDelta.getRealNetworkTime(), []])
|
|
|
|
def reactToSwitch(self, on):
|
|
if on:
|
|
crushedList = []
|
|
if self.crushCell:
|
|
self.crushCell.updateCrushables()
|
|
for id in self.crushCell.occupantIds:
|
|
if id in self.crushCell.crushables:
|
|
crushedList.append(id)
|
|
|
|
self.sendCrushMsg()
|
|
self.sendUpdate('setMovie', [StomperGlobals.STOMPER_STOMP, ClockDelta.globalClockDelta.getRealNetworkTime(), crushedList])
|
|
else:
|
|
self.sendUpdate('setMovie', [StomperGlobals.STOMPER_RISE, ClockDelta.globalClockDelta.getRealNetworkTime(), []])
|