diff --git a/dependencies/astron/dclass/stride.dc b/dependencies/astron/dclass/stride.dc index 51b805ab..c7c5e205 100644 --- a/dependencies/astron/dclass/stride.dc +++ b/dependencies/astron/dclass/stride.dc @@ -2431,7 +2431,7 @@ dclass DistributedRace : DistributedObject { dropAnvilOn(uint32, uint32, int16) broadcast ram; shootPiejectile(uint32, uint32, uint8) broadcast ram; racerDisconnected(uint32) broadcast ram; - setPlace(uint32, uint32/1000, uint8, uint32, uint8, uint32, uint32, uint32[], uint16[], uint32/1000) broadcast ram; + setPlace(uint32, uint32/1000, uint8, uint32, uint8, uint32, uint32, uint32[], uint8[], uint32/1000) broadcast ram; setCircuitPlace(uint32, uint8, uint32, uint32, uint32, uint32[]) broadcast ram; endCircuitRace() broadcast ram; setRaceZone(uint32, uint32); diff --git a/toontown/racing/DistributedRace.py b/toontown/racing/DistributedRace.py index df9a0f61..24ffa597 100755 --- a/toontown/racing/DistributedRace.py +++ b/toontown/racing/DistributedRace.py @@ -184,7 +184,7 @@ class DistributedRace(DistributedObject.DistributedObject): del i self.piejectileManager.delete() - if not hasattr(base, 'race'): + if not hasattr(base, 'race') or not hasattr(self, 'curveTs'): return if self.curveTs: del self.curveTs @@ -257,7 +257,6 @@ class DistributedRace(DistributedObject.DistributedObject): return def setCircuitPlace(self, avId, place, entryFee, winnings, bonus, trophies): - print 'setting cicruit place' if self.fsm.getCurrentState().getName() == 'leaving': return if avId == localAvatar.doId: @@ -270,13 +269,9 @@ class DistributedRace(DistributedObject.DistributedObject): self.placeFixup.append([oldPlace - 1, place - 1]) avatar = base.cr.doId2do.get(avId, None) if avatar: - print 'circuit trophies %s' % trophies - print 'winnings %s' % winnings self.gui.racerFinishedCircuit(avId, oldPlace, entryFee, winnings, bonus, trophies) - return def endCircuitRace(self): - print self.placeFixup self.gui.circuitFinished(self.placeFixup) def prepForRace(self): @@ -1205,7 +1200,6 @@ class DistributedRace(DistributedObject.DistributedObject): dotP = arrowVec.dot(fvec) if dotP > 0.7: self.localKart.startTurbo() - return def fadeOutMusic(self): if self.musicTrack: diff --git a/toontown/racing/DistributedRaceAI.py b/toontown/racing/DistributedRaceAI.py index 9d76e5a8..b36acebe 100755 --- a/toontown/racing/DistributedRaceAI.py +++ b/toontown/racing/DistributedRaceAI.py @@ -33,8 +33,6 @@ class DistributedRaceAI(DistributedObjectAI, FSM): self.livingGags = [] self.currentlyAffectedByAnvil = {} self.avatarProgress = {} - print 'circuit points %s' % (circuitPoints,) - print 'circuit winnings %s' % (circuitWinnings,) self.circuitPoints = circuitPoints self.circuitWinnings = circuitWinnings self.quitAvatars = [] @@ -139,7 +137,7 @@ class DistributedRaceAI(DistributedObjectAI, FSM): def setCircuitLoop(self, circuitLoop): self.circuitLoop = circuitLoop if self.circuitLoop and not self.circuitPoints: - self.circuitPoints = [0] * len(self.avatars) + self.circuitPoints = [[0, 0]] * len(self.avatars) self.circuitWinnings = [0] * len(self.avatars) def getCircuitLoop(self): @@ -357,17 +355,20 @@ class DistributedRaceAI(DistributedObjectAI, FSM): if av.getTickets() > RaceGlobals.MaxTickets: av.b_setTickets(RaceGlobals.MaxTickets) av.addStat(ToontownGlobals.STAT_RACING) + points = [] if self.circuitPoints: avIndex = self.avatars.index(avId) - self.circuitPoints[avIndex] += RaceGlobals.CircuitPoints[place - 1] - self.sendUpdate('setPlace', [avId, totalTime, place, entryFee, qualify, max((winnings-entryFee), 0), bonus, trophies, self.circuitPoints, 0]) + points = self.circuitPoints[avIndex] + points[0] += points[1] + points[1] = RaceGlobals.CircuitPoints[place - 1] + self.sendUpdate('setPlace', [avId, totalTime, place, entryFee, qualify, max((winnings-entryFee), 0), bonus, trophies, points, 0]) if self.circuitPoints: self.circuitWinnings[avIndex] += winnings - del self.circuitLoop[0] - self.sendUpdate('setCircuitLoop', [self.circuitLoop]) self.sendUpdate('setCircuitPlace', [avId, place, entryFee, self.circuitWinnings[avIndex], bonus, trophies]) if len(self.finishedAvatars) == len(self.avatars): + del self.circuitLoop[0] + self.sendUpdate('setCircuitLoop', [self.circuitLoop]) self.sendUpdate('endCircuitRace') def calculateTrophies(self, avId, won, qualify, time): diff --git a/toontown/racing/DistributedRacePadAI.py b/toontown/racing/DistributedRacePadAI.py index 99882bdb..44e665ac 100755 --- a/toontown/racing/DistributedRacePadAI.py +++ b/toontown/racing/DistributedRacePadAI.py @@ -126,8 +126,6 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM): race.setRaceType(self.trackType) race.setAvatars(avatars) if self.trackType == RaceGlobals.Circuit: - print 'Circuit!' - print 'circuit loop: %s' % (RaceGlobals.getCircuitLoop(self.trackId),) race.setCircuitLoop(RaceGlobals.getCircuitLoop(self.trackId)) else: race.setCircuitLoop([]) diff --git a/toontown/racing/DistributedVehicle.py b/toontown/racing/DistributedVehicle.py index 8d630378..a3898c43 100755 --- a/toontown/racing/DistributedVehicle.py +++ b/toontown/racing/DistributedVehicle.py @@ -205,6 +205,9 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.engine = engine def disable(self): + if self.ownerId not in DistributedVehicle.AvId2kart: + return + DistributedVehicle.AvId2kart.pop(self.ownerId) self.finishMovies() self.request('Off') diff --git a/toontown/racing/Kart.py b/toontown/racing/Kart.py index 2feeb2c6..e51aeb7b 100755 --- a/toontown/racing/Kart.py +++ b/toontown/racing/Kart.py @@ -523,14 +523,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): node.setH(amount) def generateEngineStartTrack(self): - length = self.kartStartSfx.length() - - def printVol(): - print self.kartLoopSfx.getVolume() - - track = Parallel(SoundInterval(self.kartStartSfx), Func(self.kartLoopSfx.play), LerpFunctionInterval(self.kartLoopSfx.setVolume, fromData=0, toData=0.4, duration=length)) - return Sequence(track, Func(printVol)) + return Parallel(SoundInterval(self.kartStartSfx), Func(self.kartLoopSfx.play), LerpFunctionInterval(self.kartLoopSfx.setVolume, fromData=0, toData=0.4, duration=self.kartStartSfx.length())) def generateEngineStopTrack(self, duration = 0): - track = Parallel(LerpFunctionInterval(self.kartLoopSfx.setVolume, fromData=0.4, toData=0, duration=duration)) - return track + return Parallel(LerpFunctionInterval(self.kartLoopSfx.setVolume, fromData=0.4, toData=0, duration=duration)) diff --git a/toontown/racing/Piejectile.py b/toontown/racing/Piejectile.py index 8dde5e1e..7de3ef99 100755 --- a/toontown/racing/Piejectile.py +++ b/toontown/racing/Piejectile.py @@ -43,7 +43,6 @@ class Piejectile(DirectObject, FlyingGag): self.rotH = randFloat(-360, 360) self.rotP = randFloat(-90, 90) self.rotR = randFloat(-90, 90) - print 'generating Pie %s' % self.name self.ownerKart = base.cr.doId2do.get(base.race.kartMap.get(sourceId, None), None) if targetId != 0: self.targetKart = base.cr.doId2do.get(base.race.kartMap.get(targetId, None), None) @@ -64,10 +63,8 @@ class Piejectile(DirectObject, FlyingGag): else: self.splatTask = taskMgr.doMethodLater(self.maxTime / 2.5, self.splat, self.splatTaskName) self.reparentTo(render) - return def delete(self): - print 'removing piejectile' taskMgr.remove(self.taskName) self.__undoCollisions() self.physicsMgr.clearLinearForces() diff --git a/toontown/racing/RaceEndPanels.py b/toontown/racing/RaceEndPanels.py index fe9bd430..2f424fc8 100755 --- a/toontown/racing/RaceEndPanels.py +++ b/toontown/racing/RaceEndPanels.py @@ -131,8 +131,8 @@ class RaceResultsPanel(DirectFrame): self.entryListSeqs.append(displayPar) if circuitPoints: self.pointsLabel.show() - newPoints = circuitPoints[:].pop() - currentPoints = sum(circuitPoints[:-1]) + newPoints = circuitPoints[1] + currentPoints = circuitPoints[0] self.entryList[place - 1][5]['text'] = '%s' % currentPoints self.entryList[place - 1][6]['text'] = ' + %s' % newPoints @@ -178,7 +178,7 @@ class RaceResultsPanel(DirectFrame): shiftRacersSeq.append(Parallel(Func(fixPlaceValue), LerpPosInterval(self.rowFrame[oldPlace], 1, newPos))) self.circuitFinishSeq = Sequence(calcPointsSeq, shiftRacersSeq) - if not len(self.race.circuitLoop) == 0: + if len(self.race.circuitLoop) > 1: self.notify.debug('Not the last race in a circuit, pressing next race in 30 secs') self.circuitFinishSeq.append(Wait(30)) self.circuitFinishSeq.append(Func(self.raceEndPanel.closeButtonPressed)) @@ -331,7 +331,7 @@ class RaceEndPanel(DirectFrame): self.race = race self.results = RaceResultsPanel(numRacers, race, self, parent=self, pos=(0, 0, 0.525)) self.winnings = RaceWinningsPanel(race, parent=self, pos=(0, 0, -0.525)) - if len(self.race.circuitLoop) == 0: + if len(self.race.circuitLoop) <= 1: exitText = TTLocalizer.KartRace_Exit else: exitText = TTLocalizer.KartRace_NextRace @@ -374,7 +374,6 @@ class RaceEndPanel(DirectFrame): self.results.updateWinnings(place, winnings) def updateWinningsFromCircuit(self, place, entryFee, winnings, bonus, trophies = ()): - print 'updateWinningsFromCircuit' self.seq.finish() self.results.updateWinnings(place, winnings + entryFee + bonus) self.startWinningsPanel(entryFee, winnings, 0, bonus, trophies, True) diff --git a/toontown/racing/RaceGUI.py b/toontown/racing/RaceGUI.py index 7f9f3d3c..cde41644 100755 --- a/toontown/racing/RaceGUI.py +++ b/toontown/racing/RaceGUI.py @@ -275,7 +275,7 @@ class RaceGUI: def enableResultMode(self): self.endPanel.enable() - if not self.race.circuitLoop: + if len(self.race.circuitLoop) > 1: taskMgr.doMethodLater(180, self.endPanel.closeButtonPressed, 'clearRaceEndPanel', extraArgs=[]) def destroy(self): diff --git a/toontown/racing/RaceGlobals.py b/toontown/racing/RaceGlobals.py index 4562091a..f410c360 100755 --- a/toontown/racing/RaceGlobals.py +++ b/toontown/racing/RaceGlobals.py @@ -542,7 +542,6 @@ def getCircuitLoop(startingTrack): circuitLoop = [startingTrack] for loop in CircuitLoops: if startingTrack in loop: - print loop numTracks = len(loop) tempLoop = loop * 2 startingIndex = tempLoop.index(startingTrack)