2020-01-02 21:44:57 -06:00
|
|
|
from direct.distributed.ClockDelta import globalClockDelta
|
|
|
|
|
|
|
|
|
2019-11-08 22:55:55 -06:00
|
|
|
class Racer:
|
2020-01-02 21:02:07 -06:00
|
|
|
|
|
|
|
def __init__(self, race, air, avId, zoneId):
|
|
|
|
self.race = race
|
|
|
|
self.air = air
|
|
|
|
self.avId = avId
|
|
|
|
self.zoneId = zoneId
|
|
|
|
self.avatar = self.air.doId2do.get(self.avId)
|
|
|
|
self.avatar.takeOutKart(self.zoneId)
|
|
|
|
self.kart = self.avatar.kart
|
|
|
|
self.finished = False
|
2020-01-02 21:44:57 -06:00
|
|
|
self.maxLap = 0
|
|
|
|
self.lapT = 0.0
|
|
|
|
self.baseTime = 0.0
|
|
|
|
self.totalTime = 0.0
|
|
|
|
self.exited = False
|
2020-01-02 21:02:07 -06:00
|
|
|
self.exitEvent = self.air.getAvatarExitEvent(self.avId)
|
2020-01-02 21:44:57 -06:00
|
|
|
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
|