From 72c594b36260e57714d06aa460ad793b1c52b793 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Sat, 20 Sep 2003 05:10:55 +0000 Subject: [PATCH] added Entity.initializeEntity() --- direct/src/level/DistributedEntity.py | 3 ++- direct/src/level/DistributedInteractiveEntity.py | 4 ++-- direct/src/level/DistributedInteractiveEntityAI.py | 6 +++--- direct/src/level/Entity.py | 10 +++++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/direct/src/level/DistributedEntity.py b/direct/src/level/DistributedEntity.py index 747548fba4..aa033115f9 100755 --- a/direct/src/level/DistributedEntity.py +++ b/direct/src/level/DistributedEntity.py @@ -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) diff --git a/direct/src/level/DistributedInteractiveEntity.py b/direct/src/level/DistributedInteractiveEntity.py index fe8a762c7d..51054073de 100644 --- a/direct/src/level/DistributedInteractiveEntity.py +++ b/direct/src/level/DistributedInteractiveEntity.py @@ -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()")) diff --git a/direct/src/level/DistributedInteractiveEntityAI.py b/direct/src/level/DistributedInteractiveEntityAI.py index b0c764c799..e19bbe8ec0 100644 --- a/direct/src/level/DistributedInteractiveEntityAI.py +++ b/direct/src/level/DistributedInteractiveEntityAI.py @@ -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()")) diff --git a/direct/src/level/Entity.py b/direct/src/level/Entity.py index e5d8d080e9..749d941626 100755 --- a/direct/src/level/Entity.py +++ b/direct/src/level/Entity.py @@ -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