Changes

Jump to navigation Jump to search
m
Line 295: Line 295:  
With the {{nexus mod|3101|Console Code}} mod installed, you can run this command in the SMAPI console to see a list of objects by category:
 
With the {{nexus mod|3101|Console Code}} mod installed, you can run this command in the SMAPI console to see a list of objects by category:
   −
<pre>cs return string.Join(`\n`, Game1.objectInformation.Keys.Select(key => new StardewValley.Object(key, 1)).GroupBy(item => item.Category, item => item.Name).OrderByDescending(p => p.Key).Select(p => $`{p.Key}: {string.Join(`, `, p.OrderBy(name => name))}`));</pre>
+
<pre>cs return string.Join(`\n`, Game1.objectData.Keys.Select(key => new StardewValley.Object(key, 1)).GroupBy(item => item.Category, item => item.Name).OrderByDescending(p => p.Key).Select(p => $`{p.Key}: {string.Join(`, `, p.OrderBy(name => name))}`));</pre>
 
}}
 
}}
   Line 513: Line 513:  
|-
 
|-
 
| <samp>Type</samp>
 
| <samp>Type</samp>
| The item's general type, like <c>Arch</c> (artifact) or <c>Minerals</c>.
+
| The item's general type, like <samp>Arch</samp> (artifact) or <samp>Minerals</samp>. The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive
 
|-
 
|-
 
| <samp>Category</samp>
 
| <samp>Category</samp>
Line 624: Line 624:  
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
 
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
   −
They have their data in <samp>Data/BigCraftables</samp>, their in-game sprites in <samp>TileSheets/Craftables</samp>, and their code in <samp>StardewValley.Object</samp> (with the <code>bigCraftable.Value = true</code> flag).
+
They have their data in <samp>Data/BigCraftables</samp> (<samp>Data/BigCraftablesInformation</samp> prior to 1.6), their in-game sprites in <samp>TileSheets/Craftables</samp>, and their code in <samp>StardewValley.Object</samp> (with the <code>bigCraftable.Value = true</code> flag).
    
===Data format===
 
===Data format===
The big craftables data in <samp>Data/BigCraftables</samp> consists of an integer→string dictionary with entries like this<ref>See <samp>Data/BigCraftables.xnb</samp></ref>:
+
The big craftables data in <samp>Data/BigCraftables</samp> consists of a string → model lookup, where...
 +
* The key is the unqualified [[#Custom items|item ID]].
 +
* The value is a model with the fields listed below.
    
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
Line 646: Line 648:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
+
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
    +
====Basic info====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Field
+
! field
! Data Type
+
! purpose
! Effect<ref>See <samp>GameData.BigCraftables.BigCraftableData</samp></ref>
   
|-
 
|-
| Name
+
| <samp>Name</samp>
| string
+
| The internal item name.
| The internal item name (and display name in English).
   
|-
 
|-
| DisplayName
+
| <samp>DisplayName</samp><br /><samp>Description</samp>
| string
+
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
| A tokenizable string for the item's translated display name.
   
|-
 
|-
| Description
+
| <samp>Price</samp>
| string
+
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| A tokenizable string for the item's translated description.
+
|}
|-
+
 
| Price
+
====Behavior====
| integer
  −
| The gold price when sold by the player. This is not the price when bought from a shop.
  −
|-
  −
| Fragility
  −
| integer
  −
| How the item is removed by tools. Possible values:
   
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! fragility
+
! field
! effect
+
! purpose
 
|-
 
|-
| <samp>0</samp>
+
| <samp>Fragility</samp>
| Pick up with any tool.
+
| ''(Optional)'' How the item can be picked up. The possible values are 0 (pick up with any tool), 1 (destroyed if hit with an axe/hoe/pickaxe, or picked up with any other tool), or 2 (can't be removed once placed). Default 0.
 
|-
 
|-
| <samp>1</samp>
+
| <samp>CanBePlacedIndoors</samp><br /><samp>CanBePlacedOutdoors</samp>
| Destroyed if hit with an [[Axes|axe]], [[Hoes|hoe]], or [[Pickaxes|pickaxe]]. Any other tool will pick it up.
+
| ''(Optional)'' Whether the item can be placed indoors or outdoors. Default true.
 
|-
 
|-
| <samp>2</samp>
+
| <samp>IsLamp</samp>
| Indestructible. The item can't be removed once placed.
+
| ''(Optional)'' Whether this is a lamp and should produce light when dark. Default false.
 
|}
 
|}
 +
 +
====Appearance====
 +
{| class="wikitable"
 
|-
 
|-
| CanBePlacedOutdoors
+
! field
| boolean
+
! purpose
| Whether the item can be placed outdoors.
   
|-
 
|-
| CanBePlacedIndoors
+
| <samp>Texture</samp>
| boolean
+
| ''(Optional)'' The asset name for the texture containing the item's sprite. Defaults to <samp>TileSheets/Craftables</samp>.
| Whether the item can be placed indoors.
   
|-
 
|-
| IsLamp
+
| <samp>SpriteIndex</samp>
| boolean
+
| ''(Optional)'' The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| Whether the item is a lamp and produces light when it's dark.  
+
|}
 +
 
 +
====Context tags====
 +
{| class="wikitable"
 
|-
 
|-
| Texture
+
! field
| string
+
! purpose
| The asset name for the texture containing the item's sprite, or null for <samp>TileSheets/Craftables</samp>.
   
|-
 
|-
| SpriteIndex
+
| <samp>ContextTags</samp>
| integer
+
| ''(Optional)'' The custom [[Modding:Items#Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
| The sprite's index in the spritesheet.
+
<syntaxhighlight lang="json">
 +
"ContextTags": [ "light_source", "torch_item" ]
 +
</syntaxhighlight>
 +
|}
 +
 
 +
====Advanced====
 +
{| class="wikitable"
 
|-
 
|-
| ContextTags
+
! field
| <samp>List</samp> of strings
+
! purpose
| Thee custom [[#Context_tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data).
  −
|-
  −
| CustomFields
  −
| <samp>Dictionary</samp> of string keys to string values
  −
| Custom fields ignored by the base game, for use by mods.
   
|-
 
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[Modding:Migrate_to_Stardew_Valley_1.6#Custom_data_fields|custom fields]] for this entry.
 
|}
 
|}
   Line 972: Line 972:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
+
Hats from the base game use the hat's <samp>ParentSheetIndex</samp> as its item ID.
 +
For each entry in the data asset, the key is the hat's item ID, and the value is a slash-delimited string with these fields:
    
{| class="wikitable"
 
{| class="wikitable"
Line 982: Line 983:  
| 0
 
| 0
 
| name
 
| name
| The internal item name (and display name in English).
+
| The internal item name.
 
|-
 
|-
 
| 1
 
| 1
Line 997: Line 998:  
|-
 
|-
 
| 4
 
| 4
 +
| tags
 +
| A space-separated list of "tags". These are separate from context tags, and used to contain miscellaneous information. Currently, the only tag used by the game is <samp>Prismatic</samp>, which marks a hat as prismatic and causes it to cycle through colors.
 +
|-
 +
| 5
 
| display name
 
| display name
| The translated item name shown in-game (for non-English assets only).
+
| The translated item name shown in-game.
 +
|-
 +
| 6
 +
| sprite index
 +
| The index in the hat spritesheet used to display this hat.
 +
|-
 +
| 7
 +
| texture name
 +
| The name of the game texture to use for the hat. If empty, the game will use the default hat sheet <samp>Characters/Farmer/hats</samp>
 
|}
 
|}
   −
Hats have a hard-coded category of -95 (<samp>Hats.cs::Load</samp>)
+
Hats have a hard-coded category of -95 (<samp>HatDataDefinition.cs::GetData</samp>)
    
==Tools==
 
==Tools==
Line 1,169: Line 1,182:  
==History==
 
==History==
 
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
 
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
 +
{{History|1.6|Field 4 of hats is now used for tags, rather than displayName.}}
 +
{{History|1.6|Display name field is now used for all languages.}}
 +
{{History|1.6|Added Texture & texture index fields to all object data.}}
 +
{{History|1.6|All types of items now use string IDs.}}
translators
8,445

edits

Navigation menu