LevelBootstrap
Module: levelbootstrap.lua
Overview
The LevelBootstrap module is responsible for loading a game level and its associated master script. It sets the current level name and master script, requests the necessary assets, and transitions the game state to βLoadingβ.
Inheritance
- Inherits from:
none β base/utility module - Imports:
none
Instance pattern
This is a stateless manager/utility module. It does not track any per-instance state.
Functions
LoadLevel(LevelName, MasterScript, Reload)
Loads the specified level and master script. If LevelName is nil, defaults to Sys.GetLevelName(); if MasterScript is nil, defaults to Sys.GetMasterScriptName(). Calls Sys.SetLevelName(LevelName) and Sys.SetMasterScriptName(MasterScript), logs a debug message ("Loading " .. LevelName .. " level with " .. MasterScript .. " masterscript"), defaults Reload to false if not provided (the parameter itself is otherwise unused in this function body), requests LevelName .. "_base" as a "layer" asset at priority -2 and MasterScript as a "script" asset at priority -3 (both via Sys.RequiredAsset, non-blocking per the trailing false argument), and finally calls Sys.RequestGameState("Loading").
Events
- Listens for none (this module does not subscribe to any engine events).
Notes for modders
- This is the one-call level loader:
LevelBootstrap.LoadLevel(sLevel, sScript)sets the level/master script names, requests the assets, and flips the game state to"Loading".GameBootstrap.Startcalls it directly on theSys.AutoLoad()(non-server) path. - The asset request shape is fixed: it requests
<LevelName>_baseas a"layer"at priority-2and<MasterScript>as a"script"at priority-3, both non-blocking (trailingfalse). If youβre adding a new level, those two names (_baselayer + master script) are what the engine will go looking for. Reloadis dead β the third parameter is defaulted tofalseand then never read again in the function body. Passing it has no effect.- Pass
nilforLevelName/MasterScriptto fall back toSys.GetLevelName()/Sys.GetMasterScriptName().