oldschool-toontown/toontown/building/DistributedBossElevator.py

92 lines
3.6 KiB
Python
Raw Normal View History

from panda3d.core import *
2019-11-02 17:27:54 -05:00
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from .ElevatorConstants import *
from .ElevatorUtils import *
from . import DistributedElevator
from . import DistributedElevatorExt
2019-11-02 17:27:54 -05:00
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM
from direct.fsm import State
from toontown.hood import ZoneUtil
from toontown.toonbase import TTLocalizer
from toontown.toontowngui import TTDialog
class DistributedBossElevator(DistributedElevatorExt.DistributedElevatorExt):
def __init__(self, cr):
DistributedElevatorExt.DistributedElevatorExt.__init__(self, cr)
self.elevatorPoints = BigElevatorPoints
2020-01-14 13:28:52 -06:00
self.openSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_sliding.ogg')
self.finalOpenSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_final.ogg')
self.closeSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_sliding.ogg')
self.finalCloseSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_final.ogg')
2019-11-02 17:27:54 -05:00
self.type = ELEVATOR_VP
self.countdownTime = ElevatorData[self.type]['countdown']
def disable(self):
DistributedElevator.DistributedElevator.disable(self)
def generate(self):
DistributedElevatorExt.DistributedElevatorExt.generate(self)
def delete(self):
self.elevatorModel.removeNode()
del self.elevatorModel
DistributedElevatorExt.DistributedElevatorExt.delete(self)
def setupElevator(self):
self.elevatorModel = loader.loadModel('phase_9/models/cogHQ/cogHQ_elevator')
icon = self.elevatorModel.find('**/big_frame/')
icon.hide()
self.leftDoor = self.elevatorModel.find('**/left-door')
self.rightDoor = self.elevatorModel.find('**/right-door')
geom = base.cr.playGame.hood.loader.geom
locator = geom.find('**/elevator_locator')
self.elevatorModel.reparentTo(locator)
self.elevatorModel.setH(180)
DistributedElevator.DistributedElevator.setupElevator(self)
def getElevatorModel(self):
return self.elevatorModel
def gotBldg(self, buildingList):
return DistributedElevator.DistributedElevator.gotBldg(self, buildingList)
def getZoneId(self):
return 0
def __doorsClosed(self, zoneId):
pass
def setBossOfficeZone(self, zoneId):
if self.localToonOnBoard:
hoodId = self.cr.playGame.hood.hoodId
doneStatus = {'loader': 'cogHQLoader',
'where': 'cogHQBossBattle',
'how': 'movie',
'zoneId': zoneId,
'hoodId': hoodId}
self.cr.playGame.getPlace().elevator.signalDone(doneStatus)
def setBossOfficeZoneForce(self, zoneId):
place = self.cr.playGame.getPlace()
if place:
place.fsm.request('elevator', [self, 1])
hoodId = self.cr.playGame.hood.hoodId
doneStatus = {'loader': 'cogHQLoader',
'where': 'cogHQBossBattle',
'how': 'movie',
'zoneId': zoneId,
'hoodId': hoodId}
if hasattr(place, 'elevator') and place.elevator:
place.elevator.signalDone(doneStatus)
else:
self.notify.warning("setMintInteriorZoneForce: Couldn't find playGame.getPlace().elevator, zoneId: %s" % zoneId)
else:
self.notify.warning("setBossOfficeZoneForce: Couldn't find playGame.getPlace(), zoneId: %s" % zoneId)
def getDestName(self):
return TTLocalizer.ElevatorSellBotBoss