def handleChildArriveZone(self, child, zoneId):
     DistributedNode.handleChildArrive(self, child, zoneId)
     if (zoneId >= self.startingZone):
         if not child.gridParent:
             child.gridParent = GridParent(child)
         child.gridParent.setGridParent(self, zoneId)
     elif child.gridParent:
         child.gridParent.delete()
         child.gridParent = None
    def parentObjectToCell(self, object, zoneId=None):
        if zoneId is None:
            zoneId = self.parent.getZoneFromXYZ(object.getPos())

        cell = GridParent.getCellOrigin(self, zoneId)
        originalPos = object.getPos()

        object.reparentTo(cell)
        object.setPos(self.parent, originalPos)

        self.broadcastObjectPosition(object)
 def setGridCell(self, grid, zoneId):
     if not hasattr(self, 'getParent'):
         return
     if grid is None:
         self.__setGridParent(None)
         self.__clearGridInterest()
     else:
         if not self._gridParent:
             self.__setGridParent(GridParent(self))
         self._gridParent.setGridCell(grid, zoneId)
         self.updateGridInterest(grid, zoneId)
     return
Example #4
0
    def setGridCell(self, grid, zoneId):
        if not hasattr(self, 'getParent'):
            return
        if grid is None:
            self.__setGridParent(None)
            self.__clearGridInterest()
        else:
            if not self._gridParent:
                self.__setGridParent(GridParent(self))

            # Does the (wrt)ReparentTo() operation
            self._gridParent.setGridCell(grid, zoneId)

            # Moves the grid interest along with this child
            self.updateGridInterest(grid, zoneId)