Changes

m
Line 15: Line 15:  
* <samp>Context.IsMultiplayer</samp> returns true for split-screen multiplayer. You can use more specific fields like <samp>IsSplitScreen</samp>, <samp>HasRemotePlayers</samp>, or <samp>IsOnHostComputer</samp> if needed.
 
* <samp>Context.IsMultiplayer</samp> returns true for split-screen multiplayer. You can use more specific fields like <samp>IsSplitScreen</samp>, <samp>HasRemotePlayers</samp>, or <samp>IsOnHostComputer</samp> if needed.
   −
===Custom item data===
+
===Custom mod data===
 
Each <samp>Character</samp>, <samp>GameLocation</samp>, <samp>Item</samp>, and <samp>TerrainFeature</samp> instance now has a <samp>modData</samp> dictionary field, which is persisted to the save file and synchronized in multiplayer. This can be used to store arbitrary mod data, including on the player itself via <samp>Game1.player.modData</samp>.
 
Each <samp>Character</samp>, <samp>GameLocation</samp>, <samp>Item</samp>, and <samp>TerrainFeature</samp> instance now has a <samp>modData</samp> dictionary field, which is persisted to the save file and synchronized in multiplayer. This can be used to store arbitrary mod data, including on the player itself via <samp>Game1.player.modData</samp>.
   −
When you split an item stack, the new stack copies the previous one's mod data; when merged into another stack, the merged items adopt the target stack's mod data. Otherwise mod data has no effect on item split/merge logic (e.g. you can still merge items with different mod data), unless overridden by a Harmony patch.
+
When you split an item stack, the new stack copies the previous one's mod data; when merged into another stack, the merged items adopt the target stack's mod data. Otherwise mod data has no effect on item split/merge logic (''e.g.,'' you can still merge items with different mod data), unless overridden by a Harmony patch.
    
'''Note:''' to avoid mod conflicts, prefixing data fields with your mod ID is strongly recommended:
 
'''Note:''' to avoid mod conflicts, prefixing data fields with your mod ID is strongly recommended:
Line 42: Line 42:  
:* code which only uses tile coordinates (not pixel coordinates).
 
:* code which only uses tile coordinates (not pixel coordinates).
   −
: You can test your mod by setting the zoom to maximum and the UI scale to minimum (i.e. have them at different values) or vice versa; in particular check any logic which handles pixel positions, like menus clicking. If everything looks fine, you can skip the rest of this section.
+
: You can test your mod by setting the zoom to maximum and the UI scale to minimum (''i.e.,'' have them at different values) or vice versa; in particular check any logic which handles pixel positions, like menus clicking. If everything looks fine, you can skip the rest of this section.
    
; What does this mean for affected mods?
 
; What does this mean for affected mods?
Line 55: Line 55:  
; How do I update affected code?
 
; How do I update affected code?
   −
:* Drawing something into the game world (e.g. a tile overlay) in UI mode will make things much more difficult. Consider drawing outside UI mode instead, ''e.g.'',by switching from SMAPI's <samp>Rendered</samp> event to <samp>RenderedWorld</samp>.
+
:* Drawing something into the game world (''e.g.,'' a tile overlay) in UI mode will make things much more difficult. Consider drawing outside UI mode instead, ''e.g.,'' by switching from SMAPI's <samp>Rendered</samp> event to <samp>RenderedWorld</samp>.
 
:* Be very careful about mixed coordinate systems. For example, a menu constructed outside the draw loop may initialize coordinates in non-UI mode, then handle clicks in UI mode. You may need to convert values to non-UI coordinates to check them in that case (see conversions below).
 
:* Be very careful about mixed coordinate systems. For example, a menu constructed outside the draw loop may initialize coordinates in non-UI mode, then handle clicks in UI mode. You may need to convert values to non-UI coordinates to check them in that case (see conversions below).
 
:* When drawing UI, in most cases you should replace <samp>Game1.viewport</samp> with <samp>Game1.uiViewport</samp>. These provide UI-adjusted pixel positions. '''Don't''' do this if you'll be adjusting the positions for UI scaling separately (see below), since double-conversion will give you incorrect results.
 
:* When drawing UI, in most cases you should replace <samp>Game1.viewport</samp> with <samp>Game1.uiViewport</samp>. These provide UI-adjusted pixel positions. '''Don't''' do this if you'll be adjusting the positions for UI scaling separately (see below), since double-conversion will give you incorrect results.
Line 86: Line 86:     
The feature is based on two files:
 
The feature is based on two files:
* <samp>Data/PaintData</samp> lists the buildings which can be painted, the group names shown in the UI, and the relative ranges for the brightness slider. More info from the game developers: {{quote|To explain: the hue and saturation values are applied as is, but the brightness value is actually tracked as a "relative" brightness, i.e. a value halfway through the slider bar actually corresponds to a value that's lerped halfway between the lowest acceptable brightness and highest acceptable brightness.
+
* <samp>Data/PaintData</samp> lists the buildings which can be painted, the group names shown in the UI, and the relative ranges for the brightness slider. More info from the game developers: {{quote|To explain: the hue and saturation values are applied as is, but the brightness value is actually tracked as a "relative" brightness, ''i.e.,'' a value halfway through the slider bar actually corresponds to a value that's lerped halfway between the lowest acceptable brightness and highest acceptable brightness.
    
This is so that a single paint color will look generally the same when applied across multiple buildings, and is also used to ensure brightness values that are overbright or too dark aren't usable as they generally look bad. This is also used to prevent values that shade in weird ways.}}
 
This is so that a single paint color will look generally the same when applied across multiple buildings, and is also used to ensure brightness values that are overbright or too dark aren't usable as they generally look bad. This is also used to prevent values that shade in weird ways.}}
* Each paintable building also has a separate mask texture, like <samp>Buildings/Stable_PaintMask</samp> for the stable. The masks use three predefined colors: green (roof), blue (trim), and red (walls) matching the order in <samp>Data/PaintData</samp> (other colors are ignored). Groups don't need to be contiguous (e.g. you can have separate red areas).  
+
* Each paintable building also has a separate mask texture, like <samp>Buildings/Stable_PaintMask</samp> for the stable. The masks use three predefined colors: green (roof), blue (trim), and red (walls) matching the order in <samp>Data/PaintData</samp> (other colors are ignored). Groups don't need to be contiguous (''e.g.,'' you can have separate red areas).  
    
===Other breaking changes===
 
===Other breaking changes===
Line 160: Line 160:  
** <samp>ordersboard</samp>: show the special orders board.
 
** <samp>ordersboard</samp>: show the special orders board.
 
** <samp>pathspousetome</samp> / <samp>pstm</samp>: warp or path the player's spouse spouse to the player.
 
** <samp>pathspousetome</samp> / <samp>pstm</samp>: warp or path the player's spouse spouse to the player.
** <samp>perfection</samp>: makes changes needed for 100% game completion (e.g. max all friendships, mark all fish caught, etc).
+
** <samp>perfection</samp>: makes changes needed for 100% game completion (''e.g.,'' max all friendships, mark all fish caught, etc).
 
** <samp>pgb</samp>: prints the solution to the island gem bird shrine puzzle.
 
** <samp>pgb</samp>: prints the solution to the island gem bird shrine puzzle.
 
** <samp>phone</samp>: show the telephone menu.
 
** <samp>phone</samp>: show the telephone menu.
Line 191: Line 191:     
* See ''[[#Update impact|update impact]]'' below.
 
* See ''[[#Update impact|update impact]]'' below.
 +
 +
===Home renovations===
 +
Stardew Valley 1.5 adds [[Carpenter's Shop#House Renovations|house renovations]]. Mods can add or change removations by editing the <samp>Data/HomeRenovations</samp> asset. This consists of a string → model lookup, where the asset key is a unique renovation ID. The asset value is a model with these fields:
 +
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>TextStrings</samp>
 +
| A translation key in the form <samp>{{t|asset name}}:{{t|key}}</samp> (like <samp>Strings\\Locations:ScienceHouse_Renovation_BuildCrib</samp>). The translation text should contain three slash-delimited fields:
 +
{| class="wikitable"
 +
|-
 +
! index
 +
! effect
 +
|-
 +
| 0
 +
| The translated display name shown in the renovation menu.
 +
|-
 +
| 1
 +
| The translated description shown in the renovation menu.
 +
|-
 +
| 2
 +
| The message shown to ask the player which area to renovate.
 +
|}
 +
For example, the vanilla 'remove crib' matches a translation in this format:
 +
<pre>"Remove Crib/Remove the crib from your home./Select a crib to remove."</pre>
 +
|-
 +
| <samp>Requirements</samp>
 +
| The criteria that must match for the renovation to appear as an option. This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Type</samp>
 +
| The requirement type. This can be <samp>Mail</samp> (check if the player has the given [[Modding:Mail data#Mail flags|mail flag]]) or <samp>Value</samp> (check the value of a C# <samp>NetInt</samp> field on the farmhouse instance). Any other type always returns true.
 +
|-
 +
| <samp>Key</samp>
 +
| &#32;
 +
* For a <samp>Mail</samp> requirement, the mail flag.
 +
* For a <samp>Value</samp> requirement, the C# <samp>NetInt</samp> field name.
 +
|-
 +
| <samp>Value</samp>
 +
| &#32;
 +
* For a <samp>Mail</samp> requirement, <samp>"0"</samp> (player must ''not'' have the flag) or <samp>"1"</samp> (player must have it).
 +
* For a <samp>Value</samp> requirement, the required field value. The value can be prefixed with <samp>!</samp> to require any value ''except'' this one.
 +
|}
 +
 +
For example, <code>"Key": "renovation_bedroom_open", "Value": "1"</code> matches if the player has the <samp>renovation_bedroom_open</samp> mail flag.
 +
|-
 +
| <samp>RenovateActions</samp>
 +
| The actions to perform after the renovation is applied. This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Type</samp>
 +
| The action type. This can be <samp>Mail</samp> (add or remove a [[Modding:Mail data#Mail flags|mail flag]]) or <samp>Value</samp> (set the value of a C# field on the farmhouse instance). Any other type is ignored.
 +
|-
 +
| <samp>Key</samp>
 +
| &#32;
 +
* For a <samp>Mail</samp> requirement, the mail flag to add or remove.
 +
* For a <samp>Value</samp> requirement, the C# <samp>NetInt</samp> field name.
 +
|-
 +
| <samp>Value</samp>
 +
| &#32;
 +
* For a <samp>Mail</samp> requirement, either <samp>"0"</samp> (remove the mail flag) or <samp>"1"</samp> (add it).
 +
* For a <samp>Value</samp> requirement, either the integer value to set, or the exact string <samp>"selected"</samp> to set it to the index of the applied renovation.
 +
|}
 +
|-
 +
| <samp>RectGroups</samp>
 +
| The tile areas within the farmhouse where the renovation can be placed.
 +
|-
 +
| <samp>AnimationType</samp>
 +
| ''(Optional)'' The animation to play when the renovation is applied. The possible values are <samp>destroy</samp> or <samp>build</samp>. Any other value defaults to <samp>build</samp>.
 +
|-
 +
| <samp>CheckForObstructions</samp>
 +
| ''(Optional)'' Whether to prevent the player from applying the renovations if there are any players, NPCs, items, etc within the target area. Default false.
 +
|-
 +
| <samp>SpecialRect</samp>
 +
| ''(Optional)'' A dynamic area to add to the <samp>RectGroups</samp> field. The only supported value is <samp>crib</samp>, which is the farmhouse area containing the cribs.
 +
|}
 +
 +
For example, this content pack redefines one of the vanilla home renovations:
 +
 +
{{#tag:syntaxhighlight|<nowiki>
 +
{
 +
    "Format": "</nowiki>{{Content Patcher version}}<nowiki>",
 +
    "Changes": [
 +
        {
 +
            "Action": "EditData",
 +
            "Target": "Data/HomeRenovations",
 +
            "Entries": {
 +
                "open_bedroom": {
 +
                    "TextStrings": "Strings\\Locations:ScienceHouse_Renovation_OpenBedroom",
 +
                    "AnimationType": "destroy",
 +
                    "CheckForObstructions": true,
 +
                    "Requirements": [
 +
                        {
 +
                            "Type": "Mail",
 +
                            "Key": "renovation_bedroom_open",
 +
                            "Value": "0"
 +
                        }
 +
                    ],
 +
                    "RenovateActions": [
 +
                        {
 +
                            "Type": "Mail",
 +
                            "Key": "renovation_bedroom_open",
 +
                            "Value": "1"
 +
                        }
 +
                    ],
 +
                    "RectGroups": [
 +
                        {
 +
                            "Rects": [
 +
                                { "X": 21, "Y": 10, "Width": 2, "Height": 8 },
 +
                                { "X": 21, "Y": 19, "Width": 2, "Height": 1 }
 +
                            ]
 +
                        }
 +
                    ]
 +
                }
 +
        }
 +
    ]
 +
}</nowiki>|lang=javascript}}
    
===Special orders===
 
===Special orders===
Line 264: Line 389:  
* For indoor locations:
 
* For indoor locations:
 
** <samp>ForceSpawnForageables</samp>: causes forage to spawn in the location.
 
** <samp>ForceSpawnForageables</samp>: causes forage to spawn in the location.
** <samp>indoorWater</samp>: enables water tiles in the location (e.g. for fishing).
+
** <samp>indoorWater</samp>: enables water tiles in the location (''e.g.,'' for fishing).
 
* For all locations:
 
* For all locations:
 
** <samp>CanCaskHere</samp>: if set to any value, casks will work in this location regardless of whether it's a cellar.
 
** <samp>CanCaskHere</samp>: if set to any value, casks will work in this location regardless of whether it's a cellar.
Line 272: Line 397:  
** <samp>skipWeedGrowth</samp>: skip spawning/spreading weeds in this location.
 
** <samp>skipWeedGrowth</samp>: skip spawning/spreading weeds in this location.
   −
The various tiles/properties that accompany these features (e.g. door tiles, mailbox tile action, etc) still need to be added to the map file. These aren't added/moved automatically by the map properties.
+
The various tiles/properties that accompany these features (''e.g.,'' door tiles, mailbox tile action, etc) still need to be added to the map file. These aren't added/moved automatically by the map properties.
    
===Greenhouse building===
 
===Greenhouse building===
Line 306: Line 431:     
===Sitting on non-furniture chairs===
 
===Sitting on non-furniture chairs===
 +
{{main article|Modding:Maps#Sitting on non-furniture chairs}}
 +
 
Players can sit on chairs that are part of the map. This works by checking the tile on the <samp>Buildings</samp> layer, and comparing its tilesheet and tilesheet index to the data in <samp>Data\ChairTiles</samp>.
 
Players can sit on chairs that are part of the map. This works by checking the tile on the <samp>Buildings</samp> layer, and comparing its tilesheet and tilesheet index to the data in <samp>Data\ChairTiles</samp>.
   Line 407: Line 534:  
** <samp>Back</samp> > <samp>NoPath</samp>: prevent NPCs from pathing through the tile;
 
** <samp>Back</samp> > <samp>NoPath</samp>: prevent NPCs from pathing through the tile;
 
** <samp>Buildings</samp> > <samp>NPCPassable</samp>: equivalent to <samp>Passable</samp>, but only for NPCs;
 
** <samp>Buildings</samp> > <samp>NPCPassable</samp>: equivalent to <samp>Passable</samp>, but only for NPCs;
** <samp>Buildings > ProjectilePassable</samp>: allows projectiles to cross tiles that would normally block them (e.g. to allow shooting into lava pools).
+
** <samp>Buildings > ProjectilePassable</samp>: allows projectiles to cross tiles that would normally block them (''e.g.,'' to allow shooting into lava pools).
    
===Update impact===
 
===Update impact===
translators
8,404

edits