2019-11-08 22:55:55 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
2019-12-05 21:42:29 -06:00
|
|
|
from direct.distributed.ClockDelta import globalClockDelta
|
2020-01-01 18:41:58 -06:00
|
|
|
from direct.fsm.FSM import FSM
|
2019-11-08 22:55:55 -06:00
|
|
|
|
2019-12-05 21:42:29 -06:00
|
|
|
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
|
|
|
|
|
|
|
|
2020-01-01 18:41:58 -06:00
|
|
|
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
2019-11-08 22:55:55 -06:00
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRacePadAI')
|
2020-01-01 18:41:58 -06:00
|
|
|
defaultTransitions = {'Off': ['WaitEmpty'],
|
|
|
|
'WaitEmpty': ['WaitCountdown', 'Off'],
|
|
|
|
'WaitCountdown': ['WaitEmpty',
|
|
|
|
'WaitBoarding',
|
|
|
|
'Off',
|
|
|
|
'AllAboard'],
|
|
|
|
'WaitBoarding': ['AllAboard', 'WaitEmpty', 'Off'],
|
|
|
|
'AllAboard': ['Off', 'WaitEmpty', 'WaitCountdown']}
|
2019-12-05 21:42:29 -06:00
|
|
|
|
|
|
|
def __init__(self, air):
|
|
|
|
DistributedKartPadAI.__init__(self, air)
|
2020-01-01 18:41:58 -06:00
|
|
|
FSM.__init__(self, 'DistributedRacePadAI')
|
2019-12-05 21:42:29 -06:00
|
|
|
self.state = 'Off'
|
|
|
|
self.trackInfo = [0, 0]
|
|
|
|
|
|
|
|
def setState(self, state):
|
|
|
|
self.state = state
|
|
|
|
|
|
|
|
def d_setState(self, state):
|
|
|
|
self.sendUpdate('setState', [state, globalClockDelta.getRealNetworkTime()])
|
|
|
|
|
|
|
|
def b_setState(self, state):
|
|
|
|
self.setState(state)
|
|
|
|
self.d_setState(state)
|
|
|
|
|
|
|
|
def getState(self):
|
|
|
|
return self.state, globalClockDelta.getRealNetworkTime()
|
|
|
|
|
|
|
|
def getTrackInfo(self):
|
|
|
|
return self.trackInfo
|
|
|
|
|
|
|
|
def request(self, state):
|
2020-01-01 18:41:58 -06:00
|
|
|
FSM.request(self, state)
|
2019-12-05 21:42:29 -06:00
|
|
|
self.b_setState(state)
|