Changes

Jump to navigation Jump to search
remove {{upcoming|1.6}}
Line 148: Line 148:     
: You can test whether your mod accounts for this correctly by setting the zoom to maximum and the UI scale to minimum (''i.e.,'' have them at opposite values) or vice versa; in particular check any logic which handles pixel positions, like menus clicking.
 
: You can test whether your mod accounts for this correctly by setting the zoom to maximum and the UI scale to minimum (''i.e.,'' have them at opposite values) or vice versa; in particular check any logic which handles pixel positions, like menus clicking.
  −
===Unique string IDs===
  −
{{upcoming|1.6}}
  −
  −
The game identifies data using unique string IDs. 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]].
  −
  −
Best practices for mods:
  −
* Use namespaced IDs prefixed with your [[Modding:Modder Guide/APIs/Manifest#Basic fields|mod's unique ID]]. 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>. Although the game doesn't validate the ID format, you're '''strongly encouraged''' to use this exact format to maintain good mod compatibility, avoid ID conflicts, and allow automatically determining which mod added custom content.
  −
* 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 [[Modding:Game state queries|game state queries]]).
      
==Multiplayer concepts for C# mods==
 
==Multiplayer concepts for C# mods==
Line 189: Line 180:  
* When a farmhand warps to a location, the game fetches the real location from the host player before the warp completes. For a short while, the farmhand may have a null <samp>currentLocation</samp> field while they're between locations.
 
* When a farmhand warps to a location, the game fetches the real location from the host player before the warp completes. For a short while, the farmhand may have a null <samp>currentLocation</samp> field while they're between locations.
   −
<br />{{upcoming|1.6|You can check whether a location is active using its <samp>IsActiveLocation</samp> method:
+
You can check whether a location is active using its <samp>IsActiveLocation</samp> method:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
foreach (GameLocation location in Game1.locations)
 
foreach (GameLocation location in Game1.locations)
Line 199: Line 190:  
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
}}
  −
  −
==Assets==
  −
===String keys===
  −
A ''string key'' uniquely identifies where to find translatable text, in the form <samp>{{t|asset name}}:{{t|key}}</samp>. For example, <code>Game1.content.LoadString("Strings\\StringsFromCSFiles:spring")</code> will look for a <samp>spring</samp> key in the <samp>Strings\StringsFromCSFiles</samp> file in the content folder (which contains "spring"). This is commonly used in the game code (via <code>Game1.content.LoadString</code>) and in data assets which need translatable text.
      
==Main classes==
 
==Main classes==
translators
8,446

edits

Navigation menu