mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
24 lines
1,001 B
Python
24 lines
1,001 B
Python
from otp.ai.AIBase import *
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
from otp.level import DistributedEntityAI
|
|
import SinkingPlatformGlobals
|
|
|
|
class DistributedSinkingPlatformAI(DistributedEntityAI.DistributedEntityAI):
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSinkingPlatformAI')
|
|
|
|
def __init__(self, levelDoId, entId):
|
|
DistributedEntityAI.DistributedEntityAI.__init__(self, levelDoId, entId)
|
|
self.numStanding = 0
|
|
|
|
def setOnOff(self, on, timestamp):
|
|
avId = self.air.getAvatarIdFromSender()
|
|
self.notify.debug('setOnOff %s' % on)
|
|
if on:
|
|
self.numStanding += 1
|
|
else:
|
|
self.numStanding -= 1
|
|
self.notify.debug('numStanding = %s' % self.numStanding)
|
|
if self.numStanding > 0:
|
|
self.sendUpdate('setSinkMode', [avId, SinkingPlatformGlobals.SINKING, timestamp])
|
|
else:
|
|
self.sendUpdate('setSinkMode', [avId, SinkingPlatformGlobals.RISING, timestamp])
|