mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added Entity.initializeEntity()
This commit is contained in:
parent
3a4ef895ee
commit
72c594b362
@ -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)
|
||||
|
||||
|
@ -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()"))
|
||||
|
@ -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()"))
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user