minigame: fix more minigame crashes

This commit is contained in:
John Cote 2020-01-07 16:44:33 -05:00
parent 7786de4334
commit 2ace6ce632
4 changed files with 9 additions and 8 deletions

View file

@ -14,7 +14,6 @@ from toontown.char import Char
from . import ArrowKeys from . import ArrowKeys
import random import random
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import string
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
class DistributedPatternGame(DistributedMinigame): class DistributedPatternGame(DistributedMinigame):
@ -538,7 +537,7 @@ class DistributedPatternGame(DistributedMinigame):
return self.__getRowPos(self.frontRowHome, self.frontRowXSpacing, index, len(self.avIdList)) return self.__getRowPos(self.frontRowHome, self.frontRowXSpacing, index, len(self.avIdList))
def __setMinnieChat(self, str, giggle): def __setMinnieChat(self, str, giggle):
str = string.replace(str, '%s', self.getAvatar(self.localAvId).getName()) str = str.replace('%s', self.getAvatar(self.localAvId).getName())
self.minnie.setChatAbsolute(str, CFSpeech) self.minnie.setChatAbsolute(str, CFSpeech)
if giggle: if giggle:
self.minnie.playDialogue('statementA', 1) self.minnie.playDialogue('statementA', 1)

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from pandac.PandaModules import * from pandac.PandaModules import *
from libtoontown import *
from toontown.toonbase.ToonBaseGlobal import * from toontown.toonbase.ToonBaseGlobal import *
from .DistributedMinigame import * from .DistributedMinigame import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
@ -292,10 +293,10 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase):
self.queue = CollisionHandlerQueue() self.queue = CollisionHandlerQueue()
self.traverser = CollisionTraverser('traverser name') self.traverser = CollisionTraverser('traverser name')
self.rayArray = [] self.rayArray = []
vRange = (GOODROWS - BADROWS) / 2 vRange = (GOODROWS - BADROWS) // 2
for row in range(-(GOODROWS / 2), GOODROWS / 2 + 1): for row in range(-(GOODROWS // 2), GOODROWS // 2 + 1):
for column in range(-(GOODROWS / 2), GOODROWS / 2 + 1): for column in range(-(GOODROWS // 2), GOODROWS // 2 + 1):
goodRange = list(range(-((GOODROWS - BADROWS) / 2), (GOODROWS - BADROWS) / 2 + 1)) goodRange = list(range(-((GOODROWS - BADROWS) // 2), (GOODROWS - BADROWS) // 2 + 1))
rayQuality = 'g' rayQuality = 'g'
if row not in goodRange or column not in goodRange: if row not in goodRange or column not in goodRange:
rayQuality = 'l' rayQuality = 'l'

View file

@ -821,7 +821,7 @@ class DistributedTargetGame(DistributedMinigame):
open.setScale(1.5) open.setScale(1.5)
closed = umbrella.find('**/closed_umbrella') closed = umbrella.find('**/closed_umbrella')
closed.show() closed.show()
hand = toon.find('**/joint_Rhold') hand = toon.getRightHands()[0]
ce = CompassEffect.make(NodePath(), CompassEffect.PRot) ce = CompassEffect.make(NodePath(), CompassEffect.PRot)
closed.node().setEffect(ce) closed.node().setEffect(ce)
closed.setHpr(0.0, 90.0, 35.0) closed.setHpr(0.0, 90.0, 35.0)

View file

@ -3,6 +3,7 @@ from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from . import TravelGameGlobals from . import TravelGameGlobals
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
import functools
class DistributedTravelGameAI(DistributedMinigameAI): class DistributedTravelGameAI(DistributedMinigameAI):
notify = directNotify.newCategory('DistributedTravelGameAI') notify = directNotify.newCategory('DistributedTravelGameAI')
@ -107,7 +108,7 @@ class DistributedTravelGameAI(DistributedMinigameAI):
else: else:
return 1 return 1
self.directionVotes.sort(voteCompare, reverse=True) self.directionVotes.sort(key=functools.cmp_to_key(voteCompare), reverse=True)
winningVotes = self.directionVotes[0][1] winningVotes = self.directionVotes[0][1]
self.winningDirections = [] self.winningDirections = []
self.notify.debug('self.directionVotes = %s' % self.directionVotes) self.notify.debug('self.directionVotes = %s' % self.directionVotes)