Poodletooth-iLand/toontown/cogdominium/DistCogdoCraneAI.py

51 lines
1.3 KiB
Python
Raw Normal View History

from pandac.PandaModules import *
from direct.distributed import DistributedObjectAI
from toontown.toonbase import ToontownGlobals
from otp.otpbase import OTPGlobals
from direct.fsm import FSM
2015-03-03 16:10:12 -06:00
class DistCogdoCraneAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM):
2015-03-03 16:10:12 -06:00
def __init__(self, air, craneGame, index):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
FSM.FSM.__init__(self, 'DistCogdoCraneAI')
self.craneGame = craneGame
self.index = index
self.avId = 0
self.objectId = 0
2015-03-03 16:10:12 -06:00
def getCraneGameId(self):
return self.craneGame.doId
def getIndex(self):
return self.index
def generate(self):
DistributedObjectAI.DistributedObjectAI.generate(self)
self.request('Free')
2015-03-03 16:10:12 -06:00
def d_setState(self, state, avId):
self.sendUpdate('setState', [state, avId])
def enterOff(self):
2015-03-03 16:10:12 -06:00
pass
def exitOff(self):
2015-03-03 16:10:12 -06:00
pass
def enterControlled(self, avId):
self.avId = avId
self.d_setState('C', avId)
def exitControlled(self):
if self.objectId:
obj = self.air.doId2do[self.objectId]
obj.request('Dropped', self.avId, self.doId)
def enterFree(self):
self.avId = 0
self.d_setState('F', 0)
def exitFree(self):
2015-03-03 16:10:12 -06:00
pass