minigame: more fixes

This commit is contained in:
John Cote 2019-12-31 00:20:22 -05:00
parent c5c733560f
commit c7f144e160
7 changed files with 11 additions and 10 deletions

View file

@ -22,6 +22,7 @@ from . import Trajectory
from . import Maze from . import Maze
from . import MinigameAvatarScorePanel from . import MinigameAvatarScorePanel
from . import MinigameGlobals from . import MinigameGlobals
import functools
class DistributedMazeGame(DistributedMinigame): class DistributedMazeGame(DistributedMinigame):
notify = directNotify.newCategory('DistributedMazeGame') notify = directNotify.newCategory('DistributedMazeGame')
@ -1038,7 +1039,7 @@ class DistributedMazeGame(DistributedMinigame):
updateTics = self.suits[i].getThinkTimestampTics(curTic) updateTics = self.suits[i].getThinkTimestampTics(curTic)
suitUpdates.extend(list(zip(updateTics, [i] * len(updateTics)))) suitUpdates.extend(list(zip(updateTics, [i] * len(updateTics))))
suitUpdates.sort(lambda a, b: a[0] - b[0]) suitUpdates.sort(key=functools.cmp_to_key(lambda a, b: a[0] - b[0]))
if len(suitUpdates) > 0: if len(suitUpdates) > 0:
curTic = 0 curTic = 0
for i in range(len(suitUpdates)): for i in range(len(suitUpdates)):

View file

@ -249,9 +249,9 @@ class DistributedVineGameAI(DistributedMinigameAI):
pass pass
if not newFacingRight == 0 and not newFacingRight == 1: if not newFacingRight == 0 and not newFacingRight == 1:
newFacingRight = 1 newFacingRight = 1
if newPosX < -1000 or newPosX > 2000: if newPosX and (newPosX < -1000 or newPosX > 2000):
newPosX = 0 newPosX = 0
if newPosZ < -100 or newPosZ > 1000: if newPosZ and (newPosZ < -100 or newPosZ > 1000):
newPosZ = 0 newPosZ = 0
if newVelX < -1000 or newVelX > 1000: if newVelX < -1000 or newVelX > 1000:
newVelX = 0 newVelX = 0

View file

@ -187,7 +187,7 @@ class MazeSuit(DirectObject):
if curTic < self.nextThinkTic: if curTic < self.nextThinkTic:
return [] return []
else: else:
r = list(range(self.nextThinkTic, curTic + 1, self.ticPeriod)) r = list(range(int(self.nextThinkTic), curTic + 1, self.ticPeriod))
self.lastTicBeforeRender = r[-1] self.lastTicBeforeRender = r[-1]
return r return r

View file

@ -13,8 +13,8 @@ class MinigamePowerMeter(DirectFrame):
if label == None: if label == None:
label = TTLocalizer.MinigamePowerMeterLabel label = TTLocalizer.MinigamePowerMeterLabel
self.powerText = DirectLabel(self, relief=None, text=label, text_scale=TTLocalizer.MPMpowerText, pos=(0.01, 0.0, 0.29)) self.powerText = DirectLabel(self, relief=None, text=label, text_scale=TTLocalizer.MPMpowerText, pos=(0.01, 0.0, 0.29))
self.tooSlow = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooSlow, scale=TTLocalizer.MPMtooSlow, pos=(-.15, 0, 0.05), color=(0.1, 0.3, 0.6)) self.tooSlow = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooSlow, scale=TTLocalizer.MPMtooSlow, pos=(-.15, 0, 0.05), color=LVector4f(0.1, 0.3, 0.6, 1))
self.tooFast = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooFast, scale=TTLocalizer.MPMtooFast, pos=(0.15, 0, 0.05), color=(0.1, 0.3, 0.6)) self.tooFast = DirectLabel(parent=self, relief=None, text=TTLocalizer.MinigamePowerMeterTooFast, scale=TTLocalizer.MPMtooFast, pos=(0.15, 0, 0.05), color=LVector4f(0.1, 0.3, 0.6, 1))
self.tooSlow.hide() self.tooSlow.hide()
self.tooFast.hide() self.tooFast.hide()
self.largeGauge = [] self.largeGauge = []

View file

@ -45,8 +45,8 @@ def convertValueToGagTrackAndLevel(value):
def convertRankToGagTrackAndLevel(rank): def convertRankToGagTrackAndLevel(rank):
track = int(rank % (ToontownBattleGlobals.MAX_TRACK_INDEX + 1)) track = rank % (ToontownBattleGlobals.MAX_TRACK_INDEX + 1)
level = rank / (ToontownBattleGlobals.MAX_TRACK_INDEX + 1) level = int(rank / (ToontownBattleGlobals.MAX_TRACK_INDEX + 1))
return (track, level) return (track, level)

View file

@ -23,7 +23,7 @@ class VineBat(NodePath, DirectObject):
bat3 = gameAssets.find('**/bat3') bat3 = gameAssets.find('**/bat3')
bat2 = gameAssets.find('**/bat2') bat2 = gameAssets.find('**/bat2')
bat1 = gameAssets.find('**/bat__1') bat1 = gameAssets.find('**/bat__1')
seqNode = SequenceNode.SequenceNode('bat') seqNode = SequenceNode('bat')
seqNode.addChild(bat1.node()) seqNode.addChild(bat1.node())
seqNode.addChild(bat2.node()) seqNode.addChild(bat2.node())
seqNode.addChild(bat3.node()) seqNode.addChild(bat3.node())

View file

@ -17,7 +17,7 @@ class VineSpider(NodePath, DirectObject):
gameAssets = loader.loadModel('phase_4/models/minigames/vine_game') gameAssets = loader.loadModel('phase_4/models/minigames/vine_game')
spider2 = gameAssets.find('**/spider_3') spider2 = gameAssets.find('**/spider_3')
spider1 = gameAssets.find('**/spider_2') spider1 = gameAssets.find('**/spider_2')
seqNode = SequenceNode.SequenceNode('spider') seqNode = SequenceNode('spider')
seqNode.addChild(spider1.node()) seqNode.addChild(spider1.node())
seqNode.addChild(spider2.node()) seqNode.addChild(spider2.node())
seqNode.setFrameRate(2) seqNode.setFrameRate(2)