racing: race tracks now cycle
This commit is contained in:
parent
cfd323ed74
commit
06ca87a01e
|
|
@ -5,6 +5,7 @@ from direct.fsm.FSM import FSM
|
||||||
from toontown.racing import RaceGlobals
|
from toontown.racing import RaceGlobals
|
||||||
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
|
||||||
from toontown.racing.KartShopGlobals import KartGlobals
|
from toontown.racing.KartShopGlobals import KartGlobals
|
||||||
|
from toontown.racing.RaceManagerAI import CircuitRaceHolidayMgr
|
||||||
|
|
||||||
|
|
||||||
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
|
|
@ -27,6 +28,15 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
self.laps = 3
|
self.laps = 3
|
||||||
self.avIds = []
|
self.avIds = []
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
taskMgr.remove(self.uniqueName('changeTrack'))
|
||||||
|
taskMgr.remove(self.uniqueName('countdownTask'))
|
||||||
|
DistributedKartPadAI.delete(self)
|
||||||
|
|
||||||
|
def request(self, state):
|
||||||
|
FSM.request(self, state)
|
||||||
|
self.b_setState(state)
|
||||||
|
|
||||||
def setState(self, state):
|
def setState(self, state):
|
||||||
self.state = state
|
self.state = state
|
||||||
|
|
||||||
|
|
@ -41,14 +51,39 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
|
||||||
return self.state, globalClockDelta.getRealNetworkTime()
|
return self.state, globalClockDelta.getRealNetworkTime()
|
||||||
|
|
||||||
def setTrackInfo(self, trackInfo):
|
def setTrackInfo(self, trackInfo):
|
||||||
self.trackInfo = [trackInfo[0], trackInfo[1]]
|
self.trackInfo = trackInfo
|
||||||
|
|
||||||
|
def d_setTrackInfo(self, trackInfo):
|
||||||
|
self.sendUpdate('setTrackInfo', [trackInfo])
|
||||||
|
|
||||||
|
def b_setTrackInfo(self, trackInfo):
|
||||||
|
self.setTrackInfo(trackInfo)
|
||||||
|
self.d_setTrackInfo(trackInfo)
|
||||||
|
|
||||||
def getTrackInfo(self):
|
def getTrackInfo(self):
|
||||||
return self.trackInfo
|
return self.trackInfo
|
||||||
|
|
||||||
def request(self, state):
|
def enterWaitEmpty(self):
|
||||||
FSM.request(self, state)
|
taskMgr.doMethodLater(RaceGlobals.TrackSignDuration, self.changeTrack, self.uniqueName('changeTrack'))
|
||||||
self.b_setState(state)
|
|
||||||
|
def exitWaitEmpty(self):
|
||||||
|
taskMgr.remove(self.uniqueName('changeTrack'))
|
||||||
|
|
||||||
|
def enterWaitCountdown(self):
|
||||||
|
taskMgr.doMethodLater(KartGlobals.COUNTDOWN_TIME, self.considerAllAboard, self.uniqueName('countdownTask'))
|
||||||
|
|
||||||
|
def exitWaitCountdown(self):
|
||||||
|
taskMgr.remove(self.uniqueName('countdownTask'))
|
||||||
|
|
||||||
|
def changeTrack(self, task):
|
||||||
|
trackInfo = RaceGlobals.getNextRaceInfo(self.trackInfo[0], self.genre, self.index)
|
||||||
|
trackId, raceType = trackInfo[0], trackInfo[1]
|
||||||
|
if raceType == RaceGlobals.ToonBattle and bboard.get(CircuitRaceHolidayMgr.PostName):
|
||||||
|
raceType = RaceGlobals.Circuit
|
||||||
|
|
||||||
|
self.b_setTrackInfo([trackId, raceType])
|
||||||
|
self.laps = trackInfo[2]
|
||||||
|
return task.again
|
||||||
|
|
||||||
def addAvBlock(self, avId, startingBlock, paid):
|
def addAvBlock(self, avId, startingBlock, paid):
|
||||||
av = self.air.doId2do.get(avId)
|
av = self.air.doId2do.get(avId)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue