Changes

Jump to navigation Jump to search
→‎Custom minecarts: update for build 24034 (revamped and expanded minecart data)
Line 3,298: Line 3,298:     
===Custom minecarts===
 
===Custom minecarts===
You can now add/edit [[minecart]] destinations by editing the <samp>Data\Minecarts</samp> data asset, which consists of a data model with two relevant fields (listed below).
+
You can now extend [[minecart]]s by editing the <samp>Data\Minecarts</samp> data asset.
 +
 
 +
This consists of a string → model lookup, where...
 +
* The key is a [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|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.
    
{| class="wikitable"
 
{| class="wikitable"
Line 3,304: Line 3,308:  
! field
 
! field
 
! effect
 
! effect
|-
  −
| <samp>MinecartsUnlocked</samp>
  −
| A [[Modding:Game state queries|game state query]] which indicates whether minecarts in general are unlocked. You usually shouldn't change this value, unless you're changing the overall game progression (e.g. adding an alternative way to unlock minecart access).
   
|-
 
|-
 
| <samp>Destinations</samp>
 
| <samp>Destinations</samp>
| The destinations which the player can travel to from any minecart. This consists of a string → model lookup, where the key is a [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] for the destination, and the value is a model with these fields:
+
| The destinations which the player can travel to from minecarts in this network. This consists of a list of model with these fields:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 3,315: Line 3,316:  
! effect
 
! effect
 
|-
 
|-
| <samp>Location</samp>
+
| <samp>Id</samp>
 +
| A [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] for this destination within the network.
 +
|-
 +
| <samp>DisplayName</samp>
 +
| A [[Modding:Tokenizable strings|tokenizable string]] for the destination name shown in the minecart menu. You can use the location's display name with the <samp>LocationName</samp> token (like <code>[LocationName Desert]</code> for the [[desert]]).
 +
|-
 +
| <samp>TargetLocation</samp>
 
| The [[#Custom locations|location ID]] for the destination.
 
| The [[#Custom locations|location ID]] for the destination.
 
|-
 
|-
| <samp>Tile</samp>
+
| <samp>TargetTile</samp>
 
| The destination tile position within the location, specified as a model with <samp>X</samp> and <samp>Y</samp> fields.
 
| The destination tile position within the location, specified as a model with <samp>X</samp> and <samp>Y</samp> fields.
 
|-
 
|-
| <samp>Direction</samp>
+
| <samp>TargetDirection</samp>
 
| The direction the player should face after arrival (one of <samp>down</samp>, <samp>left</samp>, <samp>right</samp>, or <samp>up</samp>).
 
| The direction the player should face after arrival (one of <samp>down</samp>, <samp>left</samp>, <samp>right</samp>, or <samp>up</samp>).
 
|-
 
|-
| <samp>DisplayName</samp>
+
| <samp>Condition</samp>
| A [[Modding:Tokenizable strings|tokenizable string]] for the destination name shown in the minecart menu. You can use the location's display name with the <samp>LocationName</samp> token (like <code>[LocationName Desert]</code> for the [[desert]]).
+
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this minecart destination is available. Defaults to always available.
 
|-
 
|-
| <samp>Network</samp>
+
| <samp>Price</samp>
| ''(Optional)'' An arbitrary ID which groups the destination (along with any others having the same ID) into a separate network. Destinations in a network are only visible if the destination list is opened for that network via the <samp>MinecartTransport {{o|network name}}</samp> [[Modding:Maps|action property]]. If omitted, the minecart is part of the implicit default network.
+
| ''(Optional)'' The gold price that must be paid each time to use this destination. Default none.
 
|-
 
|-
| <samp>Condition</samp>
+
| <samp>BuyTicketMessage</samp>
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this minecart destination is available. Defaults to always available.
+
| ''(Optional)'' If the destination costs money to use, a [[Modding:Tokenizable strings|tokenizable string]] for the purchase confirmation message shown. If present, <code>{0}</code> is replaced with the purchase price. Defaults to the network's <samp>BuyTicketMessage</samp> field.
 
|-
 
|-
 
| <samp>CustomFields</samp>
 
| <samp>CustomFields</samp>
| The [[#Custom data fields|custom fields]] for this entry.
+
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.
 
|}
 
|}
 +
|-
 +
| <samp>UnlockCondition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this minecart network is unlocked. Default always enabled.
 +
|-
 +
| <samp>LockedMessage</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] for the message shown when interacting with a minecart when the <samp>UnlockCondition</samp> false. Defaults to an "''Out of order''" translation.
 +
|-
 +
| <samp>ChooseDestinationMessage</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] for the message shown when listing destinations to choose from. Defaults to a "''Choose destination:''" translation.
 +
|-
 +
| <samp>BuyTicketMessage</samp>
 +
| ''(Optional)'' When a destination costs money to use, a [[Modding:Tokenizable strings|tokenizable string]] for the purchase confirmation message shown. If present, <code>{0}</code> is replaced with the purchase price. Defaults to a "''Buy a ticket for {0}g?''" translation.
 
|}
 
|}
 +
 +
====Open a minecart menu====
 +
You can use an <samp>Action: MinecartTransport {{o|network ID}} {{o|exclude destination ID}}</samp> [[Modding:Maps|map property]] to open the minecart menu. When the player interacts with the tile, it'll open the menu for the {{o|network ID}} network (default <samp>Default</samp>). if {{o|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|bus stop]] minecart uses <code>Action: MinecartTransport Default Bus</code>.
 +
 +
From a C# mod, you can call <code>Game1.currentLocation.ShowMineCartMenu(networkId, excludeDestinationId)</code> which works the same way (except that <samp>networkId</samp> is required).
    
====Example====
 
====Example====
This [[Modding:Content Patcher|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 [[Random Events|Earthquake]] has occured and minecarts have been unlocked.
+
This [[Modding:Content Patcher|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 [[Random Events|Earthquake]] has occurred and minecarts have been unlocked.
    
{{#tag:syntaxhighlight|<nowiki>
 
{{#tag:syntaxhighlight|<nowiki>
Line 3,349: Line 3,373:  
             "Action": "EditData",
 
             "Action": "EditData",
 
             "Target": "Data/Minecarts",
 
             "Target": "Data/Minecarts",
             "TargetField": [ "Destinations" ],
+
             "TargetField": [ "Default", "Destinations" ], // for the "Default" network, edit the "Destinations" field
 
             "Entries": {
 
             "Entries": {
 
                 "Railroad": {
 
                 "Railroad": {
                     "Location": "Railroad",
+
                     "Id": "Railroad",
                     "Tile": { "X": 16, "Y": 39 },
+
                     "DisplayName": "[LocationName Railroad]",
                     "Direction": "down",
+
                    "Condition": "LOCATION_ACCESSIBLE Railroad",
                    "DisplayName": "[LocationName Railroad]"
+
 
 +
                    "TargetLocation": "Railroad",
 +
                    "TargetTile": { "X": 16, "Y": 39 },
 +
                     "TargetDirection": "down",
 
                 }
 
                 }
            },
  −
            "When": {
  −
                "HasFlag": "ccBoilerRoom",
  −
                "query: {{DaysPlayed}} </nowiki>><nowiki>= 32": true
   
             }
 
             }
 
         },
 
         },
translators
8,446

edits

Navigation menu