mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-31 00:37:54 +00:00
39 lines
1,001 B
Python
Executable file
39 lines
1,001 B
Python
Executable file
from pandac.PandaModules import *
|
|
from toontown.toonbase import ToontownGlobals
|
|
from direct.task import Task
|
|
|
|
def acquirePetManager():
|
|
if not hasattr(base, 'petManager'):
|
|
PetManager()
|
|
base.petManager.incRefCount()
|
|
|
|
|
|
def releasePetManager():
|
|
base.petManager.decRefCount()
|
|
|
|
|
|
class PetManager:
|
|
CollTaskName = 'petFloorCollisions'
|
|
|
|
def __init__(self):
|
|
base.petManager = self
|
|
self.refCount = 0
|
|
self.cTrav = CollisionTraverser('petFloorCollisions')
|
|
taskMgr.add(self._doCollisions, PetManager.CollTaskName, priority=ToontownGlobals.PetFloorCollPriority)
|
|
|
|
def _destroy(self):
|
|
taskMgr.remove(PetManager.CollTaskName)
|
|
del self.cTrav
|
|
|
|
def _doCollisions(self, task):
|
|
self.cTrav.traverse(render)
|
|
return Task.cont
|
|
|
|
def incRefCount(self):
|
|
self.refCount += 1
|
|
|
|
def decRefCount(self):
|
|
self.refCount -= 1
|
|
if self.refCount == 0:
|
|
self._destroy()
|
|
del base.petManager
|