def _handleZoneChange(self, newZoneId, oldZoneId): PetLookerAI.notify.debug('_handleZoneChange: %s' % self.doId) if not self.__active: PetLookerAI.notify.warning('%s: _handleZoneChange: not active!' % self.doId) return oldZoneData = AIZoneData(self.air, self.parentId, oldZoneId) if oldZoneData.hasCollTrav(): oldZoneData.getCollTrav().removeCollider(self.lookSphereNodePath) oldZoneData.destroy() newZoneData = AIZoneData(self.air, self.parentId, newZoneId) if newZoneData.hasCollTrav(): newZoneData.getCollTrav().addCollider(self.lookSphereNodePath, self._cHandler) newZoneData.destroy()
def getZoneData(self): # Call this to get an AIZoneData object for the current zone. # This class will hold onto it as self._zoneData # setLocation destroys self._zoneData if we move away to # a different zone if self._zoneData is None: self._zoneData = AIZoneData(self.air, self.parentId, self.zoneId) return self._zoneData
def getNonCollidableParent(self, parentId, zoneId): # distributed objects should call getNonCollidableParent on themselves rather than # call this function. Only call this for zones that are actively being # used, otherwise the zone data will be destroyed before this function # returns zd = AIZoneData(self, parentId, zoneId) ncParent = zd.getNonCollidableParent() zd.destroy() return ncParent
def getParentMgr(self, parentId, zoneId): # see comment in getRender zd = AIZoneData(self, parentId, zoneId) parentMgr = zd.getParentMgr() zd.destroy() return parentMgr
def getCollTrav(self, parentId, zoneId, *args, **kArgs): # see comment in getRender zd = AIZoneData(self, parentId, zoneId) collTrav = zd.getCollTrav(*args, **kArgs) zd.destroy() return collTrav