Modding:Minecarts
← Index
This page explains minecarts. This is an advanced guide for mod developers.
Format
You can now extend minecarts by editing the Data\Minecarts data asset.
This consists of a string → model lookup, where...
- The key is a unique string ID for the minecart network. When you interact with a minecart, the destinations listed for its network are shown.
- The value is a model with the fields listed below.
field | effect | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Destinations | The destinations which the player can travel to from minecarts in this network. This consists of a list of model with these fields:
| ||||||||||||||||||||
UnlockCondition | (Optional) A game state query which indicates whether this minecart network is unlocked. Default always enabled. | ||||||||||||||||||||
LockedMessage | (Optional) A tokenizable string for the message shown when interacting with a minecart when the UnlockCondition false. Defaults to an "Out of order" translation. | ||||||||||||||||||||
ChooseDestinationMessage | (Optional) A tokenizable string for the message shown when listing destinations to choose from. Defaults to a "Choose destination:" translation. | ||||||||||||||||||||
BuyTicketMessage | (Optional) When a destination costs money to use, a tokenizable string for the purchase confirmation message shown. If present, {0} is replaced with the purchase price. Defaults to a "Buy a ticket for {0}g?" translation.
|
You can use an Action: MinecartTransport [network ID]
[exclude destination ID]
map property to open the minecart menu. When the player interacts with the tile, it'll open the menu for the [network ID]
network (default Default). if [exclude destination ID]
is specified, the matching destination will be hidden from the list (usually because you're at that minecart). For example, the bus stop minecart uses Action: MinecartTransport Default Bus
.
From a C# mod, you can call Game1.currentLocation.ShowMineCartMenu(networkId, excludeDestinationId)
which works the same way (except that networkId is required).
Example
This Content Patcher content pack adds the Railroad as a minecart destination, complete with a map edit adding a decorative minecart. It is available after the Earthquake has occurred and minecarts have been unlocked.
{
"Format": "2.5.0",
"Changes": [
// add minecart destination
{
"Action": "EditData",
"Target": "Data/Minecarts",
"TargetField": [ "Default", "Destinations" ], // for the "Default" network, edit the "Destinations" field
"Entries": {
"Railroad": {
"Id": "Railroad",
"DisplayName": "[LocationName Railroad]",
"Condition": "LOCATION_ACCESSIBLE Railroad",
"TargetLocation": "Railroad",
"TargetTile": { "X": 16, "Y": 39 },
"TargetDirection": "down",
}
}
},
// add decorative minecart
{
"Action": "EditMap",
"Target": "Maps/Railroad",
"FromFile": "assets/Custom_Railroad_Minecart.tmx",
"ToArea": { "X": 15, "Y": 35, "Width": 4, "Height": 5 }
}
]
}