coghq: fix some cfo crashes

This commit is contained in:
John Cote 2020-01-09 23:22:11 -05:00
parent 5b4e7b74bd
commit fa710cfd80
3 changed files with 7 additions and 3 deletions

View file

@ -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

View file

@ -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:

View file

@ -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):