oldschool-toontown/toontown/coghq/CashbotCogHQLoader.py

81 lines
3.3 KiB
Python
Raw Normal View History

2019-11-02 17:27:54 -05:00
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
from . import CogHQLoader, MintInterior
2019-11-02 17:27:54 -05:00
from toontown.toonbase import ToontownGlobals
from direct.gui import DirectGui
from toontown.toonbase import TTLocalizer
from toontown.toon import Toon
from direct.fsm import State
from . import CashbotHQExterior
from . import CashbotHQBossBattle
2019-11-02 17:27:54 -05:00
from pandac.PandaModules import DecalEffect
class CashbotCogHQLoader(CogHQLoader.CogHQLoader):
notify = DirectNotifyGlobal.directNotify.newCategory('CashbotCogHQLoader')
def __init__(self, hood, parentFSMState, doneEvent):
CogHQLoader.CogHQLoader.__init__(self, hood, parentFSMState, doneEvent)
self.fsm.addState(State.State('mintInterior', self.enterMintInterior, self.exitMintInterior, ['quietZone', 'cogHQExterior']))
for stateName in ['start', 'cogHQExterior', 'quietZone']:
state = self.fsm.getStateNamed(stateName)
state.addTransition('mintInterior')
2020-01-14 13:28:52 -06:00
self.musicFile = 'phase_9/audio/bgm/encntr_suit_HQ_nbrhood.ogg'
2019-11-02 17:27:54 -05:00
self.cogHQExteriorModelPath = 'phase_10/models/cogHQ/CashBotShippingStation'
self.cogHQLobbyModelPath = 'phase_10/models/cogHQ/VaultLobby'
self.geom = None
return
def load(self, zoneId):
CogHQLoader.CogHQLoader.load(self, zoneId)
Toon.loadCashbotHQAnims()
def unloadPlaceGeom(self):
if self.geom:
self.geom.removeNode()
self.geom = None
CogHQLoader.CogHQLoader.unloadPlaceGeom(self)
return
def loadPlaceGeom(self, zoneId):
self.notify.info('loadPlaceGeom: %s' % zoneId)
zoneId = zoneId - zoneId % 100
if zoneId == ToontownGlobals.CashbotHQ:
self.geom = loader.loadModel(self.cogHQExteriorModelPath)
ddLinkTunnel = self.geom.find('**/LinkTunnel1')
ddLinkTunnel.setName('linktunnel_dl_9252_DNARoot')
locator = self.geom.find('**/sign_origin')
backgroundGeom = self.geom.find('**/EntranceFrameFront')
backgroundGeom.node().setEffect(DecalEffect.make())
signText = DirectGui.OnscreenText(text=TTLocalizer.DonaldsDreamland[-1], font=ToontownGlobals.getSuitFont(), scale=3, fg=(0.87, 0.87, 0.87, 1), mayChange=False, parent=backgroundGeom)
signText.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
signText.setDepthWrite(0)
elif zoneId == ToontownGlobals.CashbotLobby:
if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: COGHQ: Visit CashbotLobby')
self.geom = loader.loadModel(self.cogHQLobbyModelPath)
else:
self.notify.warning('loadPlaceGeom: unclassified zone %s' % zoneId)
CogHQLoader.CogHQLoader.loadPlaceGeom(self, zoneId)
def unload(self):
CogHQLoader.CogHQLoader.unload(self)
Toon.unloadCashbotHQAnims()
def enterMintInterior(self, requestStatus):
self.placeClass = MintInterior.MintInterior
self.mintId = requestStatus['mintId']
self.enterPlace(requestStatus)
def exitMintInterior(self):
self.exitPlace()
self.placeClass = None
del self.mintId
return
def getExteriorPlaceClass(self):
return CashbotHQExterior.CashbotHQExterior
def getBossPlaceClass(self):
return CashbotHQBossBattle.CashbotHQBossBattle