racing: race pad AI is an FSM now

pretty cool, huh?
This commit is contained in:
John Cote 2020-01-01 19:41:58 -05:00
parent b24e485fa0
commit c9b1cb214b

View file

@ -1,14 +1,24 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import globalClockDelta
from direct.fsm.FSM import FSM
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
class DistributedRacePadAI(DistributedKartPadAI):
class DistributedRacePadAI(DistributedKartPadAI, FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRacePadAI')
defaultTransitions = {'Off': ['WaitEmpty'],
'WaitEmpty': ['WaitCountdown', 'Off'],
'WaitCountdown': ['WaitEmpty',
'WaitBoarding',
'Off',
'AllAboard'],
'WaitBoarding': ['AllAboard', 'WaitEmpty', 'Off'],
'AllAboard': ['Off', 'WaitEmpty', 'WaitCountdown']}
def __init__(self, air):
DistributedKartPadAI.__init__(self, air)
FSM.__init__(self, 'DistributedRacePadAI')
self.state = 'Off'
self.trackInfo = [0, 0]
@ -29,4 +39,5 @@ class DistributedRacePadAI(DistributedKartPadAI):
return self.trackInfo
def request(self, state):
FSM.request(self, state)
self.b_setState(state)