mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 03:35:12 -06:00
Circuit points fix and grand prix races end properly now
This commit is contained in:
parent
584eafbd7d
commit
f2581b6aa5
10 changed files with 20 additions and 36 deletions
2
dependencies/astron/dclass/stride.dc
vendored
2
dependencies/astron/dclass/stride.dc
vendored
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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([])
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue