Changes

→‎Spritesheet layout: + pre-1.6 vanilla layouts
Line 1: Line 1:  
←[[Modding:Index|Index]]
 
←[[Modding:Index|Index]]
   −
==Raw data==
+
This page explains how to create and edit in-game [[Animals|farm animals]].
Animal data is stored in <tt>Content\Data\FarmAnimals.xnb</tt>, which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data as of {{version|1.5.1}} for reference:
     −
{{collapse|Data|content=<source lang="json">
+
==Data format==
{
+
You can add or edit farm animals by editing the <samp>Data/FarmAnimals</samp> [[Modding:Editing XNB files|asset]].
  "White Chicken": "1/3/176/174/cluck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/4/7/null/641/800/White Chicken/Coop",
  −
  "Brown Chicken": "1/3/180/182/cluck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/7/4/null/641/800/Brown Chicken/Coop",
  −
  "Blue Chicken": "1/3/176/174/cluck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/7/4/null/641/800/Blue Chicken/Coop",
  −
  "Void Chicken": "1/3/305/305/cluck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/4/4/null/641/800/Void Chicken/Coop",
  −
  "Golden Chicken": "1/3/928/928/cluck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/7/4/null/641/800/Golden Chicken/Coop",
  −
  "Duck": "2/5/442/444/Duck/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/3/8/null/642/4000/Duck/Coop",
  −
  "Rabbit": "4/6/440/446/rabbit/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/10/5/null/643/8000/Rabbit/Coop",
  −
  "Dinosaur": "7/0/107/-1/none/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/1/8/null/644/1000/Dinosaur/Coop",
  −
  "White Cow": "1/5/184/186/cow/36/64/64/64/36/64/64/64/1/false/Barn/32/32/32/32/15/5/Milk Pail/639/1500/White Cow/Barn",
  −
  "Brown Cow": "1/5/184/186/cow/36/64/64/64/36/64/64/64/1/false/Barn/32/32/32/32/15/5/Milk Pail/639/1500/Brown Cow/Barn",
  −
  "Goat": "2/5/436/438/goat/24/64/84/64/24/64/84/64/1/false/Barn/32/32/32/32/10/5/Milk Pail/644/4000/Goat/Barn",
  −
  "Pig": "1/10/430/-1/pig/24/64/84/64/24/64/84/64/1/false/Barn/32/32/32/32/20/5/null/640/16000/Pig/Barn",
  −
  "Hog": "1/5/640/-1/pig/24/64/84/64/24/64/84/64/2/false/Barn/32/32/32/32/20/5/null/640/1500/Hog/Barn",
  −
  "Sheep": "3/4/440/-1/sheep/24/64/84/64/24/64/84/64/1/true/Barn/32/32/32/32/15/5/Shears/644/8000/Sheep/Barn",
  −
  "Ostrich": "7/7/289/-1/Ostrich/24/64/84/64/24/64/84/64/0/false/Barn/32/32/32/32/15/5/null/644/16000/Ostrich/Barn"
  −
}
  −
</source>}}
     −
==Format==
+
This consists of a string → model lookup, where...
Each entry in the data contains a ''key'' and a ''value'', and each value contains many ''fields''.
+
* The key is a [[Modding:Common data field types#Unique string ID|unique string ID]] for the farm animal type.
 +
* The value is a model with the fields listed below.
   −
===Key===
+
===Main info===
An animal's <tt>type</tt> must be a key that exists in the data. Each key in the data must be unique.
+
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>DisplayName</samp>
 +
| A [[Modding:Tokenizable strings|tokenizable string]] for the animal type's display name.
 +
|-
 +
| <samp>House</samp>
 +
| The [[#Custom buildings|building ID]] for the main building type that houses this animal. The animal will also be placeable in buildings whose <samp>ValidOccupantTypes</samp> field contains this value.
 +
|-
 +
| <samp>Gender</samp>
 +
| ''(Optional)'' The possible genders for the animal type. Currently this only affects the text shown after purchasing the animal, like "''Great! I'll send little &lt;name&gt; to [his/her] new home right away''". Default <samp>Female</samp>.
 +
 
 +
The possible values are:
 +
{| class="wikitable"
 +
|-
 +
! value
 +
! effect
 +
|-
 +
| <samp>Male</samp><br /><samp>Female</samp>
 +
| Farm animals of this type are always male or always female.
 +
|-
 +
| <samp>MaleOrFemale</samp>
 +
| The gender of each animal is randomized based on its internal unique ID.
 +
|}
 +
|}
 +
 
 +
===Animal shop===
 +
These fields affect how this farm animal type is shown in [[Marnie's Ranch|Marnie's animal shop]]. Animals are automatically listed if they have a valid <samp>PurchasePrice</samp> value.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>PurchasePrice</samp>
 +
| ''(Optional if not purchaseable)'' Half the cost to purchase the animal (the actual price is double this value), or a negative value to disable purchasing this animal type. Default -1.
 +
|-
 +
| <samp>ShopTexture</samp>
 +
| ''(Optional if not purchaseable)'' The asset name for the icon texture to show in shops. Defaults to <samp>LooseSprites/Cursors</samp> or <samp>LooseSprites/Cursors2</samp> based on the animal's position within the loaded data (but using the default isn't recommended if it's purchaseable).
 +
|-
 +
| <samp>ShopSourceRect</samp>
 +
| ''(Optional if not purchaseable)'' The pixel area within the <samp>ShopTexture</samp> to draw, specified as an object with <samp>X</samp>, <samp>Y</samp>, <samp>Width</samp>, and <samp>Height</samp> fields. This should be 32 pixels wide and 16 high. Ignored if <samp>ShopTexture</samp> isn't set.
 +
|-
 +
| <samp>RequiredBuilding</samp>
 +
| ''(Optional)'' The building that needs to be built on the farm for this animal to be available to purchase. Buildings that are upgraded from this building are valid too. Default none.
 +
|-
 +
| <samp>UnlockCondition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether the farm animal is available in the shop menu. Default always unlocked.
 +
|-
 +
| <samp>ShopDisplayName</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] for the display name shown in the shop menu. Defaults to the <samp>DisplayName</samp> field.
 +
|-
 +
| <samp>ShopDescription</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] for the tooltip description shown in the shop menu. Defaults to none.
 +
|-
 +
| <samp>ShopMissingBuildingDescription</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] which overrides <samp>ShopDescription</samp> if the <samp>RequiredBuilding</samp> isn't built. Defaults to none.
 +
|-
 +
| <samp>AlternatePurchaseTypes</samp>
 +
| ''(Optional)'' The possible variants for this farm animal (e.g. chickens can be Brown Chicken, Blue Chicken, or White Chicken). This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>ID</samp>
 +
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for is purchase type within the current list.
 +
|-
 +
| <samp>AnimalIDs</samp>
 +
| A list of animal IDs to spawn instead of the main <samp>ID</samp> field. If multiple are listed, one is chosen at random on purchase.
 +
|-
 +
| <samp>Condition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this variant entry is available. Default always enabled.
 +
|}
   −
===Value===
+
If multiple are listed, the first available variant is returned. Default none.
All entries share the same value format, which cannot be re-ordered. Each field is explained below.
+
|}
    +
===Hatching===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! index
+
! field
! syntax
+
! effect
! description
+
|-
 +
| <samp>EggItemIds</samp>
 +
| ''(Optional)'' A list of the [[#Custom items|object IDs]] that can be placed in the [[incubator]] or [[Ostrich Incubator|ostrich incubator]] to hatch this animal. If the animal's <samp>House</samp> field doesn't match the current building, the entry will be ignored. Default none.
 +
|-
 +
| <samp>IncubationTime</samp>
 +
| ''(Optional)'' How long eggs incubate before they hatch. Default 9000 minutes.
 +
|-
 +
| <samp>IncubatorParentSheetOffset</samp>
 +
| ''(Optional)'' An offset applied to the incubator's sprite index when it's holding an egg. Default 1.
 +
 
 +
The vanilla values are:
 +
{| class="wikitable"
 +
|-
 +
! offset
 +
! [[incubator]]
 +
! [[Ostrich Incubator|ostrich incubator]]
 
|-
 
|-
 
| 0
 
| 0
| {{t|days to produce}}
+
| empty incubator
| Number of days for the animal to [[Animals#Produce|produce]]. This is affected by [[Animals#Animal Care|friendship and happiness]], and [[Sheep]] are affected by the [[Shepherd]] profession.
+
| empty incubator
 
|-
 
|-
 
| 1
 
| 1
| {{t|age when mature}}
+
| small white egg
| Number of days until mature.
+
| large brown egg
 
|-
 
|-
 
| 2
 
| 2
| {{t|default produce index}}
+
| small brown egg
| The [[Modding:Object data|item ID]] for the [[Animals#Produce|default produce item]] (e.g. <tt>184</tt> is [[Milk]]).
+
| ''invalid'' (will show [[Junimo Chest|Junimo chest]] sprite)
 +
|}
 +
|-
 +
| <samp>BirthText</samp>
 +
| ''(Optional)'' A [[Modding:Tokenizable strings|tokenizable string]] for the message shown when entering the building after the egg hatched. Defaults to the text "<samp>???</samp>".
 +
|}
 +
 
 +
===Growth===
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>DaysToMature</samp>
 +
| ''(Optional)'' The number of days until a freshly purchased/born animal becomes an adult and begins producing items. Default 1.
 +
|-
 +
| <samp>CanGetPregnant</samp>
 +
| ''(Optional)'' Whether an animal can [[Animals#Animal Births|produce a child]] (regardless of gender). Default false.
 +
|}
 +
 
 +
===Produce===
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>ProduceItemIds</samp><br /><samp>DeluxeProduceItemIds</samp>
 +
| ''(Optional)'' The items produced by the animal when it's an adult. The <samp>DeluxeProduceItemIds</samp> field only applies if the <samp>Deluxe*</samp> fields match. Both default to none.
 +
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>ItemId</samp>
 +
| The [[#Custom items|''unqualified'' object ID]] of the item to produce.
 +
|-
 +
| <samp>Condition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this item can be produced now. Defaults to always true.
 +
|-
 +
| <samp>MinimumFriendship</samp>
 +
| ''(Optional)'' The minimum friendship points with the animal needed to produce this item. Default 0.
 +
|}
 +
 
 +
If multiple items can be produced, one is chosen at random (with deluxe items taking priority if applicable).
 +
|-
 +
| <samp>DaysToProduce</samp>
 +
| ''(Optional)'' The number of days between item productions. For example, setting <samp>1</samp> will produce an item every day. Default 1.
 +
|-
 +
| <samp>ProduceOnMature</samp>
 +
| ''(Optional)'' Whether an item is produced on the day the animal becomes an adult. Default false.
 +
|-
 +
| <samp>FriendshipForFasterProduce</samp>
 +
| ''(Optional)'' The minimum friendship points needed to reduce the <samp>DaysToProduce</samp> by one. Defaults to no reduction based on friendship.
 +
|-
 +
| <samp>DeluxeProduceMinimumFriendship</samp>
 +
| ''(Optional)'' The minimum friendship points needed to produce the <samp>DeluxeProduceItemId</samp>. Default 200.
 +
|-
 +
| <samp>DeluxeProduceCareDivisor</samp><br /><samp>DeluxeProduceLuckMultiplier</samp>
 +
| ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] which change the probability of producing the <samp>DeluxeProduceItemId</samp>, based on this formula:
 +
<pre>
 +
if happiness > 200:
 +
  happiness_modifier = happiness * 1.5
 +
else if happiness > 100:
 +
  happiness_modifier = 0
 +
else
 +
  happiness_modifier = happiness - 100
 +
 
 +
((friendship + happiness_modifier) / DeluxeProduceCareDivisor) + (daily_luck * DeluxeProduceLuckMultiplier)
 +
</pre>
 +
 
 +
Specifically:
 +
* <samp>DeluxeProduceCareDivisor</samp> reduces the bonus from friendship and happiness, so a lower value ''increases'' the probability of producing the deluxe item. Default 1200.
 +
* <samp>DeluxeProduceLuckMultiplier</samp> increases the effect of [[Luck|daily luck]]. Default 0.
 +
 
 +
For example, given a friendship of 102 and happiness of 150, the probability with the default field values will be <code>((102 + 0) / 1200) + (daily_luck * 0) = (102 / 1200) = 0.085</code> or 8.5%.
 +
 
 +
See [[Animals#Produce]] for more info on the calculation.
 +
|-
 +
| <samp>HarvestType</samp>
 +
| ''(Optional)'' How produced items are collected from the animal. The valid values are:
 +
{| class="wikitable"
 +
|-
 +
! value
 +
! effect
 +
|-
 +
| <samp>DropOvernight</samp>
 +
| The item is placed on the ground in the animal's home building overnight.
 +
|-
 +
| <samp>HarvestWithTool</samp>
 +
| The item is collected from the animal directly based on the <samp>HarvestTool</samp> field.
 +
|-
 +
| <samp>DigUp</samp>
 +
| The farm animal will dig it up randomly throughout the day. This applies the same logic as [[Pig#Produce|pigs finding truffles]], but for the current item to produce via <samp>ProduceItemIds</samp> and <samp>DeluxeProduceItemIds</samp>.
 +
|}
 +
 
 +
Default <samp>DropOvernight</samp>.
 +
|-
 +
| <samp>HarvestTool</samp>
 +
| ''(Optional)'' The [[#Custom items|tool ID]] with which produced items can be collected from the animal, if the <samp>HarvestType</samp> is set to <samp>HarvestWithTool</samp>. The values recognized by the vanilla tools are <samp>Milk Pail</samp> and <samp>Shears</samp>. Default none.
 +
|-
 +
| <samp>CanEatGoldenCrackers</samp>
 +
| ''(Optional)'' Whether players can feed this animal a golden cracker to double its normal output. Default true.
 +
|}
 +
 
 +
===Audio & sprite===
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Sound</samp>
 +
| ''(Optional)'' The [[#Custom audio|audio cue ID]] for the sound produced by the animal (e.g. when pet). Default none.
 +
|-
 +
| <samp>BabySound</samp>
 +
| ''(Optional)'' Overrides <samp>Sound</samp> field when the animal is a baby. Has no effect if <samp>Sound</samp> isn't specified. Default none.
 +
|-
 +
| <samp>Texture</samp>
 +
| ''(Optional)'' The asset name for the animal's spritesheet. Defaults to <samp>Animals/{{t|ID}}</samp> (like <samp>Animals/Goat</samp> for a [[goat]]). This asset must exist even if you use <samp>Skins</samp> below, since the default appearance is automatically an available skin. See [[#Spritesheet layout|spritesheet layout]].
 +
|-
 +
| <samp>HarvestedTexture</samp>
 +
| ''(Optional)'' Overrides <samp>Texture</samp> if the animal doesn't currently have an item ready to collect (like the [[sheep]]'s sheared sprite). Default none.
 +
|-
 +
| <samp>BabyTexture</samp>
 +
| ''(Optional)'' Overrides <samp>Texture</samp> and <samp>HarvestedTexture</samp> when the animal is a baby. Default none.
 +
|-
 +
| <samp>UseFlippedRightForLeft</samp>
 +
| ''(Optional)'' When the animal is facing left, whether to use a flipped version of their right-facing sprite. See [[#Spritesheet layout|spritesheet layout]] for more info. Default false.
 +
|-
 +
| <samp>SpriteWidth</samp><br /><samp>SpriteHeight</samp>
 +
| ''(Optional)'' The pixel height & width of the animal's sprite (before the in-game pixel zoom). Both default to 16.
 +
|-
 +
| <samp>EmoteOffset</samp>
 +
| ''(Optional)'' A pixel offset to apply to emotes from the farm animal, specified as an object with <samp>X</samp> and <samp>Y</samp>. Default zero.
 +
|-
 +
| <samp>SwimOffset</samp>
 +
| ''(Optional)'' A pixel offset to apply to the farm animal's sprite while it's swimming, specified as an object with <samp>X</samp> and <samp>Y</samp>. Default <samp>"X": 0, "Y": 112</samp>.
 +
|-
 +
| <samp>Skins</samp>
 +
| ''(Optional)'' A list of alternate appearances. If specified, a skin is chosen at random when the animal is purchased or hatched based on the <samp>Weight</samp> field. The default appearance (e.g. using <samp>Texture</samp>) is automatically an available skin with a weight of 1.
 +
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 
|-
 
|-
| 3
+
! field
| {{t|deluxe produce index}}
+
! effect
| The [[Modding:Object data|item ID]] for the [[Animals#Deluxe and Large Products|deluxe produce item]] (e.g. <tt>186</tt> is [[Large Milk]]).
   
|-
 
|-
| 4
+
| <samp>ID</samp>
| {{t|sound}}
+
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for the skin within the current list.
| The sound clip the animal uses (see [https://docs.google.com/spreadsheets/d/1CpDrw23peQiq-C7F2FjYOMePaYe0Rc9BwQsj3h6sjyo/edit#gid=239695361 soundbank IDs]).
   
|-
 
|-
| 5-12
+
| <samp>Weight</samp>
| {{t|bounding boxes}}
+
| ''(Optional)'' A multiplier for the probability to choose this skin when an animal is purchased. For example, <samp>2.0</samp> will double the chance this skin is selected relative to the other skins. Default <samp>1.0</samp>.
| Unused data. The front & back (5-8) and sideways (9-12) bounding boxes, in the form of <tt>x/y/width/height</tt>. Can be all zeroes.
   
|-
 
|-
| 13
+
| <samp>Texture</samp><br /><samp>HarvestedTexture</samp><br /><samp>BabyTexture</samp>
| {{t|harvest type}}
+
| ''(Optional)'' Overrides the equivalent main field when this skin is selected. Defaults to the main field's value.
| How the animal produces items. The possible values are <tt>0</tt> (lay like [[Chickens]]), <tt>1</tt> (grab with a [[tool]]), and <tt>2</tt> (unused - seen only on the Hog and sets name to "It"). [[Pigs]] have a {{t|harvest type}} of <tt>1</tt> and a {{t|harvest tool}} of <tt>null</tt>, but their [[Truffle]] finding capability is limited to animals that have a <tt>type</tt> that contains "Pig".
+
|}
 
|-
 
|-
| 14
+
| <samp>SleepFrame</samp>
| {{t|change texture when item ready}}
+
| ''(Optional)'' The sprite index in the texture to display when sleeping. Default 12.
| Whether the animal should use a secondary texture when you can harvest an item. Can be <tt>true</tt> or <tt>false</tt>. Must have a <tt>Sheared</tt> texture loaded such as <tt>Animals/ShearedSheep.xnb</tt>.
   
|-
 
|-
| 15
+
| <samp>UseDoubleUniqueAnimationFrames</samp>
| {{t|building type}}
+
| ''(Optional)'' Whether the texture has two frames for the randomized 'unique' animation instead of one. See [[#Spritesheet layout|spritesheet layout]] for more info. Default false.
| The [[Animals#Housing|building]] in which the animal can live. This must be a [[Modding:Blueprint data|blueprint type]], like <tt>Coop</tt> or <tt>Barn</tt>.
+
 
 +
The unique animation sprite indexes are:
 +
* If false: 13 (down), 14 (right), 12 (left if <samp>UseFlippedRightForLeft</samp> is false), and 15 (up).
 +
* If true: 16 (down), 18 (right), 22 (left), and 20 (up).
 +
|-
 +
| <samp>ShadowWhenBaby</samp><br /><samp>ShadowWhenBabySwims</samp><br /><samp>ShadowWhenAdult</samp><br /><samp>ShadowWhenAdultSwims</samp>
 +
| ''(Optional)'' The shadow to draw under the farm animal. The <samp>Baby</samp> fields only apply when the farm animal is a baby, and <samp>Adult</samp> fields only applies when it's an adult (e.g. a baby animal won't default to the adult fields). When the farm animal swims, it'll use the <samp>Swims</samp> variant if it's set, else default to the non-swim variant.
 +
 
 +
These consist of a model with these fields:
 +
 
 +
{| class="wikitable"
 
|-
 
|-
| 16-19
+
! field
| {{t|sprite size}}
+
! effect
| The front & back sprite (16-17) and sideways (18-19) sprite width/height in pixels. [[Coop]] animals such as [[Chickens]] are <tt>16/16</tt> and [[Barn]] animals such as [[Cows]] are <tt>32/32</tt>.
   
|-
 
|-
| 20
+
| <samp>Visible</samp>
| {{t|fullness drain}}
+
| ''(Optional)'' Whether the shadow should be drawn. Default true.
| The daily reduction in the animal's [[Animals#Food|fullness]] value.
   
|-
 
|-
| 21
+
| <samp>Offset</samp>
| {{t|happiness drain}}
+
| ''(Optional)'' A pixel offset applied to the shadow position, specified as an object with <samp>X</samp> and <samp>Y</samp> fields. Default zero.
| The daily reduction in the animal's [[Animals#Mood|happiness]] value.
   
|-
 
|-
| 22
+
| <samp>Scale</samp>
| {{t|harvest tool}}
+
| ''(Optional)'' The scale at which to draw the shadow. Default 2.5 (swimming baby), 3 (baby), 3.5 (swimming adult), or 4 (adult).
| Which [[tool]] is needed to harvest [[Animals#Produce|produce]] from animal with a {{t|harvest type}} of <tt>1</tt>. This can be <tt>null</tt> (no tool) or any [[tool]] such as <tt>Milk Pail</tt> or <tt>Shears</tt>.
+
|}
 +
|}
 +
 
 +
===Player profession effects===
 +
{| class="wikitable"
 
|-
 
|-
| 23
+
! field
| {{t|meat index}}
+
! effect
| Unused data. The [[Modding:Object data|item ID]] for the meat item when butchered. May be used by mods like {{Nexus mod|1538|Animal Husbandry}}.
   
|-
 
|-
| 24
+
| <samp>ProfessionForFasterProduce</samp>
| {{t|sell price}}
+
| ''(Optional)'' The internal ID of a [[Skills|profession]] which reduces the <samp>DaysToProduce</samp> by one. Default none.
| Affects the price when you [[Animals#Selling Animals|sell an animal]]. This has no effect on the price of animals in [[Marnie's Ranch]], which is set in the game code.
   
|-
 
|-
| 25
+
| <samp>ProfessionForHappinessBoost</samp>
| {{t|display type}}
+
| ''(Optional)'' The internal ID of a [[Skills|profession]] which makes it easier to befriend this animal. Default none.
| The translated animal name. Only used when not playing in English; English players will see the {{t|type}} value.
   
|-
 
|-
| 26
+
| <samp>ProfessionForQualityBoost</samp>
| {{t|display building}}
+
| ''(Optional)'' The internal ID of a [[Skills|profession]] which increases the chance of higher-quality produce. Default none.
| The translated building name. Only used when not playing in English; English players will see the {{t|building type}} value.
   
|}
 
|}
    +
===Behavior===
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>CanSwim</samp>
 +
| ''(Optional)'' Whether animals on the farm can swim in water once they've been pet. Default false.
 +
|-
 +
| <samp>BabiesFollowAdults</samp>
 +
| ''(Optional)'' Whether baby animals can follow nearby adults. Default false.
 +
|-
 +
| <samp>GrassEatAmount</samp>
 +
| ''(Optional)'' The amount of grass eaten by this animal each day. Setting it to <samp>0</samp> will disable the farm animal's hunger. Default 2.
 +
|-
 +
| <samp>HappinessDrain</samp>
 +
| ''(Optional)'' An amount which affects the daily reduction in happiness if the animal wasn't pet, or didn't have a heater in winter. Default none.
 +
|-
 +
| <samp>SellPrice</samp>
 +
| ''(Optional)'' The price when [[Animals#Selling Animals|the player sells the animal]], before it's adjusted for the animal's friendship towards the player. Default 0.
 +
 +
The actual sell price will be this value multiplied by a number between 0.3 (zero friendship) and 1.3 (max friendship).
 +
|-
 +
| <samp>CustomFields</samp>
 +
| The [[#Custom data fields|custom fields]] for this entry.
 +
|}
 +
 +
===Other===
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>ShowInSummitCredits</samp>
 +
| ''(Optional)'' Whether to show the farm animal in the credit scene on [[The Summit|the summit]] after the player achieves [[perfection]]. Default false.
 +
|-
 +
| <samp>StatToIncrementOnProduce</samp>
 +
| ''(Optional)'' The game stat counters to increment when the animal produces an item. Default none. This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>ID</samp>
 +
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the current list.
 +
|-
 +
| <samp>StatName</samp>
 +
| The name of the stat counter field on <samp>Game1.stats</samp>.
 +
|-
 +
| <samp>RequiredTags</samp>
 +
| ''(Optional)'' A comma-delimited list of [[Modding:Items#Context tags|context tags]] required on the main input item. The stat is only incremented if the item has ''all'' of these. You can negate a tag with <samp>!</samp> (like <code>bone_item,!fossil_item</code> for bone items that aren't fossils). Defaults to always enabled.
 +
|}
 +
|-
 +
| <samp>UpDownPetHitboxTileSize</samp><br /><samp>LeftRightPetHitboxTileSize</samp>
 +
| ''(Optional)'' The animal sprite's [[Modding:Modder Guide/Game Fundamentals#Tiles|tile]] size in the world when the player is clicking to pet them, specified in the form <samp>{{t|width}}, {{t|height}}</samp>. The <samp>UpDownPetHitboxTileSize</samp> applies when the animal is facing up or down, and <samp>LeftRightPetHitboxTileSize</samp> applies when facing left or right. The values can be fractional (''e.g.'' cows have a width of 1.75). Both default to a 1×1 tile.
 +
|-
 +
| <samp>BabyUpDownPetHitboxTileSize</samp><br /><samp>BabyLeftRightPetHitboxTileSize</samp>
 +
| ''(Optional)'' Overrides <samp>UpDownPetHitboxTileSize</samp> and <samp>LeftRightPetHitboxTileSize</samp> respectively before the animal is an adult. Both default to 1×1 tile.
 +
|}
 +
 +
==Spritesheet layout==
 +
===Explanation===
 +
Each farm animal's spritesheet must have exactly 4 columns, and at least 5–7 rows (depending on the data fields). The sprite size depends on the [[#Audio & sprite|<samp>SpriteWidth</samp> and <samp>SpriteHeight</samp>]] fields; for example, the default sprite width of 16 pixels means the spritesheet must be exactly 4 × 16 = 64 pixels wide.
 +
 +
The expected rows are:
 +
# move down;
 +
# move right;
 +
# move up;
 +
# move left ('''only''' if <samp>UseFlippedRightForLeft</samp> is false);
 +
# unique animations 1;
 +
# unique animations 2 ('''only''' if <samp>UseDoubleUniqueAnimationFrames</samp> is true);
 +
# eat.
 +
 +
For example, the default layout (with <samp>UseFlippedRightForLeft</samp> and <samp>UseDoubleUniqueAnimationFrames</samp> both false) is:
 +
{| class="wikitable"
 +
|-
 +
| 0 (move down 1)
 +
| 1 (move down 2)
 +
| 2 (move down 3)
 +
| 3 (move down 4)
 +
|-
 +
| 4 (move right 1)
 +
| 5 (move right 2)
 +
| 6 (move right 3)
 +
| 7 (move right 4)
 +
|-
 +
| 8 (move up)
 +
| 9 (move up)
 +
| 10 (move up)
 +
| 11 (move up)
 +
|-
 +
| 12 (''unused'')
 +
| 13 (unique down)
 +
| 14 (unique right)
 +
| 15 (unique up)
 +
|-
 +
| 16 (eat 1)
 +
| 17 (eat 1)
 +
| 18 (eat 1)
 +
| 19 (eat 1)
 +
|}
 +
 +
When both are true, that becomes:
 +
{| class="wikitable"
 +
|-
 +
| 0 (move down 1)
 +
| 1 (move down 2)
 +
| 2 (move down 3)
 +
| 3 (move down 4)
 +
|-
 +
| 4 (move right 1)
 +
| 5 (move right 2)
 +
| 6 (move right 3)
 +
| 7 (move right 4)
 +
|-
 +
| 8 (move up)
 +
| 9 (move up)
 +
| 10 (move up)
 +
| 11 (move up)
 +
|-
 +
| 12 (move left)
 +
| 13 (move left)
 +
| 14 (move left)
 +
| 15 (move left)
 +
|-
 +
| 16 (unique down 1)
 +
| 17 (unique down 2)
 +
| 18 (unique right 1)
 +
| 19 (unique right 2)
 +
|-
 +
| 20 (unique up 1)
 +
| 21 (unique up 2)
 +
| 22 (unique left 1)
 +
| 23 (unique left 2)
 +
|-
 +
| 24 (eat 1)
 +
| 25 (eat 1)
 +
| 26 (eat 1)
 +
| 27 (eat 1)
 +
|}
 +
 +
===Pre-1.6 vanilla layouts===
 +
Before Stardew Valley 1.6, there were two main spritesheet layouts depending on whether the animal lived in a [[barn]] or [[coop]]. If you want to match the previous spritesheet layouts (e.g. to update a pre-1.6 custom animal), the options to set are:
 +
<syntaxhighlight lang="js">
 +
// for barn animals
 +
"UseFlippedRightForLeft": true,
 +
"UseDoubleUniqueAnimationFrames": false
 +
 +
// for coop animals
 +
"UseFlippedRightForLeft": false,
 +
"UseDoubleUniqueAnimationFrames": true
 +
</syntaxhighlight>
 
[[Category:Modding]]
 
[[Category:Modding]]
    
[[ru:Модификации:Животные]]
 
[[ru:Модификации:Животные]]
translators
8,403

edits