mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-26 21:22:27 -06:00
28 lines
No EOL
930 B
Python
Executable file
28 lines
No EOL
930 B
Python
Executable file
import Entity, BasicEntities
|
|
from pandac.PandaModules import NodePath
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
class LocatorEntity(Entity.Entity, NodePath):
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('LocatorEntity')
|
|
|
|
def __init__(self, level, entId):
|
|
node = hidden.attachNewNode('LocatorEntity-%s' % entId)
|
|
NodePath.__init__(self, node)
|
|
Entity.Entity.__init__(self, level, entId)
|
|
self.doReparent()
|
|
|
|
def destroy(self):
|
|
Entity.Entity.destroy(self)
|
|
self.removeNode()
|
|
|
|
def getNodePath(self):
|
|
return self
|
|
|
|
def doReparent(self):
|
|
if self.searchPath != '':
|
|
parent = self.level.geom.find(self.searchPath)
|
|
if parent.isEmpty():
|
|
LocatorEntity.notify.warning("could not find '%s'" % self.searchPath)
|
|
self.reparentTo(hidden)
|
|
else:
|
|
self.reparentTo(parent) |