From fa710cfd8050d9fe19ced1b7e85d5a3e64214992 Mon Sep 17 00:00:00 2001 From: John Cote Date: Thu, 9 Jan 2020 23:22:11 -0500 Subject: [PATCH] coghq: fix some cfo crashes --- toontown/coghq/DistributedCashbotBossCrane.py | 1 + toontown/suit/DistributedCashbotBoss.py | 6 ++++-- toontown/suit/DistributedCashbotBossAI.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toontown/coghq/DistributedCashbotBossCrane.py b/toontown/coghq/DistributedCashbotBossCrane.py index 0e3fe13..15e888d 100644 --- a/toontown/coghq/DistributedCashbotBossCrane.py +++ b/toontown/coghq/DistributedCashbotBossCrane.py @@ -1,5 +1,6 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * +from libotp import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from direct.fsm import FSM diff --git a/toontown/suit/DistributedCashbotBoss.py b/toontown/suit/DistributedCashbotBoss.py index 5e5a618..71a6228 100644 --- a/toontown/suit/DistributedCashbotBoss.py +++ b/toontown/suit/DistributedCashbotBoss.py @@ -19,8 +19,10 @@ from toontown.distributed import DelayDelete from toontown.chat import ResistanceChat from toontown.coghq import CogDisguiseGlobals from pandac.PandaModules import * +from libotp import * import random import math +import functools OneBossCog = None TTL = TTLocalizer @@ -44,7 +46,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def announceGenerate(self): DistributedBossCog.DistributedBossCog.announceGenerate(self) self.setName(TTLocalizer.CashbotBossName) - nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self.name, + nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self._name, 'dept': SuitDNA.getDeptFullname(self.style.dept)} self.setDisplayName(nameInfo) target = CollisionSphere(2, 0, 0, 3) @@ -244,7 +246,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): newCollisionNode.setIntoCollideMask(newCollideMask) threshold = 0.1 - planes.sort(lambda p1, p2: p1.compareTo(p2, threshold)) + planes.sort(key=functools.cmp_to_key(lambda p1, p2: p1.compareTo(p2, threshold))) lastPlane = None for plane in planes: if lastPlane == None or plane.compareTo(lastPlane, threshold) != 0: diff --git a/toontown/suit/DistributedCashbotBossAI.py b/toontown/suit/DistributedCashbotBossAI.py index daacd5c..8bec91c 100644 --- a/toontown/suit/DistributedCashbotBossAI.py +++ b/toontown/suit/DistributedCashbotBossAI.py @@ -10,6 +10,7 @@ from toontown.chat import ResistanceChat from direct.fsm import FSM from toontown.suit import DistributedBossCogAI import random, math +import functools class DistributedCashbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCashbotBossAI') @@ -69,7 +70,7 @@ class DistributedCashbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def compareJoinChance(a, b): return cmp(a[1], b[1]) - reserveSuits.sort(compareJoinChance) + reserveSuits.sort(key=functools.cmp_to_key(compareJoinChance)) return {'activeSuits': activeSuits, 'reserveSuits': reserveSuits} def removeToon(self, avId):