2015-03-03 16:10:12 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from toontown.parties.DistributedPartyActivityAI import DistributedPartyActivityAI
|
|
|
|
from direct.distributed.ClockDelta import *
|
|
|
|
import PartyGlobals
|
|
|
|
|
|
|
|
class DistributedPartyDanceActivityBaseAI(DistributedPartyActivityAI):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPartyDanceActivityBaseAI")
|
2015-07-05 18:59:25 -05:00
|
|
|
|
2015-03-03 16:10:12 -06:00
|
|
|
def __init__(self, air, parent, activityTuple):
|
|
|
|
DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
|
|
|
|
self.toons = []
|
|
|
|
self.headings = []
|
2015-07-05 18:59:25 -05:00
|
|
|
|
2015-03-03 16:10:12 -06:00
|
|
|
def generate(self):
|
|
|
|
DistributedPartyActivityAI.generate(self)
|
|
|
|
self.sendUpdate('setState', ['Active', globalClockDelta.getRealNetworkTime()])
|
|
|
|
|
|
|
|
def updateDancingToon(self, state, anim):
|
|
|
|
avId = self.air.getAvatarIdFromSender()
|
|
|
|
if not avId in self.toons:
|
|
|
|
self.air.writeServerEvent('suspicious',avId,'Toon tried to update their state while not dancing!')
|
|
|
|
return
|
|
|
|
self.sendUpdate('setDancingToonState', [avId, state, anim])
|
|
|
|
|
2015-07-05 18:59:25 -05:00
|
|
|
|
2015-03-03 16:10:12 -06:00
|
|
|
def toonJoinRequest(self):
|
|
|
|
avId = self.air.getAvatarIdFromSender()
|
|
|
|
if avId in self.toons:
|
|
|
|
self.air.writeServerEvent('suspicious',avId,'Toon tried to enter dance activity twice!')
|
|
|
|
return
|
|
|
|
av = self.air.doId2do.get(avId)
|
|
|
|
if not av:
|
|
|
|
self.air.writeServerEvent('suspicious',avId,'Toon tried to interact with a party activity from a different district!')
|
|
|
|
return
|
|
|
|
self.toons.append(avId)
|
|
|
|
self.headings.append(av.getH())
|
|
|
|
self.sendUpdate('setToonsPlaying', [self.toons, self.headings])
|
2015-07-05 18:59:25 -05:00
|
|
|
|
2015-03-03 16:10:12 -06:00
|
|
|
def toonExitRequest(self):
|
|
|
|
avId = self.air.getAvatarIdFromSender()
|
|
|
|
if not avId in self.toons:
|
|
|
|
self.air.writeServerEvent('suspicious',avId,'Toon tried to exit a dance floor they\'re not on!')
|
|
|
|
return
|
|
|
|
index = self.toons.index(avId)
|
|
|
|
self.toons.remove(avId)
|
|
|
|
self.headings.pop(index)
|
2015-07-05 18:59:25 -05:00
|
|
|
self.sendUpdate('setToonsPlaying', [self.toons, self.headings])
|