Poodletooth-iLand/toontown/parties/DistributedPartyFireworksActivityAI.py

39 lines
1.4 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from direct.directnotify import DirectNotifyGlobal
from toontown.parties.DistributedPartyActivityAI import DistributedPartyActivityAI
from direct.distributed.ClockDelta import globalClockDelta
from direct.fsm.FSM import FSM
from toontown.effects import FireworkShows
import PartyGlobals
import random
class DistributedPartyFireworksActivityAI(DistributedPartyActivityAI, FSM):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPartyFireworksActivityAI")
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)
FSM.__init__(self, 'DistributedPartyActivityAI')
self.state = 'Idle'
2015-07-05 18:59:25 -05:00
2015-03-03 16:10:12 -06:00
def getEventId(self):
return PartyGlobals.FireworkShows.Summer
2015-07-05 18:59:25 -05:00
2015-03-03 16:10:12 -06:00
def getShowStyle(self):
return random.randint(0, len(FireworkShows.shows[PartyGlobals.FireworkShows.Summer]) - 1)
2015-07-05 18:59:25 -05:00
2015-03-03 16:10:12 -06:00
def getSongId(self):
return random.randint(0, 1)
def toonJoinRequest(self):
avId = self.air.getAvatarIdFromSender()
host = self.air.doId2do[self.parent].hostId
if avId == host and self.state == 'Idle':
self.request('Active')
return
self.sendUpdateToAvatarId(avId, 'joinRequestDenied', [1])
def enterActive(self):
self.sendUpdate('setState', ['Active', globalClockDelta.getRealNetworkTime()])
2015-07-05 18:59:25 -05:00
2015-03-03 16:10:12 -06:00
def enterIdle(self):
2015-07-05 18:59:25 -05:00
self.sendUpdate('setState', ['Idle', globalClockDelta.getRealNetworkTime()])