oldschool-toontown/toontown/coghq/DistributedStomperPair.py

45 lines
1.5 KiB
Python
Raw Normal View History

from panda3d.core import *
2019-11-02 17:27:54 -05:00
from direct.interval.IntervalGlobal import *
import math
from . import StomperGlobals
2019-11-02 17:27:54 -05:00
from direct.directnotify import DirectNotifyGlobal
from otp.level import BasicEntities
class DistributedStomperPair(BasicEntities.DistributedNodePathEntity):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedStomperPair')
def __init__(self, cr):
BasicEntities.DistributedNodePathEntity.__init__(self, cr)
self.children = None
return
def delete(self):
BasicEntities.DistributedNodePathEntity.delete(self)
self.ignoreAll()
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.listenForChildren()
def listenForChildren(self):
if self.stomperIds:
for entId in self.stomperIds:
self.accept(self.getUniqueName('crushMsg', entId), self.checkSquashedToon)
def checkSquashedToon(self):
tPos = base.localAvatar.getPos(self)
print('tpos = %s' % tPos)
2019-11-02 17:27:54 -05:00
yRange = 3.0
xRange = 3.0
if tPos[1] < yRange and tPos[1] > -yRange and tPos[0] < xRange and tPos[0] > -xRange:
self.level.b_setOuch(3)