racing: race pad AI is an FSM now
pretty cool, huh?
This commit is contained in:
parent
b24e485fa0
commit
c9b1cb214b
1 changed files with 12 additions and 1 deletions
|
@ -1,14 +1,24 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.ClockDelta import globalClockDelta
|
from direct.distributed.ClockDelta import globalClockDelta
|
||||||
|
from direct.fsm.FSM import FSM
|
||||||
|
|
||||||
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
||||||
|
|
||||||
|
|
||||||
class DistributedRacePadAI(DistributedKartPadAI):
|
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedRacePadAI')
|
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):
|
def __init__(self, air):
|
||||||
DistributedKartPadAI.__init__(self, air)
|
DistributedKartPadAI.__init__(self, air)
|
||||||
|
FSM.__init__(self, 'DistributedRacePadAI')
|
||||||
self.state = 'Off'
|
self.state = 'Off'
|
||||||
self.trackInfo = [0, 0]
|
self.trackInfo = [0, 0]
|
||||||
|
|
||||||
|
@ -29,4 +39,5 @@ class DistributedRacePadAI(DistributedKartPadAI):
|
||||||
return self.trackInfo
|
return self.trackInfo
|
||||||
|
|
||||||
def request(self, state):
|
def request(self, state):
|
||||||
|
FSM.request(self, state)
|
||||||
self.b_setState(state)
|
self.b_setState(state)
|
||||||
|
|
Loading…
Reference in a new issue