racing: practice races work

This commit is contained in:
John Cote 2020-01-02 22:44:57 -05:00
parent 9e742f51c4
commit 518c526c99
2 changed files with 15 additions and 1 deletions

View file

@ -322,7 +322,7 @@ class RaceManagerAI(DirectObject.DirectObject):
self.notify.debug('already has grandtouring')
self.notify.debug('trophies %s' % trophies)
self.notify.debug('GrandTouring: already has grand touring %s' % trophies[RaceGlobals.GrandTouring])
for i in range(1, RaceGlobals.NumTrophies / RaceGlobals.TrophiesPerCup + 1):
for i in range(1, RaceGlobals.NumTrophies // RaceGlobals.TrophiesPerCup + 1):
cupNum = (trophies[:RaceGlobals.NumTrophies].count(1) + addTrophyCount) / (i * RaceGlobals.TrophiesPerCup)
self.notify.debug('cupNum: %s' % cupNum)
trophyIndex = RaceGlobals.TrophyCups[i - 1]

View file

@ -1,3 +1,6 @@
from direct.distributed.ClockDelta import globalClockDelta
class Racer:
def __init__(self, race, air, avId, zoneId):
@ -9,4 +12,15 @@ class Racer:
self.avatar.takeOutKart(self.zoneId)
self.kart = self.avatar.kart
self.finished = False
self.maxLap = 0
self.lapT = 0.0
self.baseTime = 0.0
self.totalTime = 0.0
self.exited = False
self.exitEvent = self.air.getAvatarExitEvent(self.avId)
self.race.accept(self.exitEvent, self.race.unexpectedExit, [self.avId])
def setLapT(self, numLaps, t, timestamp):
self.maxLap = numLaps
self.lapT = t
self.totalTime = globalClockDelta.networkToLocalTime(timestamp) - self.baseTime