MrxGuiBootstrap
Module: mrxguibootstrap.lua
Overview
The MrxGuiBootstrap module is responsible for initializing and managing the Scaleform GUI/HUD system in the game. It handles loading GUI files, creating and deleting player HUDs, toggling the visibility of the HUD, and setting up callbacks for GUI events.
Inheritance
- Inherits from:
none β base/utility module - Imports:
MrxGuiBase,MrxGui,MrxGuiManager,MrxUtil,MrxGuiShellBootstrap,MrxGuiInterface
Instance pattern
This is a stateless manager/utility module. It does not track any per-instance state.
Functions
Init()
Called during the initialization phase of the game. Loads the pause screen GUI file and sets up a callback for when the pause screen is loaded. Also, sets an exit multiplayer callback function.
Deinit()
Not implemented or used in this module.
_PauseScreenLoaded(PauseScreenModule)
A private function called when the pause screen GUI file is successfully loaded. It closes the pause screen and stores the pause screen module for later use. Note: it assigns oPauseModule = PauseScreenModule without a local, so this leaks into the global namespace rather than a module-local field β likely intentional (module-level βconstantβ idiom used elsewhere in this codebase) but worth flagging since itβs easy to shadow accidentally.
ToggleHud(uGuid, bVisible, sContext)
Toggles the visibility of the HUD for a given player GUID (uGuid). The bVisible parameter determines whether to show or hide the HUD, and sContext provides additional context for the operation.
CreatePlayerHud(uPlayerGuid)
Creates a new GUI for the specified player GUID (uPlayerGuid) using the MrxGuiManager.
DeleteHud(uPlayerGuid)
Deletes the GUI associated with the specified player GUID (uPlayerGuid) using the MrxGuiManager.
DeleteAllHuds()
Intended to delete all created GUIs via MrxGuiManager.
Real bug: the body calls
MrxGuiManager.DeleteAddGuis(), but no such function exists βmrxguimanager.luadefinesDeleteAllGuis(all-G-u-i-s), notDeleteAddGuis. CallingDeleteAllHuds()will therefore error withattempt to call field 'DeleteAddGuis' (a nil value). If you need to tear down every player HUD, callMrxGuiManager.DeleteAllGuis()directly instead.
GetNumberOfPlayersFromShellSelection()
Returns the number of players selected in the shell (likely referring to the multiplayer selection screen).
SetSatelliteOverlay(uPlayer, bOn, sFaction)
Toggles the satellite overlay for a given player (uPlayer). The bOn parameter determines whether to enable or disable the overlay, and sFaction specifies the faction associated with the overlay.
SetOnGuiLoadedFunc(fFunc, tArgs)
Sets a callback function (fFunc) that will be called when the GUI is fully loaded. The tArgs table contains any arguments that need to be passed to the callback function.
Events
This file contains no Event.Create calls and no Event.* constants at all β everything here is plain function-callback wiring, not the engine event system:
Init()passes_PauseScreenLoadedas a load-completion callback toMrxGuiBase.LoadGUIFile(...)β invoked directly by that function when the GUI file finishes loading, not throughEvent.Create.Init()also passesExitMultiplayer(defined inmrxguishellbootstrap.lua, not in this file) toMrxGuiShellBootstrap.SetExitMultiplayerCallback(ExitMultiplayer, {})β again a stored callback reference invoked directly by that module, confirmed viamrxguishellbootstrap.luaβs ownExitMultiplayer/SetExitMultiplayerCallbackfunctions.
Notes for modders
- This module is a thin forwarding facade over
MrxGuiManager. Every function here (ToggleHud,CreatePlayerHud,DeleteHud,SetSatelliteOverlay,SetOnGuiLoadedFunc) just calls the matchingMrxGuiManagerfunction β the real HUD lifecycle logic lives there, so read that page for behavior. - Only concrete asset loaded here:
"MrxGuiPauseLayout"(the pause screen), loaded inInit()viaMrxGuiBase.LoadGUIFile. Its_PauseScreenLoadedcallback immediately closes the pause screen (viaMrxGuiPauseScreen.ClosePauseScreen) and stashes the module in the globaloPauseModule. SetOnGuiLoadedFunc(fFunc, tArgs)βMrxGuiManager.SetLoadingCompleteCallbackis the hook to run your own code once the player HUD finishes loading β fired immediately if a GUI already exists, else deferred.- Avoid
DeleteAllHuds()β itβs broken (see the warning above); callMrxGuiManager.DeleteAllGuis()instead.