Changes

→‎What's new architecturally?: add 'unique string IDs' section
Line 121: Line 121:     
In Stardew Valley 1.6, you can now rewrite that code like <code>DataLoader.PassiveFestivals(Game1.content)</code>. That's simpler, you can't use the wrong asset name or type, and it's more future-proof in case the game changes them.
 
In Stardew Valley 1.6, you can now rewrite that code like <code>DataLoader.PassiveFestivals(Game1.content)</code>. That's simpler, you can't use the wrong asset name or type, and it's more future-proof in case the game changes them.
 +
 +
===Unique string IDs===
 +
: ''Main article: [[Modding:Common data field types#Unique string ID]].''
 +
 +
Stardew Valley now uses ''unique string IDs'' throughout the code to identify data (like events, locations, items, NPCs, etc). For example, <code>Town</code> is the unique ID for the [[Pelican Town]] location; no other location can use that ID. The IDs are used for a wide range of purposes, from internal game logic to [[Modding:Content Patcher|content pack edits]].
 +
 +
For mods, it's '''strongly recommended''' to...
 +
* Use namespaced IDs prefixed with your [[Modding:Modder Guide/APIs/Manifest#Basic fields|mod's unique ID]] for all new content. For example, if your mod ID is <code>Example.PufferchickMod</code> and you're adding a pufferchick plushy, your item ID would look like <code>Example.PufferchickMod_PufferchickPlushy</code>. In a [[Modding:Content Patcher|Content Patcher pack]], you can use <code><nowiki>{{ModId}}_PufferchickPlushy</nowiki></code> to insert your mod ID automatically. This eliminates ID conflicts between mods, and makes it easy (for both troubleshooters and mod code) to identify which mod added a particular content. See [[Modding:Common data field types#Unique string ID|the new format docs]] for the recommended format.
 +
* Only use alphanumeric (a–z, A–Z, 0–9), underscore (<code>_</code>), and dot (<code>.</code>) characters in string IDs. This is important because they're often used in places where some characters have special meaning (like file names or [[#Game state query|game state queries]]).
    
==What's new for items==
 
==What's new for items==
translators
8,403

edits