coghq: factory almost loads

This commit is contained in:
John Cote 2020-01-08 17:47:17 -05:00
parent 7c58614aa7
commit f73eb9eb84
4 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,5 @@
from direct.showbase.DirectObject import DirectObject from direct.showbase.DirectObject import DirectObject
from direct.showbase.PythonUtil import lineInfo from direct.showbase.PythonUtil import lineInfo
import string
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
class Entity(DirectObject): class Entity(DirectObject):
@ -60,7 +59,7 @@ class Entity(DirectObject):
return self.getZoneEntity().getNodePath() return self.getZoneEntity().getNodePath()
def privGetSetter(self, attrib): def privGetSetter(self, attrib):
setFuncName = 'set%s%s' % (string.upper(attrib[0]), attrib[1:]) setFuncName = 'set%s%s' % (attrib[0].upper(), attrib[1:])
if hasattr(self, setFuncName): if hasattr(self, setFuncName):
return getattr(self, setFuncName) return getattr(self, setFuncName)
return None return None

View file

@ -1,4 +1,3 @@
import string
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from .Entity import Entity from .Entity import Entity
from pandac.PandaModules import Vec3 from pandac.PandaModules import Vec3
@ -22,7 +21,7 @@ class PropSpinner(Entity):
nameParts = name.split('_') nameParts = name.split('_')
axis = nameParts[2] axis = nameParts[2]
rate = 0 rate = 0
neg = string.upper(nameParts[3][0]) == 'N' neg = nameParts[3][0].upper() == 'N'
if neg: if neg:
nameParts[3] = nameParts[3][1:] nameParts[3] = nameParts[3][1:]
try: try:

View file

@ -3,6 +3,7 @@ from toontown.battle import BattlePlace
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.fsm import State from direct.fsm import State
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs
from toontown.toon import Toon from toontown.toon import Toon
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals

View file

@ -4,6 +4,7 @@ from toontown.suit import SuitDNA
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.coghq import LevelBattleManagerAI from toontown.coghq import LevelBattleManagerAI
import random import random
import functools
class LevelSuitPlannerAI(DirectObject.DirectObject): class LevelSuitPlannerAI(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('LevelSuitPlannerAI') notify = DirectNotifyGlobal.directNotify.newCategory('LevelSuitPlannerAI')
@ -39,7 +40,7 @@ class LevelSuitPlannerAI(DirectObject.DirectObject):
for currChance in range(num): for currChance in range(num):
joinChances.append(random.randint(1, 100)) joinChances.append(random.randint(1, 100))
joinChances.sort(cmp) joinChances.sort(key=functools.cmp_to_key(cmp))
return joinChances return joinChances
def __genSuitInfos(self, level, track): def __genSuitInfos(self, level, track):