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