racing: working on race pads
This commit is contained in:
parent
23bc0691c7
commit
cfd323ed74
1 changed files with 35 additions and 0 deletions
|
@ -2,7 +2,9 @@ from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.ClockDelta import globalClockDelta
|
from direct.distributed.ClockDelta import globalClockDelta
|
||||||
from direct.fsm.FSM import FSM
|
from direct.fsm.FSM import FSM
|
||||||
|
|
||||||
|
from toontown.racing import RaceGlobals
|
||||||
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
||||||
|
from toontown.racing.KartShopGlobals import KartGlobals
|
||||||
|
|
||||||
|
|
||||||
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
|
@ -23,6 +25,7 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
self.state = 'Off'
|
self.state = 'Off'
|
||||||
self.trackInfo = [0, 0]
|
self.trackInfo = [0, 0]
|
||||||
self.laps = 3
|
self.laps = 3
|
||||||
|
self.avIds = []
|
||||||
|
|
||||||
def setState(self, state):
|
def setState(self, state):
|
||||||
self.state = state
|
self.state = state
|
||||||
|
@ -46,3 +49,35 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
def request(self, state):
|
def request(self, state):
|
||||||
FSM.request(self, state)
|
FSM.request(self, state)
|
||||||
self.b_setState(state)
|
self.b_setState(state)
|
||||||
|
|
||||||
|
def addAvBlock(self, avId, startingBlock, paid):
|
||||||
|
av = self.air.doId2do.get(avId)
|
||||||
|
if not av:
|
||||||
|
return
|
||||||
|
|
||||||
|
if not av.hasKart():
|
||||||
|
return KartGlobals.ERROR_CODE.eNoKart
|
||||||
|
elif self.state == 'Off':
|
||||||
|
return KartGlobals.ERROR_CODE.eTrackClosed
|
||||||
|
elif self.state in ('AllAboard', 'WaitBoarding'):
|
||||||
|
return KartGlobals.ERROR_CODE.eBoardOver
|
||||||
|
elif startingBlock.avId != 0:
|
||||||
|
return KartGlobals.ERROR_CODE.eOcuppied
|
||||||
|
elif RaceGlobals.getEntryFee(self.trackInfo[0], self.trackInfo[1]) > av.getTickets():
|
||||||
|
return KartGlobals.ERROR_CODE.eTickets
|
||||||
|
|
||||||
|
self.avIds.append(avId)
|
||||||
|
if not self.state == 'WaitCountdown':
|
||||||
|
self.request('WaitCountdown')
|
||||||
|
|
||||||
|
return KartGlobals.ERROR_CODE.success
|
||||||
|
|
||||||
|
def removeAvBlock(self, avId, startingBlock):
|
||||||
|
if avId == startingBlock.avId and avId in self.avIds:
|
||||||
|
self.avIds.remove(avId)
|
||||||
|
|
||||||
|
def kartMovieDone(self):
|
||||||
|
if len(self.avIds) == 0 and not self.state == 'WaitEmpty':
|
||||||
|
self.request('WaitEmpty')
|
||||||
|
if self.state == 'WaitBoarding':
|
||||||
|
self.considerAllAboard(0)
|
||||||
|
|
Loading…
Reference in a new issue