added Entity.initializeEntity()

This commit is contained in:
Dave Schuyler 2003-09-20 05:10:55 +00:00
parent 3a4ef895ee
commit 72c594b362
4 changed files with 16 additions and 7 deletions

View File

@ -8,6 +8,7 @@ class DistributedEntity(DistributedObject.DistributedObject, Entity.Entity):
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
Entity.Entity.__init__(self)
def generateInit(self):
DistributedEntity.notify.debug('generateInit')
@ -31,7 +32,7 @@ class DistributedEntity(DistributedObject.DistributedObject, Entity.Entity):
# ask our level obj for our spec data
level = toonbase.tcr.doId2do[self.levelDoId]
Entity.Entity.__init__(self, level, self.entId)
self.initializeEntity(level, self.entId)
DistributedObject.DistributedObject.announceGenerate(self)

View File

@ -22,7 +22,7 @@ class DistributedInteractiveEntity(DistributedEntity.DistributedEntity):
DistributedEntity.DistributedEntity.__init__(self, cr)
assert(self.debugPrint("__init()"))
self.fsm = FSM.FSM('Distribu, levelDoId, entIdtedInteractiveEntity',
self.fsm = FSM.FSM('DistributedInteractiveEntity',
[State.State('off',
self.enterOff,
self.exitOff,
@ -46,7 +46,7 @@ class DistributedInteractiveEntity(DistributedEntity.DistributedEntity):
def generate(self):
"""generate(self)
This method is called when the DistributedEntity is reintroduced
This method is called when the DistributedEntity is introduced
to the world, either for the first time or from the cache.
"""
assert(self.debugPrint("generate()"))

View File

@ -72,9 +72,9 @@ class DistributedInteractiveEntityAI(DistributedEntityAI.DistributedEntityAI):
return [self.fsm.getCurrentState().getName(),
globalClockDelta.getRealNetworkTime()]
def getOwnerDoId(self):
assert(self.debugPrint("getOwnerDoId() returning: %s"%(self.ownerDoId,)))
return self.ownerDoId
#def getOwnerDoId(self):
# assert(self.debugPrint("getOwnerDoId() returning: %s"%(self.ownerDoId,)))
# return self.ownerDoId
def requestInteract(self):
assert(self.debugPrint("requestInteract()"))

View File

@ -16,7 +16,15 @@ class Entity:
('comment', str, 0),
)
def __init__(self, level, entId, attribs=None):
def __init__(self, level=None, entId=None, attribs=None):
if level is not None and entId is not None:
self.initializeEntity(level, entId, attribs)
else:
self.level = level
self.entId = entId
self.attribs = Entity.Attribs
def initializeEntity(self, level, entId, attribs=None):
self.level = level
self.entId = entId