2015-06-23 18:11:48 -05:00
|
|
|
from panda3d.core import *
|
2015-04-28 22:26:53 -05:00
|
|
|
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
|
|
|
|
2015-04-28 22:26:53 -05:00
|
|
|
class DistCogdoCraneAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM):
|
2015-03-03 16:10:12 -06:00
|
|
|
|
2015-04-28 22:26:53 -05: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
|
|
|
|
2015-04-28 22:26:53 -05: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
|
|
|
|
2015-04-28 22:26:53 -05:00
|
|
|
def d_setState(self, state, avId):
|
|
|
|
self.sendUpdate('setState', [state, avId])
|
|
|
|
|
|
|
|
def enterOff(self):
|
2015-03-03 16:10:12 -06:00
|
|
|
pass
|
|
|
|
|
2015-04-28 22:26:53 -05:00
|
|
|
def exitOff(self):
|
2015-03-03 16:10:12 -06:00
|
|
|
pass
|
|
|
|
|
2015-04-28 22:26:53 -05:00
|
|
|
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
|