A patch with "Action": "EditMap"
changes part of a map loaded by the game. Any number of
content packs can edit the same asset. You can extend a map downwards or rightward by just patching
past the edge (Content Patcher will expand the map to fit).
A map asset describes the layout of the in-game terrain (like water, cliffs, and land), terrain features (like bushes), buildings, paths, and triggers for a particular area. When you reach the edge of an area or enter a building, and the screen fades to black during the transition, you're moving between maps.
See Modding:Maps on the wiki for more information, from the basic concepts to more advanced map features.
Each EditMap
patch can make three types of change to a map: overlay a map, change map properties,
or change map tiles.
These are documented in separate sections below since they're distinct, but you can combine them
in the same patch. In that case the fields are applied in this order: FromFile
, MapTiles
,
MapProperties
, AddWarps
, and TextOperations
.
An EditMap
patch consists of a model under Changes
(see examples below). These fields are
always used regardless of the edit type:
- Required fields:
-
field purpose Action
The kind of change to make. Set to EditMap
for this action type.Target
The game asset name to replace (or multiple comma-delimited asset names), like Maps/Town
. This field supports tokens, and capitalisation doesn't matter. - Optional fields:
-
field purpose When
(optional) Only apply the patch if the given conditions match. LogName
(optional) A name for this patch to show in log messages. This can be useful for understanding errors. If omitted, it defaults to a name like EditMap Maps/Town
.Update
(optional) How often the patch fields should be updated for token changes. See update rate for more info. - Advanced fields:
-
field purpose Priority
(optional) When multiple patches or mods edit the same asset, the order in which they should be applied. The possible values are
Early
,Default
, andLate
. The default value isDefault
.The patches for an asset (across all mods) are applied in this order:
- by earliest to latest priority;
- then by mod load order (e.g. based on dependencies);
- then by the order the patches are listed in your
content.json
.
If you need a more specific order, you can use a simple offset like
"Default + 2"
or"Late - 10"
. The default levels are -1000 (early), 0 (default), and 1000 (late).This field does not support tokens, and capitalization doesn't matter.
Tip
Priorities can make your changes harder to follow and troubleshoot. Suggested best practices:
- Consider only using very general priorities when possible (like
Late
for a cosmetic overlay meant to be applied over base edits from all mods). - There's no need to set priorities relative to your own patches, since you can just list them in the order they should be applied.
TargetLocale
(optional) The locale code to match in the asset name. For example, setting
"TargetLocale": "fr-FR"
will only edit the French localized form of the asset (e.g.Maps/Town.fr-FR
). This can be an empty string to only edit the base unlocalized asset.If omitted, it's applied to all localized and unlocalized variants of the asset.
You can then add the fields from one or more sections below.
A 'map overlay' copies tiles, properties, and tilesheets from a source map into the target. Matching layers in the target area will be fully overwritten with the source area.
The patch fields for this operation are:
field | purpose |
---|---|
See common fields above. |
|
|
The relative path to the map in your content pack folder from which to copy (like Content Patcher will handle tilesheets referenced by the
|
|
(Optional) The part of the source map to copy. Defaults to the whole source map. This is specified as an object with the X and Y tile coordinates of the top-left corner, and the tile width and height of the area. Its fields may contain tokens. |
|
(Optional) The part of the target map to replace. Defaults to the same size as This is specified as an object with the X and Y tile coordinates of the top-left corner, and the tile width and height of the area. Its fields may contain tokens. If you specify an area past the bottom or right edges of the map, the map will be resized automatically to fit. |
|
(Optional) How to merge tiles into the target map. The default is For example, assume a mostly empty source map with two layers: Here's how that would be merged with each patch mode (black areas are the empty void under the map): |
For example, this replaces the town square with the one in another map:
{
"Format": "2.0.0",
"Changes": [
{
"Action": "EditMap",
"Target": "Maps/Town",
"FromFile": "assets/town.tmx",
"FromArea": { "X": 22, "Y": 61, "Width": 16, "Height": 13 },
"ToArea": { "X": 22, "Y": 61, "Width": 16, "Height": 13 }
},
]
}
The MapProperties
field lets you add, replace, or remove map-level properties.
field | purpose |
---|---|
See common fields above. |
|
|
The map properties (not tile properties) to add, replace, or delete. To add an property, just
specify a key that doesn't exist; to delete an entry, set the value to |
|
Add warps to the map's |
|
The The only valid path format is |
For example, this changes the Outdoors
tile for the farm cave and adds a warp (see
map documentation for the warp syntax):
{
"Format": "2.0.0",
"Changes": [
{
"Action": "EditMap",
"Target": "Maps/FarmCave",
"MapProperties": {
"Outdoors": "T"
},
"AddWarps": [
"10 10 Town 0 30"
]
},
]
}
The MapTiles
field lets you add, edit, or remove the map's individual tiles and tile properties.
field | purpose | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
See common fields above. |
|||||||||||||||
|
The tiles to add, edit, or delete. All of the subfields below support tokens. This consists of an array of tiles (see examples below) with these properties:
|
For example, this extends the farm path one extra tile to the shipping bin:
{
"Format": "2.0.0",
"Changes": [
{
"Action": "EditMap",
"Target": "Maps/Farm",
"MapTiles": [
{
"Position": { "X": 72, "Y": 15 },
"Layer": "Back",
"SetIndex": "622"
}
]
},
]
}
You can use tokens in all of the fields. For example, this adds a warp in front of the shipping bin that leads to a different location each day:
{
"Format": "2.0.0",
"Changes": [
{
"Action": "EditMap",
"Target": "Maps/Farm",
"MapTiles": [
{
"Position": { "X": 72, "Y": 15 },
"Layer": "Back",
"SetProperties": {
"TouchAction": "MagicWarp {{Random:BusStop, Farm, Town, Mountain}} 10 11"
}
}
]
},
]
}
- Patching the farmhouse's
Back
layer may fail or cause strange effects, due to the game's floor decorating logic. This is a limitation in the game itself, not Content Patcher.
- Author guide for other actions and options