2019-11-02 17:27:54 -05:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from toontown.battle import BattlePlace
|
|
|
|
from direct.fsm import ClassicFSM, State
|
|
|
|
from direct.fsm import State
|
|
|
|
from toontown.toonbase import ToontownGlobals
|
|
|
|
from toontown.building import Elevator
|
2022-12-16 18:40:57 -06:00
|
|
|
from panda3d.core import *
|
2019-11-02 17:27:54 -05:00
|
|
|
from toontown.coghq import CogHQExterior
|
|
|
|
|
|
|
|
class BossbotHQExterior(CogHQExterior.CogHQExterior):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('BossbotHQExterior')
|
|
|
|
|
|
|
|
def __init__(self, loader, parentFSM, doneEvent):
|
|
|
|
CogHQExterior.CogHQExterior.__init__(self, loader, parentFSM, doneEvent)
|
|
|
|
self.elevatorDoneEvent = 'elevatorDone'
|
|
|
|
self.trains = None
|
|
|
|
self.fsm.addState(State.State('elevator', self.enterElevator, self.exitElevator, ['walk', 'stopped']))
|
|
|
|
state = self.fsm.getStateNamed('walk')
|
|
|
|
state.addTransition('elevator')
|
|
|
|
state = self.fsm.getStateNamed('stopped')
|
|
|
|
state.addTransition('elevator')
|
|
|
|
state = self.fsm.getStateNamed('stickerBook')
|
|
|
|
state.addTransition('elevator')
|
|
|
|
return
|
|
|
|
|
|
|
|
def enterElevator(self, distElevator, skipDFABoard = 0):
|
|
|
|
self.accept(self.elevatorDoneEvent, self.handleElevatorDone)
|
|
|
|
self.elevator = Elevator.Elevator(self.fsm.getStateNamed('elevator'), self.elevatorDoneEvent, distElevator)
|
|
|
|
if skipDFABoard:
|
|
|
|
self.elevator.skipDFABoard = 1
|
|
|
|
self.elevator.setReverseBoardingCamera(True)
|
|
|
|
self.elevator.load()
|
|
|
|
self.elevator.enter()
|
|
|
|
|
|
|
|
def exitElevator(self):
|
|
|
|
self.ignore(self.elevatorDoneEvent)
|
|
|
|
self.elevator.unload()
|
|
|
|
self.elevator.exit()
|
|
|
|
del self.elevator
|
|
|
|
|
|
|
|
def detectedElevatorCollision(self, distElevator):
|
|
|
|
self.fsm.request('elevator', [distElevator])
|
|
|
|
|
|
|
|
def handleElevatorDone(self, doneStatus):
|
|
|
|
self.notify.debug('handling elevator done event')
|
|
|
|
where = doneStatus['where']
|
|
|
|
if where == 'reject':
|
|
|
|
if hasattr(base.localAvatar, 'elevatorNotifier') and base.localAvatar.elevatorNotifier.isNotifierOpen():
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.fsm.request('walk')
|
|
|
|
elif where == 'exit':
|
|
|
|
self.fsm.request('walk')
|
|
|
|
elif where == 'countryClubInterior':
|
|
|
|
self.doneStatus = doneStatus
|
|
|
|
messenger.send(self.doneEvent)
|
|
|
|
else:
|
|
|
|
self.notify.error('Unknown mode: ' + where + ' in handleElevatorDone')
|