Mod API (For other MOD developers) - Electric131/Sandustry-CustomMapLoader GitHub Wiki
This page is up to date as of v3.0.4
Mod API
Note: This page is for people intending to create a mod that uses data from the custom map loader
This mod exposes all of it's information through the globalThis property CML
. Map data can be found under CML.mapData
and contains all information for the currently loaded map.
Note that on the main menu, every map's mapData is exposed through CML.maps
.
Map Data
The CML.mapData
object contains internal data about the currently loaded map.
This data includes the following:
valid
A simple true/false to show if this map had an error or not
error
Only present if valid
is false, and specifies what went wrong when loading the map.
meta
This object contains all of the metadata for the loaded map. This can be edited in realtime through the console to visualize changes.
folder
The full filepath of this map.
folderRelative
The filepath of the map relative to the modloader
hash
A unique hash generated from the contents of a maps files. Any changes to a map will change its hash.
images
An object containing the width and height of the images present in the map. (Although they should all be the same number)
name
The name of the map.. Note this is the name of the folder and can be renamed by the user
rawScale
Simply the ratio of this map's width to the default map.
scale
rawScale
just rounded down to the tenths place. (Mainly if you want to show the user the map scale)
script
An object containing the raw script as well as any extracted exports.
width
The calculated width of the map.
Script API
The details of the CML.scriptAPI
object can be found here.
Internal API
The CML.internals
object contains all kinds of internal information if you really need to get access to exposed data.
I highly recommend avoiding using the internals if you can get the same information through mapData
or the scriptAPI