Changes

Jump to navigation Jump to search
Line 2,825: Line 2,825:  
==What's new for locations & weather==
 
==What's new for locations & weather==
 
===Custom locations===
 
===Custom locations===
You can now add/edit locations by editing the revamped <samp>Data/Locations</samp> asset.
+
You can now add/edit locations by editing the revamped <samp>Data/Locations</samp> asset. This makes nearly everything in the location configurable — display name, default warp arrival tile, how the location is created, artifact spots / fish / forage / weeds, music, etc.
   −
====Location format====
+
See [[Modding:Location data]] for docs on the new data format.
The asset consists of a string → model lookup, where...
  −
* The key is the internal name of the location to change, which will also be used as the location's <samp>Name</samp> (not <samp>DisplayName</samp>) field. This should only contain alphanumeric/underscore/dot characters, and custom locations' names should be prefixed with your mod ID like <samp>Example.ModId_LocationName</samp>. (The farm will use <samp>Farm_{{t|type key}}</samp> for a vanilla farm type, or <samp>Farm_{{t|type ID}}</samp> for a custom farm type, or <samp>Farm_Standard</samp> if no type-specific entry was found.)
  −
* The value is a model with the fields listed below.
  −
 
  −
'''Basic info''':
  −
{| class="wikitable" style="margin-left: 2em;"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>DisplayName</samp>
  −
| ''(Optional but strongly recommended)'' A [[#Tokenizable string format|tokenizable string]] for the translated location name. This is used anytime the location name is shown in-game for base game logic or mods.
  −
|-
  −
| <samp>DefaultArrivalTile</samp>
  −
| ''(Optional but strongly recommended)'' The default tile position where the player should be placed when they arrive in the location, if arriving from a warp that didn't specify a tile position. Default none, which usually places the player at (0, 0).
  −
|-
  −
| <samp>ExcludeFromNpcPathfinding</samp>
  −
| ''(Optional)'' Whether NPCs should ignore this location when pathfinding between locations. Default false.
  −
|}
  −
 
  −
'''Creation''':
  −
{| class="wikitable" style="margin-left: 2em;"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>CreateOnLoad</samp>
  −
| ''(Optional)'' If set, the location will be created automatically when the save is loaded using this data.
  −
 
  −
This consists of a model with these fields:
  −
 
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>MapPath</samp>
  −
| The asset name for the map to use for this location.
  −
|-
  −
| <samp>AlwaysActive</samp>
  −
| ''(Optional)'' Whether this location is always synchronized to farmhands in multiplayer, even if they're not in the location. Any location which allows building cabins '''must''' have this enabled to avoid breaking game logic.
  −
|-
  −
| <samp>Type</samp>
  −
| ''(Optional)'' The full name of the C# location class to create. This must be one of the vanilla types to avoid a crash when saving. There are too many to list here, but the most useful types are likely <samp>StardewValley.GameLocation</samp> (default value) and <samp>StardewValley.Locations.DecoratableLocation</samp>.
  −
|}
  −
|}
  −
 
  −
'''Contents''':
  −
{| class="wikitable" style="margin-left: 2em;"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>ArtifactSpots</samp>
  −
| ''(Optional)'' The items that can be found when digging [[Artifact Spot|artifact spots]] in this location.
  −
 
  −
An artifact spot is selected by combining this field with the equivalent field on the <samp>Default</samp> entry, sorting by <samp>Precedence</samp> value, and then choosing the first entry whose fields match. (Artifact spot drops can also be listed in [[Modding:Items#Objects|<samp>Data/Objects</samp>]]'s <samp>Miscellaneous</samp> field; those are applied by the <samp>RANDOM_ARTIFACT_FOR_DIG_SPOT</samp> entry in <samp>DefaultArtifactSpots</samp>.)
  −
 
  −
This consists of a list of models with these fields:
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| ''common fields''
  −
| See [[#Item spawn fields|item spawn fields]] for the generic item fields supported by artifact spot drops.
  −
 
  −
If set to an [[#Item queries|item query]] which returns multiple items, one of them will be selected at random.
  −
|-
  −
| <samp>Chance</samp>
  −
| ''(Optional)'' The probability that the item will be dropped if the other fields match, as a decimal value between 0 (never) and 1 (always). Default 1.
  −
|-
  −
| <samp>ApplyGenerousEnchantment</samp>
  −
| ''(Optional)'' Whether to apply the 'Generous' [[Forge#Enchantments|enchantment]], which adds a 50% chance of the item dropping twice. If the enchantment is applied, the item's fields are rerolled for the second drop (e.g. a new random value between <samp>MinStack</samp> and <samp>MaxStack</samp> is selected). Default true.
  −
|-
  −
| <samp>OneDebrisPerDrop</samp>
  −
| ''(Optional)'' Whether to split the dropped item stack into multiple floating debris that each have a stack size of one. For example, if the dropped item has a stack size of 3, this will spawn three separate item stacks. Default true.
  −
|-
  −
| <samp>ContinueOnDrop</samp>
  −
| ''(Optional)'' Whether to continue checking for more items to drop when this item is dropped. Default false.
  −
|-
  −
| <samp>Precedence</samp>
  −
| ''(Optional)'' The order in which this entry should be checked, where lower values are checked first. This can be a negative value. Artifact spots with the same precedence are checked in the order listed. Default 0.
  −
 
  −
For consistency, vanilla artifact drops mostly use these values:
  −
* <samp>-1000</samp>: location items which should override the global priority items (e.g. fossils on Ginger Island);
  −
* <samp>-100</samp>: global priority items (e.g. Qi Beans);
  −
* <samp>0</samp>: normal items;
  −
* <samp>100</samp>: global fallback items (e.g. clay).
  −
|}
  −
 
  −
For example, a location with this field will drop 2-4 pufferfish with a 50% chance on summer days:
  −
<syntaxhighlight lang="js">
  −
"ArtifactSpots": [
  −
    {
  −
          "Condition": "LOCATION_SEASON Here summer",
  −
          "ItemId": "(O)128",
  −
          "MinStack": 2,
  −
          "MaxStack": 4
  −
    }
  −
]
  −
</syntaxhighlight>
  −
|-
  −
| <samp>FishAreas</samp>
  −
| ''(Optional)'' The distinct [[fishing]] areas within the location. These can be referenced by fish via <samp>FishAreaId</samp>, and determine which fish are collected by [[Crab Pot|crab pots]].
  −
 
  −
This consists of a string → model lookup, where the key is the fish area ID and the value consists of a list of models with these fields:
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>Position</samp>
  −
| ''(Optional)'' The tile position and size covered by this fishing area, specified as an object with <samp>X</samp>, <samp>Y</samp>, <samp>Width</samp>, and <samp>Height</samp> fields. This area will apply for crab pots placed within it, or when the fishing rod bobber lands within it. Default null (anywhere).
  −
 
  −
Areas with a <samp>Position</samp> value have priority over those without.
  −
|-
  −
| <samp>CrabPotFishTypes</samp>
  −
| ''(Optional)'' A list of fish types that can be caught by crab pots within the area. This is matched against field index 4 in [[Modding:Fish data|<samp>Data/Fish</samp>]] for 'trap' (i.e. crab pot) fish. The vanilla types are <samp>freshwater</samp> and <samp>ocean</samp>. If omitted, defaults to <samp>freshwater</samp>.
  −
|-
  −
| <samp>CrabPotJunkChance</samp>
  −
| ''(Optional)'' The chance that crab pots within the area will find junk instead of a fish each time they produce a harvest. This is ignored if the player has the [[Fishing#Fishing Skill|Mariner]] profession. Default <samp>0.2</samp> (20%).
  −
|}
  −
|-
  −
| <samp>Fish</samp>
  −
| ''(Optional)'' The fish that can be caught in the location.
  −
 
  −
A fish is selected by combining this field with the equivalent field on the <samp>Default</samp> entry, sorting by <samp>Precedence</samp> value (and randomly shuffling entries with the same precedence), and then choosing the first entry whose fields match.
  −
 
  −
Note: the produced item ID is saved to recreate the fish later. Any item info that's not based on the item ID is ignored (like stack size, quality, flavored variants like Blueberry Wine vs Wine, and the is-recipe flag).
  −
 
  −
This consists of a list of models with these fields:
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| ''common fields''
  −
| See [[#Item spawn fields|item spawn fields]] for the generic item fields supported by forage items.
  −
 
  −
This must return an <samp>Object</samp> item (or subclass of <samp>Object</samp>). If set to an [[#Item queries|item query]] which returns multiple items, one of them will be selected at random.
  −
|-
  −
| <samp>Chance</samp>
  −
| ''(Optional)'' The probability that the fish will spawn if selected, as a decimal value between 0 (never) and 1 (always). Default 1.
  −
|-
  −
| <samp>Season</samp>
  −
| ''(Optional)'' If set, the specific season when the fish can be caught. This is much more efficient than using <samp>Condition</samp>, but only supports a single season. Defaults to <samp>null</samp> (all seasons).
  −
|-
  −
| <samp>FishAreaId</samp>
  −
| ''(Optional)'' If set, the fish area in which the fish can be caught (as an area ID defined under <samp>FishAreas</samp>). Defaults to <samp>null</samp> (all zones).
  −
|-
  −
| <samp>BobberPosition</samp>
  −
| ''(Optional)'' If set, the tile area within the location where the fishing rod's bobber must land to catch the fish. Default <samp>null</samp> (anywhere).
  −
|-
  −
| <samp>PlayerPosition</samp>
  −
| ''(Optional)'' If set, the tile area within the location where the player must be standing to catch the fish. Default <samp>null</samp> (anywhere).
  −
|-
  −
| <samp>MinFishingLevel</samp>
  −
| ''(Optional)'' The minimum fishing level needed for the fish to appear. Default 0.
  −
|-
  −
| <samp>ApplyDailyLuck</samp>
  −
| ''(Optional)'' Whether to add the player's [[Luck|daily luck]] to the spawn chance. This affects both the <samp>Chance</samp> field and the <samp>Data\Fish</samp> chance, if applicable. Default false.
  −
|-
  −
| <samp>CuriosityLureBuff</samp>
  −
| ''(Optional)'' The value to add to the spawn chance when the player has the [[Curiosity Lure]] equipped, if set to 0 or higher. This affects both the <samp>Chance</samp> field and the <samp>Data\Fish</samp> chance, if applicable. Default -1, which keeps the default behavior (i.e. no effect on the <samp>Chance</samp> field and a scaled boost to the <samp>Data\Fish</samp> chance).
  −
|-
  −
| <samp>CatchLimit</samp>
  −
| ''(Optional)'' The maximum number of this fish which can be caught by each player. This limit is permanent (i.e. once it's reached, that fish will never appear again). For example, legendary fish set this to one. Default -1 (no limit).
  −
|-
  −
| <samp>IsBossFish</samp>
  −
| ''(Optional)'' Whether this is a 'boss fish' catch. This shows a crowned fish sprite in the fishing minigame and gives five times normal XP, like [[Legendary Fish|legendary fish]].
  −
|-
  −
| <samp>RequireMagicBait</samp>
  −
| ''(Optional)'' Whether the player must fish with Magic Bait for this fish to spawn. Default false.
  −
|-
  −
| <samp>MinDistanceFromShore</samp>
  −
| ''(Optional)'' The minimum distance from the nearest shore (measured in tiles) at which the fish can be caught, where zero is water directly adjacent to shore.
  −
|-
  −
| <samp>MaxDistanceFromShore</samp>
  −
| ''(Optional)'' The maximum distance from the nearest shore (measured in tiles) at which the fish can be caught, where zero is water directly adjacent to shore. Default -1 (no limit).
  −
|-
  −
| <samp>Precedence</samp>
  −
| ''(Optional)'' The order in which this entry should be checked, where lower values are checked first. This can be a negative value. Fish with the same precedence are shuffled randomly. Default 0.
  −
 
  −
For consistency, vanilla fish mostly use values in these ranges:
  −
* <samp>-1100</samp> to <samp>-1000</samp>: global priority items (e.g. Qi Beans);
  −
* <samp>-200</samp> to <samp>-100</samp>: unique location items (e.g. legendary fish or secret items);
  −
* <samp>-50</samp> to <samp>-1</samp>: normal high-priority items;
  −
* <samp>0</samp>: normal items;
  −
* <samp>1</samp> to <samp>100</samp>: normal low-priority items;
  −
* <samp>1000+</samp>: global fallback items (e.g. trash).
  −
|-
  −
| <samp>IgnoreFishDataRequirements</samp>
  −
| ''(Optional)'' Whether to ignore spawn requirements listed in [[Modding:Fish data|<samp>Data/Fish</samp>]], if applicable.
  −
 
  −
The <samp>Data/Fish</samp> requirements are ignored regardless of this field for non-object (<samp>(O)</samp>)-type items, or objects whose ID isn't listed in <samp>Data/Fish</samp>.
  −
|-
  −
| <samp>CanBeInherited</samp>
  −
| ''(Optional)'' Whether this fish can be spawned in another location via the <samp>LOCATION_FISH</samp> [[#Item queries|item query]]. Default true.
  −
|-
  −
| <samp>SetFlagOnCatch</samp>
  −
| ''(Optional)'' The mail flag to set for the current player when this fish is successfully caught. Default none.
  −
|-
  −
| <samp>ChanceModifiers</samp>
  −
| ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] applied to the <samp>Chance</samp> value. Default none.
  −
|-
  −
| <samp>ChanceModifierMode</samp>
  −
| ''(Optional)'' [[#Quantity modifiers|quantity modifier modes]] which indicate what to do if multiple modifiers in the <samp>ChanceModifiers</samp> field apply at the same time. Default <samp>Stack</samp>.
  −
|}
  −
|-
  −
| <samp>Forage</samp>
  −
| ''(Optional)'' The [[forage]] that can spawn in the location.
  −
 
  −
Notes:
  −
* Unlike other item spawn lists, these entries aren't checked sequentially. Instead, the game...
  −
*# combines this list with any forage in the <samp>Default</samp> location entry;
  −
*# adds every forage entry whose <samp>Condition</samp> and <samp>Season</samp> match to a spawn pool;
  −
*# chooses a random number of spawn ''opportunities'' (between 1 and 4);
  −
*# for each spawn opportunity, chooses a random tile position and forage to spawn. If the spawn fails (e.g. the tile is water/occupied or the forage's <samp>Chance</samp> doesn't pass), the game will make nine other attempts with a re-randomized tile & forage before skipping this spawn opportunity.
  −
* The stack size is ignored.
  −
 
  −
This consists of a list of models with these fields:
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| ''common fields''
  −
| See [[#Item spawn fields|item spawn fields]] for the generic item fields supported by forage items.
  −
 
  −
This must return an <samp>Object</samp> (<samp>(O)</samp>)-type item. If it uses an [[#Item queries|item query]] that returns multiple items, one will be selected at random. If it returns null or a non-<samp>Object</samp> item, the spawn attempt will be skipped (with a logged warning if the item type is invalid).
  −
|-
  −
| <samp>Chance</samp>
  −
| ''(Optional)'' The probability that the item will spawn if selected, as a decimal value between 0 (never) and 1 (always). Default 1.
  −
|-
  −
| <samp>Season</samp>
  −
| ''(Optional)'' The specific season when the forage should apply. This is more efficient than using <samp>Condition</samp>, but only supports a single season. Defaults to <samp>null</samp> (all seasons).
  −
|}
  −
|-
  −
| <samp>MinDailyWeeds</samp><br /><samp>MaxDailyWeeds</samp>
  −
| ''(Optional)'' The minimum and maximum number of weeds to spawn in a day, if applicable. Default 1 and 5 respectively.
  −
|-
  −
| <samp>FirstDayWeedMultiplier</samp>
  −
| ''(Optional)'' On the first day of each year, a multiplier to apply to the number of daily weeds spawned. Default 15.
  −
|-
  −
| <samp>MinDailyForageSpawn</samp><br /><samp>MaxDailyForageSpawn</samp>
  −
| ''(Optional)'' The minimum and maximum number of forage to try spawning in one day, if applicable and the location has fewer than <samp>MaxSpawnedForageAtOnce</samp> forage. Default 1 and 4 respectively.
  −
|-
  −
| <samp>MaxSpawnedForageAtOnce</samp>
  −
| ''(Optional)'' The maximum number of spawned forage that can be present at once on the map before they stop spawning. Default 6.
  −
|-
  −
| <samp>ChanceForClay</samp>
  −
| ''(Optional)'' The probability that digging a tile will produce clay, as a value between 0 (never) and 1 (always).
  −
|}
  −
 
  −
'''Music''':
  −
{| class="wikitable" style="margin-left: 2em;"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>Music</samp>
  −
| ''(Optional)'' The music to play when the player enters the location (subject to the other fields like <samp>MusicContext</samp>).
  −
 
  −
The first matching entry is used. If none match, falls back to <samp>MusicDefault</samp>.
  −
 
  −
This consists of a list of models with these fields:
  −
{| class="wikitable"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>Id</samp>
  −
| A key which uniquely identifies this entry within the list. The ID should only contain alphanumeric/underscore/dot characters. For custom entries for vanilla locations, this should be prefixed with your mod ID like <samp>Example.ModId_MusicId</samp>.
  −
|-
  −
| <samp>Condition</samp>
  −
| ''(Optional)'' A [[#Game state queries|game state query]] which indicates whether this entry applies. Default true.
  −
|-
  −
| <samp>Track</samp>
  −
| The [[#Custom audio|audio track ID]] to play.
  −
|}
  −
|-
  −
| <samp>MusicDefault</samp>
  −
| ''(Optional)'' The music to play if none of the options in <samp>Music</samp> matched. If this is null, falls back to the <samp>Music</samp> [[Modding:Maps|map property]] (if set).
  −
|-
  −
| <samp>MusicContext</samp>
  −
| ''(Optional)'' The music context for this location. The recommended values are <samp>Default</samp> or <samp>SubLocation</samp>. Default <samp>Default</samp>.
  −
 
  −
Setting <samp>SubLocation</samp> has two effects:
  −
* <samp>SubLocation</samp> has a lower priority than <samp>Default</samp>. In split-screen mode, that means if player A is at a location with a <samp>Default</samp> music context, and player B is a location with a <samp>SubLocation</samp> context, the game will choose player A's music.
  −
* When the player leaves a location with <samp>SubLocation</samp> music, the music will be stopped unless the new location has the same music and music context set.
  −
|-
  −
| <samp>MusicIgnoredInRain</samp>
  −
| ''(Optional)'' Whether the location music is ignored when it's raining in this location. Default false.
  −
|-
  −
| <samp>MusicIgnoredInSpring</samp><br /><samp>MusicIgnoredInSummer</samp><br /><samp>MusicIgnoredInFall</samp><br /><samp>MusicIgnoredInWinter</samp>
  −
| ''(Optional)'' Whether the location music is ignored in the given season. Default false.
  −
|-
  −
| <samp>MusicIgnoredInFallDebris</samp>
  −
| ''(Optional)'' Whether the location music is ignored in fall during windy weather. Default false.
  −
|-
  −
| <samp>MusicIsTownTheme</samp>
  −
| ''(Optional)'' Whether to use the same behavior as [[Pelican Town]]'s music: it will start playing after the day music has finished, and will continue playing while the player travels through indoor areas, but will stop when entering another outdoor area that isn't marked with the same <samp>Music</samp> and <samp>MusicIsTownTheme</samp> values. Default false.
  −
|}
  −
 
  −
'''Advanced''':
  −
{| class="wikitable" style="margin-left: 2em;"
  −
|-
  −
! field
  −
! effect
  −
|-
  −
| <samp>CustomFields</samp>
  −
| The [[#Custom data fields|custom fields]] for this entry.
  −
|}
  −
 
  −
====<samp>Default</samp> entry====
  −
The asset has a location with the key <samp>Default</samp>. The <samp>ArtifactSpots</samp>, <samp>Fish</samp>, and <samp>Forage</samp> fields for this entry are added to every other location's equivalent fields, so this lets you add artifact spots / fish / forage in all locations.
      
===Custom location contexts===
 
===Custom location contexts===
translators
8,445

edits

Navigation menu