Parcourir la source

fixed distributed entity create-announce bug

Darren Ranalli il y a 22 ans
Parent
commit
538f856f6f

+ 2 - 0
direct/src/level/DistributedEntity.py

@@ -33,6 +33,8 @@ class DistributedEntity(DistributedObject.DistributedObject, Entity.Entity):
         # ask our level obj for our spec data
         level = toonbase.tcr.doId2do[self.levelDoId]
         self.initializeEntity(level, self.entId)
+        # announce our presence (Level does this for non-distributed entities)
+        self.level.onEntityCreate(self.entId)
 
         DistributedObject.DistributedObject.announceGenerate(self)
 

+ 4 - 2
direct/src/level/DistributedLevel.py

@@ -192,14 +192,16 @@ class DistributedLevel(DistributedObject.DistributedObject,
 
     def requestReparent(self, entity, parentId):
         assert(entity.entId != parentId)
-        if self.entities.has_key(parentId):
+        parent = self.getEntity(parentId)
+        if parent is not None:
             # parent has already been created
-            entity.reparentTo(self.entities[parentId].getNodePath())
+            entity.reparentTo(parent.getNodePath())
         else:
             # parent hasn't been created yet; schedule the reparent
             self.notify.debug(
                 'entity %s requesting reparent to %s, not yet created' %
                 (entity, parentId))
+            print self.entities
 
             entId = entity.entId
             entity.reparentTo(hidden)