racing: track info is now set properly

This commit is contained in:
John Cote 2020-01-01 19:55:54 -05:00
parent c9b1cb214b
commit c77ae8f744
2 changed files with 12 additions and 0 deletions

View file

@ -24,6 +24,7 @@ from toontown.hood.MMHoodDataAI import MMHoodDataAI
from toontown.hood.TTHoodDataAI import TTHoodDataAI from toontown.hood.TTHoodDataAI import TTHoodDataAI
from toontown.pets.PetManagerAI import PetManagerAI from toontown.pets.PetManagerAI import PetManagerAI
from toontown.quest.QuestManagerAI import QuestManagerAI from toontown.quest.QuestManagerAI import QuestManagerAI
from toontown.racing import RaceGlobals
from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI from toontown.racing.DistributedLeaderBoardAI import DistributedLeaderBoardAI
from toontown.racing.DistributedRacePadAI import DistributedRacePadAI from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
@ -281,8 +282,14 @@ class ToontownAIRepository(ToontownInternalRepository):
kartPads, kartPadGroups = [], [] kartPads, kartPadGroups = [], []
if type in dnaData.getName(): if type in dnaData.getName():
if type == 'racing_pad': if type == 'racing_pad':
nameSplit = dnaData.getName().split('_')
racePad = DistributedRacePadAI(self) racePad = DistributedRacePadAI(self)
racePad.setArea(area) racePad.setArea(area)
racePad.index = int(nameSplit[2])
racePad.genre = nameSplit[3]
trackInfo = RaceGlobals.getNextRaceInfo(-1, racePad.genre, racePad.index)
racePad.setTrackInfo([trackInfo[0], trackInfo[1]])
racePad.laps = trackInfo[2]
racePad.generateWithRequired(zoneId) racePad.generateWithRequired(zoneId)
kartPads.append(racePad) kartPads.append(racePad)
kartPadGroups.append(dnaData) kartPadGroups.append(dnaData)

View file

@ -19,8 +19,10 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
def __init__(self, air): def __init__(self, air):
DistributedKartPadAI.__init__(self, air) DistributedKartPadAI.__init__(self, air)
FSM.__init__(self, 'DistributedRacePadAI') FSM.__init__(self, 'DistributedRacePadAI')
self.genre = 'urban'
self.state = 'Off' self.state = 'Off'
self.trackInfo = [0, 0] self.trackInfo = [0, 0]
self.laps = 3
def setState(self, state): def setState(self, state):
self.state = state self.state = state
@ -35,6 +37,9 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
def getState(self): def getState(self):
return self.state, globalClockDelta.getRealNetworkTime() return self.state, globalClockDelta.getRealNetworkTime()
def setTrackInfo(self, trackInfo):
self.trackInfo = [trackInfo[0], trackInfo[1]]
def getTrackInfo(self): def getTrackInfo(self):
return self.trackInfo return self.trackInfo