oldschool-toontown/toontown/coghq/DistributedElevatorMarker.py

58 lines
1.9 KiB
Python
Raw Normal View History

from panda3d.core import *
2019-11-02 17:27:54 -05:00
from direct.interval.IntervalGlobal import *
from .StomperGlobals import *
2019-11-02 17:27:54 -05:00
from direct.distributed import ClockDelta
from direct.showbase.PythonUtil import lerp
import math
from otp.level import DistributedEntity
from direct.directnotify import DirectNotifyGlobal
from panda3d.core import NodePath
2019-11-02 17:27:54 -05:00
from otp.level import BasicEntities
from direct.task import Task
from toontown.toonbase import ToontownGlobals
class DistributedElevatorMarker(BasicEntities.DistributedNodePathEntity):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedElevatorMarker')
elevatorMarkerModels = ['phase_9/models/cogHQ/square_stomper']
def __init__(self, cr):
BasicEntities.DistributedNodePathEntity.__init__(self, cr)
def generateInit(self):
self.notify.debug('generateInit')
BasicEntities.DistributedNodePathEntity.generateInit(self)
def generate(self):
self.notify.debug('generate')
BasicEntities.DistributedNodePathEntity.generate(self)
def announceGenerate(self):
self.notify.debug('announceGenerate')
BasicEntities.DistributedNodePathEntity.announceGenerate(self)
self.loadModel()
def disable(self):
self.notify.debug('disable')
self.ignoreAll()
DistributedEntity.DistributedEntity.disable(self)
def delete(self):
self.notify.debug('delete')
self.unloadModel()
BasicEntities.DistributedNodePathEntity.delete(self)
def loadModel(self):
self.rotateNode = self.attachNewNode('rotate')
self.model = None
if __dev__:
self.model = loader.loadModel(self.elevatorMarkerModels[self.modelPath])
self.model.reparentTo(self.rotateNode)
return
def unloadModel(self):
if self.model:
self.model.removeNode()
del self.model
self.model = None
return