From cf68a25f815e59f459911edc9587b95ac2002c48 Mon Sep 17 00:00:00 2001 From: John Cote Date: Fri, 10 Jan 2020 21:42:03 -0500 Subject: [PATCH] coghq: fix some cj crashes --- toontown/suit/DistributedLawbotBoss.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toontown/suit/DistributedLawbotBoss.py b/toontown/suit/DistributedLawbotBoss.py index 5efbf65..60dd74e 100644 --- a/toontown/suit/DistributedLawbotBoss.py +++ b/toontown/suit/DistributedLawbotBoss.py @@ -6,6 +6,7 @@ from direct.showbase.PythonUtil import Functor from direct.showbase.PythonUtil import StackTrace from direct.gui.DirectGui import * from pandac.PandaModules import * +from libotp import * from direct.fsm import FSM from direct.fsm import ClassicFSM from direct.fsm import State @@ -27,6 +28,7 @@ from toontown.toon import NPCToons from direct.task import Task import random import math +import functools from toontown.coghq import CogDisguiseGlobals from toontown.building import ElevatorConstants from toontown.toonbase import ToontownTimer @@ -88,7 +90,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.notify.debug('----- announceGenerate') DistributedBossCog.DistributedBossCog.announceGenerate(self) self.setName(TTLocalizer.LawbotBossName) - nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self.name, + nameInfo = TTLocalizer.BossCogNameWithDept % {'name': self._name, 'dept': SuitDNA.getDeptFullname(self.style.dept)} self.setDisplayName(nameInfo) self.piesRestockSfx = loader.loadSfx('phase_5/audio/sfx/LB_receive_evidence.mp3') @@ -1348,7 +1350,7 @@ class DistributedLawbotBoss(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: @@ -1586,7 +1588,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): return bossTrack def __makeWitnessToon(self): - dnaNetString = 't\x1b\x00\x01\x01\x00\x03\x00\x03\x01\x10\x13\x00\x13\x13' + dnaNetString = b't\x1b\x00\x01\x01\x00\x03\x00\x03\x01\x10\x13\x00\x13\x13' npc = Toon.Toon() npc.setDNAString(dnaNetString) npc.setName(TTLocalizer.WitnessToonName)