Poodletooth-iLand/toontown/cogdominium/CogdoLevelGameBase.py

39 lines
1.3 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from direct.fsm.StatePush import FunctionCall
from otp.level.EntityStateVarSet import EntityStateVarSet
from otp.level.LevelSpec import LevelSpec
class CogdoLevelGameBase:
def getLevelSpec(self):
return LevelSpec(self.getSpec())
if __dev__:
def startHandleEdits(self):
fcs = []
Consts = self.getConsts()
for item in Consts.__dict__.itervalues():
if isinstance(item, EntityStateVarSet):
for attribName in item._getAttributeNames():
handler = getattr(self, '_handle%sChanged' % attribName, None)
if handler:
stateVar = getattr(item, attribName)
fcs.append(FunctionCall(handler, stateVar))
self._functionCalls = fcs
return
def stopHandleEdits(self):
if __dev__:
for fc in self._functionCalls:
fc.destroy()
self._functionCalls = None
return
def getEntityTypeReg(self):
import CogdoEntityTypes
from otp.level import EntityTypeRegistry
typeReg = EntityTypeRegistry.EntityTypeRegistry(CogdoEntityTypes)
return typeReg