MrxBootstrap
Module: mrxbootstrap.lua
Overview
The MrxBootstrap module is responsible for initializing the game world by handling GUI loading and local player joining events. It sets up the initial atmosphere settings, manages faction setup, and optionally grants starting resources to the player if a cheat is enabled.
Inheritance
- Inherits from:
none โ base/utility module - Imports:
MrxSoundBootstrap,MrxFactionManager,MrxGuiBootstrap,MrxLayerManager,MrxSupportData,MrxPlayer,MrxPmc,MrxState,MrxUtil
Instance pattern
This is a stateless manager/utility module. It does not track per-instance state but manages global initialization tasks.
Functions
Start(fCallback, tArgs)
Wires GUI-loaded and local-player-joined callbacks, calls MrxPlayer.Start(). Sets up the initial state for bootstrapping the game world.
IsGuiLoaded()
Returns whether the GUI has been loaded.
_GuiLoaded()
Called when the first GUI load event is received. Logs a debug message and sets _bGuiLoaded to true. If _bHandleStateTransitions is enabled, it enters the STATE_WAITFORGAME state and calls _End.
_LocalPlayerJoined()
Called when the local player joins the game session. Logs a debug message and sets _bLocalPlayerJoined to true. Calls _End to complete initialization.
_End()
The real completion step, but it early-returns unless both _bLocalPlayerJoined and _bGuiLoaded are true โ so whichever of _GuiLoaded/_LocalPlayerJoined fires second is the one that actually runs the body. It exits STATE_WAITFORGAME (only if _bHandleStateTransitions), calls MrxFactionManager.Setup(), and applies SetDefaultAtmosphere() for non-VZ levels (skipped when the lowercased level name is "vz"). If Sys.StartWithResources() is true it maxes the player out: MrxPmc.AddCashQty(10000000) (10M cash), fuel capacity/qty 9999, fills every support type in MrxSupportData.tSupportData to its nMaxStock, and calls MrxSupportData.SetIgnoreRequirements(true). Finally it fires the stored done-callback via MrxUtil.CallWithOptionalArgs.
SetDefaultAtmosphere()
Sets the default atmosphere/bloom/monochrome/contrast settings for non-VZ levels. This function configures various graphics parameters to create a consistent visual environment.
SetHeroSpawnLocation(sHeroSpawnLocation)
Sets the hero spawn location, which is not used in this module but can be referenced elsewhere.
SetHandleStateTransitions(bEnable)
Enables or disables state transition handling during bootstrapping. This allows for more control over the initialization process.
Events
This file has zero Event.* references โ no Event.Create, no engine event constants. Both โtriggersโ below are plain stored-callback wiring through other modulesโ setter functions, invoked by direct function call when those modules decide the condition is met:
StartcallsMrxGuiBootstrap.SetOnGuiLoadedFunc(_GuiLoaded), registering_GuiLoadedas the callbackMrxGuiBootstrapinvokes once the GUI finishes loading.StartcallsMrxPlayer.SetLocalPlayerJoinedCallback(_LocalPlayerJoined), registering_LocalPlayerJoinedas the callbackMrxPlayerinvokes once the local player joins.
Notes for modders
SetDefaultAtmosphere()is a big block of concrete graphics tunables for the non-VZ look โ sky"afternoon", time-of-day0.3with speed0(frozen), bloom (SetBlurRadius 0.5,SetThreshold 0.775,SetMultiplier 0), contrast (SetLimit 0.1,SetMultiplier 1.5), plus full ambient-cube and monochrome-gradient calls, all wrapped inGraphics.Atmosphere.Begin()/.End(8). Edit these numbers to reskin the default world lighting. VZ levels skip this entirely.StartWithResourcesis the โstart richโ cheat: 10M cash,9999fuel (capacity + qty), every support type filled tonMaxStock, and support requirements ignored. Gated onSys.StartWithResources().SetHeroSpawnLocationonly stashes the value in_sHeroSpawnLocation; nothing in this file reads it back, so setting it here alone does nothing unless another module consumes it._Endruns its body only once both the GUI-loaded and local-player-joined flags are set โ donโt expect faction/atmosphere setup to happen off just one of them.