Difference between revisions of "Modding:Farm data"

From Stardew Valley Wiki
Jump to navigation Jump to search
Line 26: Line 26:
  
 
==Farm Type==
 
==Farm Type==
TODO
+
To use a custom farm type, it must be added to the game by editing Data/AdditionalFarms. Each entry is an object with these fields:
 
+
{| class="wikitable"
===Localization===
+
|-
TODO
+
! field
 +
! description
 +
|-
 +
| <samp>ID</samp>
 +
| A unique ID value. This must be '''globally''' unique across all mods, so you should prefix your mod ID (''e.g.,'' <samp>Example.PineapplesAnywhere/PineappleFarm</samp>). You should avoid commas for compatibility with Content Patcher packs checking the <samp><nowiki>{{FarmType}}</nowiki></samp> token. This is not shown in-game. It should be the same as the key for this entry.
 +
|-
 +
| <samp>TooltipStringPath</samp>
 +
| Where to get the translatable farm name and description. This must be a key in the form <samp>{{t|asset name}}:{{t|key}}</samp>; for example, <samp>Strings/UI:Farm_Description</samp> will get it from the <samp>Farm_Description</samp> entry in the <samp>Strings/UI</samp> file. The translated text must be in the form "<samp>{{t|name}}_{{t|description}}</samp>", like "Pineapple Farm_A farm shaped like a pineapple".
 +
|-
 +
| <samp>MapName</samp>
 +
| The map asset name relative to the <samp>Maps</samp> folder. For example, <samp>Farm_Pineapple</samp> would load <samp>Maps/Farm_Pineapple</samp>.
 +
|-
 +
| <samp>IconTexture</samp>
 +
| ''(optional)'' The asset name for a 22x20 pixel icon texture, shown on the 'New Game' and co-op join screens.
 +
|-
 +
| <samp>WorldMapTexture</samp>
 +
| ''(optional)'' The asset name for a 131x61 pixel texture that's drawn over the farm area in the in-game world map.
 +
|-
 +
| <samp>ModData</samp>
 +
| ''(optional)'' A string→string dictionary of mod-specific metadata for the farm, which can be accessed in C# code via <samp>Game1.GetFarmTypeModData(key)</samp>.
 +
|}
  
 
==Location Data==
 
==Location Data==

Revision as of 20:57, 5 February 2024

Axe.png
Article Stub

This article is a stub and is missing information. You can help Stardew Valley Wiki by expanding it!

The following describes the upcoming Stardew Valley 1.6, and may change before release.

Index

This page explains how to create a custom farm type. It is an advanced guide for modders. Before reading this page, see Modding:Editing XNB files for the basic concepts.

Files to Edit

Creating a custom farm requires editing some files and adding new ones. However, you don't need any programming experience and it can be done with Content Patcher.

Farm Map

A map controls the general appearance and layout of your farm. Modding:Maps describes the basic process of creating a map. Copying and editing an existing farm map is recommended to avoid problems with missing information. The map must be added to the game files, and not replace an existing one.

Entry Properties

These map properties can change where a player enters the farm when arriving from other locations, such as the backwoods, bus stop, or forest.

Building Properties

These map properties can change where some objects are positioned by default, such as the greenhouse, farmhouse, or grandpa's shrine.

Farmhouse Interior

The starter interior layout of the farmhouse and cabins can be modified using these map properties on the farm.

Other Properties

These map properties can change other aspects of the farm, such as regenerating hardwood stumps or rock-spawning quarries.

Farm Type

To use a custom farm type, it must be added to the game by editing Data/AdditionalFarms. Each entry is an object with these fields:

field description
ID A unique ID value. This must be globally unique across all mods, so you should prefix your mod ID (e.g., Example.PineapplesAnywhere/PineappleFarm). You should avoid commas for compatibility with Content Patcher packs checking the {{FarmType}} token. This is not shown in-game. It should be the same as the key for this entry.
TooltipStringPath Where to get the translatable farm name and description. This must be a key in the form <asset name>:<key>; for example, Strings/UI:Farm_Description will get it from the Farm_Description entry in the Strings/UI file. The translated text must be in the form "<name>_<description>", like "Pineapple Farm_A farm shaped like a pineapple".
MapName The map asset name relative to the Maps folder. For example, Farm_Pineapple would load Maps/Farm_Pineapple.
IconTexture (optional) The asset name for a 22x20 pixel icon texture, shown on the 'New Game' and co-op join screens.
WorldMapTexture (optional) The asset name for a 131x61 pixel texture that's drawn over the farm area in the in-game world map.
ModData (optional) A string→string dictionary of mod-specific metadata for the farm, which can be accessed in C# code via Game1.GetFarmTypeModData(key).

Location Data

Data/Locations contains additional information about the game's locations. Each farm type has its own entry, identified by Farm_ followed by the unique ID of the farm type. This step is optional. If a farm layout does not have location data, the location data of the standard farm layout will be used.