From c7f144e16094768db5cc4e818ad1a296d016f81f Mon Sep 17 00:00:00 2001 From: John Cote Date: Tue, 31 Dec 2019 00:20:22 -0500 Subject: [PATCH] minigame: more fixes --- toontown/minigame/DistributedMazeGame.py | 3 ++- toontown/minigame/DistributedVineGameAI.py | 4 ++-- toontown/minigame/MazeSuit.py | 2 +- toontown/minigame/MinigamePowerMeter.py | 4 ++-- toontown/minigame/PlayingCardGlobals.py | 4 ++-- toontown/minigame/VineBat.py | 2 +- toontown/minigame/VineSpider.py | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/toontown/minigame/DistributedMazeGame.py b/toontown/minigame/DistributedMazeGame.py index 763aead..91d881d 100644 --- a/toontown/minigame/DistributedMazeGame.py +++ b/toontown/minigame/DistributedMazeGame.py @@ -22,6 +22,7 @@ from . import Trajectory from . import Maze from . import MinigameAvatarScorePanel from . import MinigameGlobals +import functools class DistributedMazeGame(DistributedMinigame): notify = directNotify.newCategory('DistributedMazeGame') @@ -1038,7 +1039,7 @@ class DistributedMazeGame(DistributedMinigame): updateTics = self.suits[i].getThinkTimestampTics(curTic) 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: curTic = 0 for i in range(len(suitUpdates)): diff --git a/toontown/minigame/DistributedVineGameAI.py b/toontown/minigame/DistributedVineGameAI.py index 6b3fbe5..4ee5bb0 100644 --- a/toontown/minigame/DistributedVineGameAI.py +++ b/toontown/minigame/DistributedVineGameAI.py @@ -249,9 +249,9 @@ class DistributedVineGameAI(DistributedMinigameAI): pass if not newFacingRight == 0 and not newFacingRight == 1: newFacingRight = 1 - if newPosX < -1000 or newPosX > 2000: + if newPosX and (newPosX < -1000 or newPosX > 2000): newPosX = 0 - if newPosZ < -100 or newPosZ > 1000: + if newPosZ and (newPosZ < -100 or newPosZ > 1000): newPosZ = 0 if newVelX < -1000 or newVelX > 1000: newVelX = 0 diff --git a/toontown/minigame/MazeSuit.py b/toontown/minigame/MazeSuit.py index 05bdb3d..2d58989 100644 --- a/toontown/minigame/MazeSuit.py +++ b/toontown/minigame/MazeSuit.py @@ -187,7 +187,7 @@ class MazeSuit(DirectObject): if curTic < self.nextThinkTic: return [] else: - r = list(range(self.nextThinkTic, curTic + 1, self.ticPeriod)) + r = list(range(int(self.nextThinkTic), curTic + 1, self.ticPeriod)) self.lastTicBeforeRender = r[-1] return r diff --git a/toontown/minigame/MinigamePowerMeter.py b/toontown/minigame/MinigamePowerMeter.py index a409e7b..6d6b7ad 100644 --- a/toontown/minigame/MinigamePowerMeter.py +++ b/toontown/minigame/MinigamePowerMeter.py @@ -13,8 +13,8 @@ class MinigamePowerMeter(DirectFrame): if label == None: label = TTLocalizer.MinigamePowerMeterLabel 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.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.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=LVector4f(0.1, 0.3, 0.6, 1)) self.tooSlow.hide() self.tooFast.hide() self.largeGauge = [] diff --git a/toontown/minigame/PlayingCardGlobals.py b/toontown/minigame/PlayingCardGlobals.py index 5391394..d2c9c51 100644 --- a/toontown/minigame/PlayingCardGlobals.py +++ b/toontown/minigame/PlayingCardGlobals.py @@ -45,8 +45,8 @@ def convertValueToGagTrackAndLevel(value): def convertRankToGagTrackAndLevel(rank): - track = int(rank % (ToontownBattleGlobals.MAX_TRACK_INDEX + 1)) - level = rank / (ToontownBattleGlobals.MAX_TRACK_INDEX + 1) + track = rank % (ToontownBattleGlobals.MAX_TRACK_INDEX + 1) + level = int(rank / (ToontownBattleGlobals.MAX_TRACK_INDEX + 1)) return (track, level) diff --git a/toontown/minigame/VineBat.py b/toontown/minigame/VineBat.py index 7f2bab2..0b688b3 100644 --- a/toontown/minigame/VineBat.py +++ b/toontown/minigame/VineBat.py @@ -23,7 +23,7 @@ class VineBat(NodePath, DirectObject): bat3 = gameAssets.find('**/bat3') bat2 = gameAssets.find('**/bat2') bat1 = gameAssets.find('**/bat__1') - seqNode = SequenceNode.SequenceNode('bat') + seqNode = SequenceNode('bat') seqNode.addChild(bat1.node()) seqNode.addChild(bat2.node()) seqNode.addChild(bat3.node()) diff --git a/toontown/minigame/VineSpider.py b/toontown/minigame/VineSpider.py index c8eeb78..0c5602d 100644 --- a/toontown/minigame/VineSpider.py +++ b/toontown/minigame/VineSpider.py @@ -17,7 +17,7 @@ class VineSpider(NodePath, DirectObject): gameAssets = loader.loadModel('phase_4/models/minigames/vine_game') spider2 = gameAssets.find('**/spider_3') spider1 = gameAssets.find('**/spider_2') - seqNode = SequenceNode.SequenceNode('spider') + seqNode = SequenceNode('spider') seqNode.addChild(spider1.node()) seqNode.addChild(spider2.node()) seqNode.setFrameRate(2)