def __init__(self, air, trackId, zoneId, avIds, laps, raceType, racerFinishedFunc, raceDoneFunc, circuitLoop, circuitPoints, circuitTimes, qualTimes=[], circuitTimeList={}, circuitTotalBonusTickets={}): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.trackId = trackId self.direction = self.trackId % 2 self.zoneId = zoneId self.racers = {} self.avIds = [] self.kickedAvIds = [] self.circuitPoints = circuitPoints self.circuitTimes = circuitTimes self.finishPending = [] self.flushPendingTask = None self.kickSlowRacersTask = None for avId in avIds: if avId and avId in self.air.doId2do: self.avIds.append(avId) self.racers[avId] = Racer.Racer(self, air, avId, zoneId) self.toonCount = len(self.racers) self.startingPlaces = nonRepeatingRandomList(self.toonCount, 4) self.thrownGags = [] self.ready = False self.setGo = False self.racerFinishedFunc = racerFinishedFunc self.raceDoneFunc = raceDoneFunc self.lapCount = laps self.raceType = raceType if raceType == RaceGlobals.Practice: self.gagList = [] else: self.gagList = [0] * len(RaceGlobals.TrackDict[trackId][4]) self.circuitLoop = circuitLoop self.qualTimes = qualTimes self.circuitTimeList = circuitTimeList self.qualTimes.append(RaceGlobals.TrackDict[trackId][1]) self.circuitTotalBonusTickets = circuitTotalBonusTickets return
def __init__(self, air, trackId, zoneId, avIds, laps, raceType, racerFinishedFunc, raceDoneFunc, circuitLoop, circuitPoints, circuitTimes, qualTimes = [], circuitTimeList = {}, circuitTotalBonusTickets = {}): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.trackId = trackId # infer direction (odd id's are rev) self.direction = self.trackId % 2 self.zoneId = zoneId self.racers = {} self.avIds=[] self.kickedAvIds = [] self.circuitPoints = circuitPoints self.circuitTimes = circuitTimes self.finishPending = [] self.flushPendingTask = None self.kickSlowRacersTask = None #Create the list of avatars that we will potentially cull from for avId in avIds: if(avId) and avId in self.air.doId2do: self.avIds.append(avId) #Create each racer info, which also generates the karts self.racers[avId] = Racer.Racer(self, air, avId, zoneId) #At this point, we have karts on the AI self.toonCount = len(self.racers) self.startingPlaces = nonRepeatingRandomList(self.toonCount, 4) self.thrownGags = [] self.ready = False self.setGo = False self.racerFinishedFunc = racerFinishedFunc self.raceDoneFunc = raceDoneFunc self.lapCount = laps self.raceType = raceType if(raceType==RaceGlobals.Practice): self.gagList=[] else: self.gagList = [0]*len(RaceGlobals.TrackDict[trackId][4]) self.circuitLoop = circuitLoop self.qualTimes = qualTimes self.circuitTimeList = circuitTimeList self.qualTimes.append(RaceGlobals.TrackDict[trackId][1]) self.circuitTotalBonusTickets = circuitTotalBonusTickets