Mod - MSUTeam/MSU GitHub Wiki
The mod object is the primary way for a mod to interact with MSU systems. It holds information about your mod, such as an ID and the current version. It provides access to the various systems via 'addons', which are convenience functions that allow you to execute many common actions while passing the ID of your mod.
Each Battle Brothers mod using MSU should have a mod object.
We recommend storing a mod object in something like::YourNamespace.Mod
,
for example MSU stores its mod object in ::MSU.Mod
.
A mod object can also be retrieved via ::MSU.getMod(_modID)
.
When referencing a mod object in this wiki, we will be using <Mod>
as an alias.
::YourNamespace.Mod <- ::MSU.Class.Mod( _id, _version, _name = null);
// _id, _version and _name are strings
// _name defaults to _id
_version
is a Semantic Version, eg 1.0.0
.
MSU will handle any semantic version according to specification.
_id
must be the same ID used to register the mod with mod_hooks using
::mods_registerMod
.
_name
is how the mod will be identified to users within MSU systems
like ModSettings.
If it is left empty, it will be set to _id
.
All the systems can be accessed via the mod object using the following syntax:
-
Debug -
<Mod>.Debug
-
Keybinds -
<Mod>.Keybinds
-
Mod Settings -
<Mod>.ModSettings
-
Serialization -
<Mod>.Serialization
-
Persistent Data -
<Mod>.PersistentData