Map Meta - Electric131/Sandustry-CustomMapLoader GitHub Wiki
This page is up to date as of v3.1.0
Map Meta
Each map can have an optional meta.json
file that contains important metadata for the map. This file tells the map loader what properties you want to edit for your map such as where the player spawns or what colors each element is.
Every map has a default meta file and specifying your own will simply override the corresponding defaults if specified. E.x. if the default values are: Note these are not the actual defaults, only an example of how overriding works
{
"spawn": {
"x": 10,
"y": 10
}
}
And if the meta.json
file was:
{
"spawn": {
"x": 100
}
}
Then the resulting metadata would be:
{
"spawn": {
"x": 100,
"y": 10
}
}
Default Meta
The current default meta for custom maps is:
{
"spawn": {
"x": 363,
"y": 200
},
"unstuck": {
"x": 161,
"y": 616
},
"introSequence": {
"1726": "boostup",
"5000": "endboost",
"5146": "end"
},
"parallaxOffset": 0,
"yLimit": {
"hard": 550,
"soft": 600
},
"fog": {
"startY": 2400,
"endY": 4200,
"max": 1200,
"min": 200
}
}
Note the colors property has been removed, as it is too long to fit here. Check the map colors page for the list of the default colors
Useful Tip: The metadata can be modified in realtime while loaded in a save! Simply look in the globalThis.CML.mapData.meta
through the console in game.
Properties
maploaderVersion
The maploaderVersion
override is a special one that allows you to specify which version on the maploader your map is made for / relies on.
The property should be the version tag minus the v
at the start. (e.g. "v3.1.0" -> "3.1.0")
The maploader will not allow this map to be loaded if:
- the
Major
version is changed (ie. incompatable changes are made) - the target
Minor
orPatch
version is higher than the currently active maploader version.
Note this property is technically a default meta value, but the default is whatever version is run
Example:
"maploaderVersion": "v3.1.0"
spawn
The spawn override has two properties, x and y. This modifies where the player is spawned at the beginning of the intro sequence.
Example:
"spawn": {
"x": 488,
"y": 300
}
unstuck
The unstuck override has two properties, x and y. This modifies where the player is teleported when clicking the unstuck button.
Example:
"unstuck": {
"x": 488,
"y": 615
}
introSequence
The introSequence override allows you to change the landing sequence when starting a new save. The sequence is a dictionary (key-value pair) where the keys are the time, in milliseconds, of the event and the value is the event/action itself.
The introSequence has a max time of 8 seconds, after which the sequence will automatically be ended.
Requires entire table to be specified and will not use the defaults if property is present.
The valid actions include the following:
- boostup : Sets the players boost to go up
- boostslow : Sets the players boost to slowly descend
- endboost : Disables the players boost
- end : Ends the intro sequence and proceeds to the tutorial
Example:
"introSequence": {
"1500": "boostup",
"3800": "endboost",
"4000": "end"
}
parallaxOffset
The parallaxOffset overrides allows you to shift the parallax background vertically. You may have to play around with this number and see it's effects in game. (Check out how to modify metadata at runtime at the bottom of default metadata)
The offset is a positive number to shift up, and a negative number to shift down.
Example:
"parallaxOffset": 100
yLimit
The yLimit override allows you to change the max y level the player can go to. This effect may look weird since the map wraps vertically, so I advise against changing it.
This offset has two properties, hard and soft. The hard limit fully restricts the players movement by teleporting them back if they go above it. The soft limit pushes the player back down if they pass it as well as preventing them from using their jetpack.
These values are in player units, which are more precise than pixels. Check out how to find player y.
Example:
"yLimit": {
"hard": 550,
"soft": 600,
}
fog
The fog override allows you to change the fog effect when the player is underground. This override has 4 parameters: startY, endY, max, and min. The startY determines where the linear transition will start, and the endY determines where the transition will end. (Check out how to find player y)
The max and min values determine the max and min light size. (The default is max of 700 and min of 200)
If the player is above the startY, their light will be at max. If the player is below the endY, their light will be at min. If the player is inbetween these values, the light size will linearly transition between the max and min as the player goes deeper.
Example:
"fog": {
"startY": 2400,
"endY": 4200,
"max": 1200,
"min": 200,
}