oldschool-toontown/toontown/safezone/DistributedTreasureAI.py

37 lines
1 KiB
Python
Raw Normal View History

2019-11-02 17:27:54 -05:00
from otp.ai.AIBase import *
from direct.distributed.ClockDelta import *
from direct.distributed import DistributedObjectAI
class DistributedTreasureAI(DistributedObjectAI.DistributedObjectAI):
def __init__(self, air, treasurePlanner, x, y, z):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.treasurePlanner = treasurePlanner
self.pos = (x, y, z)
def requestGrab(self):
avId = self.air.getAvatarIdFromSender()
self.treasurePlanner.grabAttempt(avId, self.getDoId())
def validAvatar(self, av):
return 1
def d_setGrab(self, avId):
self.sendUpdate('setGrab', [avId])
def d_setReject(self):
self.sendUpdate('setReject', [])
def getPosition(self):
return self.pos
def setPosition(self, x, y, z):
self.pos = (x, y, z)
def b_setPosition(self, x, y, z):
self.setPosition(x, y, z)
self.d_setPosition(x, y, z)
def d_setPosition(self, x, y, z):
self.sendUpdate('setPosition', [x, y, z])