Line 3: |
Line 3: |
| This page explains how add/edit machines in the game data. This is an advanced guide for modders. | | This page explains how add/edit machines in the game data. This is an advanced guide for modders. |
| | | |
− | ==Copied from [[Modding:Migrate to Stardew Valley 1.6]]== | + | ==Definitions== |
− | ===Custom machines=== | + | A "machine" is a placeable object which takes input and/or produces output based on the rules in <samp>Data/Machines</samp>. A machine doesn't need to do both (e.g. [[Solar Panel|solar panels]] produce output without accepting input), and it's not necessarily something players would intuitively consider a machine (e.g. [[incubator]]s and [[Mushroom Log|mushroom logs]] are machines). |
− | You can now add/edit machine logic by editing the <samp>Data/Machines</samp> asset. | + | |
| + | ==Data format== |
| + | You can add/edit machine logic by editing the <samp>Data/Machines</samp> [[Modding:Editing XNB files|asset]]. |
| | | |
| This consists of a string → model lookup, where... | | This consists of a string → model lookup, where... |
− | * The key is the [[#Custom items|'''qualified''' item ID]] for the item which acts as a machine (like <samp>(BC)127</samp> for [[The Cave|mushroom boxes]]). | + | * The key is the [[Modding:Common data field types#Item ID|'''qualified''' item ID]] for the item which acts as a machine (like <samp>(BC)127</samp> for [[The Cave|mushroom boxes]]). |
| * The value is a model with the fields listed below. | | * The value is a model with the fields listed below. |
| | | |
− | ====Item processing rules====
| + | ===Item processing rules=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 110: |
Line 112: |
| |- | | |- |
| | <samp>PriceModifiers</samp><br /><samp>PriceModifiers</samp> | | | <samp>PriceModifiers</samp><br /><samp>PriceModifiers</samp> |
− | | ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] applied to the output item's price. Default none. | + | | ''(Optional)'' [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|Quantity modifiers]] applied to the output item's price. Default none. |
| |- | | |- |
| | <samp>IncrementMachineParentSheetIndex</samp> | | | <samp>IncrementMachineParentSheetIndex</samp> |
Line 169: |
Line 171: |
| |- | | |- |
| | <samp>ItemId</samp> | | | <samp>ItemId</samp> |
− | | The [[#Custom items|qualified or unqualified item ID]] for the required item. | + | | The [[Modding:Common data field types#Item ID|qualified or unqualified item ID]] for the required item. |
| |- | | |- |
| | <samp>RequiredCount</samp> | | | <samp>RequiredCount</samp> |
Line 182: |
Line 184: |
| |- | | |- |
| | <samp>ReadyTimeModifiers</samp> | | | <samp>ReadyTimeModifiers</samp> |
− | | ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] applied to the produced item's processing time. The modifier conditions can use item-only tokens, which will check the ''input'' (not output) item. | + | | ''(Optional)'' [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|Quantity modifiers]] applied to the produced item's processing time. The modifier conditions can use item-only tokens, which will check the ''input'' (not output) item. |
| |- | | |- |
| | <samp>ReadyTimeModifierMode</samp> | | | <samp>ReadyTimeModifierMode</samp> |
− | | ''(Optional)'' A [[#Quantity modifiers|quantity modifier mode]] which indicates what to do if multiple modifiers apply at the same time. Default <samp>Stack</samp>. | + | | ''(Optional)'' A [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|quantity modifier mode]] which indicates what to do if multiple modifiers apply at the same time. Default <samp>Stack</samp>. |
| |} | | |} |
| | | |
− | ====Behavior tweaks====
| + | ===Behavior tweaks=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 222: |
Line 224: |
| |} | | |} |
| | | |
− | ====Audio & visuals====
| + | ===Audio & visuals=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 246: |
Line 248: |
| |- | | |- |
| | <samp>Id</samp> | | | <samp>Id</samp> |
− | | The [[#Custom audio|audio cue ID]] to play. | + | | The [[Modding:Audio|audio cue ID]] to play. |
| |- | | |- |
| | <samp>Delay</samp> | | | <samp>Delay</samp> |
Line 286: |
Line 288: |
| |- | | |- |
| | <samp>Color</samp> | | | <samp>Color</samp> |
− | | ''(Optional)'' A tint color to apply to the sprite. See [[#Color fields|color format]]. Default <samp>White</samp> (no tint). | + | | ''(Optional)'' A tint color to apply to the sprite. See [[Modding:Common data field types#Color|color format]]. Default <samp>White</samp> (no tint). |
| |- | | |- |
| | <samp>AlphaFade</samp><br /><samp>Loops</samp><br /><samp>Rotation</samp><br /><samp>RotationChange</samp><br /><samp>ScaleChange</samp><br /><samp>SortOffset</samp> | | | <samp>AlphaFade</samp><br /><samp>Loops</samp><br /><samp>Rotation</samp><br /><samp>RotationChange</samp><br /><samp>ScaleChange</samp><br /><samp>SortOffset</samp> |
− | | ''(Optional)'' See equivalent fields in the [[#Event changes|<samp>temporaryAnimatedSprite</samp> event command]]. Default 0. | + | | ''(Optional)'' See equivalent fields in the [[Modding:Event data|<samp>temporaryAnimatedSprite</samp> event command]]. Default 0. |
| |- | | |- |
| | <samp>Frames</samp><br /><samp>Scale</samp> | | | <samp>Frames</samp><br /><samp>Scale</samp> |
− | | ''(Optional)'' See equivalent fields in the [[#Event changes|<samp>temporaryAnimatedSprite</samp> event command]]. Default 1. | + | | ''(Optional)'' See equivalent fields in the [[Modding:Event data|<samp>temporaryAnimatedSprite</samp> event command]]. Default 1. |
| |- | | |- |
| | <samp>Interval</samp> | | | <samp>Interval</samp> |
− | | ''(Optional)'' See equivalent fields in the [[#Event changes|<samp>temporaryAnimatedSprite</samp> event command]]. Default 100. | + | | ''(Optional)'' See equivalent fields in the [[Modding:Event data|<samp>temporaryAnimatedSprite</samp> event command]]. Default 100. |
| |- | | |- |
| | <samp>Flicker</samp><br /><samp>Flip</samp> | | | <samp>Flicker</samp><br /><samp>Flip</samp> |
− | | ''(Optional)'' See equivalent fields in the [[#Event changes|<samp>temporaryAnimatedSprite</samp> event command]]. Default false. | + | | ''(Optional)'' See equivalent fields in the [[Modding:Event data|<samp>temporaryAnimatedSprite</samp> event command]]. Default false. |
| |} | | |} |
| |} | | |} |
Line 318: |
Line 320: |
| |- | | |- |
| | <samp>Color</samp> | | | <samp>Color</samp> |
− | | ''(Optional)'' A tint color to apply to the light. See [[#Color fields|color format]]. Default <samp>White</samp> (no tint). | + | | ''(Optional)'' A tint color to apply to the light. See [[Modding:Common data field types#Color|color format]]. Default <samp>White</samp> (no tint). |
| |} | | |} |
| |- | | |- |
Line 328: |
Line 330: |
| |} | | |} |
| | | |
− | ====Player interaction messages====
| + | ===Player interaction messages=== |
| These only apply when the player interacts with a chest directly, instead of using a [[hopper]] or mod like {{nexus mod|1063|Automate}}. | | These only apply when the player interacts with a chest directly, instead of using a [[hopper]] or mod like {{nexus mod|1063|Automate}}. |
| | | |
Line 349: |
Line 351: |
| |} | | |} |
| | | |
− | ====Advanced logic====
| + | ===Advanced logic=== |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
Line 369: |
Line 371: |
| |- | | |- |
| | <samp>HasInput</samp><br /><samp>HasOutput</samp> | | | <samp>HasInput</samp><br /><samp>HasOutput</samp> |
− | | ''(Optional)'' Whether to force adding the <samp>machine_input</samp> or <samp>machine_output</samp> [[#New context tags|context tags]] respectively. This isn't needed for most machines, since they'll be set based on the <samp>OutputRules</samp> field. Default false. | + | | ''(Optional)'' Whether to force adding the <samp>machine_input</samp> or <samp>machine_output</samp> [[Modding:Items#Context tags|context tags]] respectively. This isn't needed for most machines, since they'll be set based on the <samp>OutputRules</samp> field. Default false. |
| |- | | |- |
| | <samp>IsIncubator</samp> | | | <samp>IsIncubator</samp> |
Line 396: |
Line 398: |
| |- | | |- |
| | <samp>CustomFields</samp> | | | <samp>CustomFields</samp> |
− | | The [[#Custom data fields|custom fields]] for this entry. | + | | The [[Modding:Common data field types#Custom fields|custom fields]] for this entry. |
| |} | | |} |
| | | |
− | ====Interacting with machines in C#==== | + | ==For C# mods== |
| + | ===Interacting with machines=== |
| Stardew Valley 1.6 adds two <samp>Object</samp> fields for reference: | | Stardew Valley 1.6 adds two <samp>Object</samp> fields for reference: |
| {| class="wikitable" | | {| class="wikitable" |