Changes

Jump to navigation Jump to search
m
Text replacement - "tt>" to "samp>"
Line 7: Line 7:  
Testing is pretty straightforward for most mods:
 
Testing is pretty straightforward for most mods:
 
# Click ''Build > Rebuild Solution'' (Visual Studio) or ''Build > Rebuild All'' (MonoDevelop).
 
# Click ''Build > Rebuild Solution'' (Visual Studio) or ''Build > Rebuild All'' (MonoDevelop).
# Make sure there are no build errors and the mod gets copied to your <tt>Mods</tt> folder.
+
# Make sure there are no build errors and the mod gets copied to your <samp>Mods</samp> folder.
 
# Try the mod in-game.
 
# Try the mod in-game.
 
# Make sure there are no errors or warnings for your mod in the SMAPI console.
 
# Make sure there are no errors or warnings for your mod in the SMAPI console.
Line 62: Line 62:  
:# Install Stardew Valley through Steam.
 
:# Install Stardew Valley through Steam.
 
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Install SMAPI]].
 
:# [[Modding:Player Guide/Getting Started#Install SMAPI|Install SMAPI]].
:# ''(optional)'' Install [https://www.mono-project.com/ <tt>mono-complete</tt>] and [http://www.monodevelop.com/download/ MonoDevelop] in your VM. This is only needed if you want to compile separately for Linux/Mac. When installing <tt>.deb</tt> files, use the instructions for [https://zorinos.com/help/install-apps/#deb-files the Ubuntu version shown here]. If you run into errors, may Linux have mercy on your soul.
+
:# ''(optional)'' Install [https://www.mono-project.com/ <samp>mono-complete</samp>] and [http://www.monodevelop.com/download/ MonoDevelop] in your VM. This is only needed if you want to compile separately for Linux/Mac. When installing <samp>.deb</samp> files, use the instructions for [https://zorinos.com/help/install-apps/#deb-files the Ubuntu version shown here]. If you run into errors, may Linux have mercy on your soul.
 
:# ''(optional)'' For unlocking Mac OS only: [https://www.insanelymac.com/forum/files/file/838-unlocker/ Virtual Machine Unlocker 2.1.1] for VmWare Workstation 11/12/14, VmWare Player 7/12/14, or Fusion 7/8/10.  '''This is needed to boot Mac OS on a virtual Machine'''
 
:# ''(optional)'' For unlocking Mac OS only: [https://www.insanelymac.com/forum/files/file/838-unlocker/ Virtual Machine Unlocker 2.1.1] for VmWare Workstation 11/12/14, VmWare Player 7/12/14, or Fusion 7/8/10.  '''This is needed to boot Mac OS on a virtual Machine'''
   Line 78: Line 78:  
Sample warning: "''This implicitly converts '{0}' from Net{1} to {2}, but Net{1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.''"
 
Sample warning: "''This implicitly converts '{0}' from Net{1} to {2}, but Net{1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/avoid-implicit-net-field-cast for details.''"
   −
Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. This field has an equivalent non-net property, like <tt>monster.Health</tt> (<tt>int</tt>) instead of <tt>monster.health</tt> (<tt>NetBool</tt>). Change your code to use the suggested property instead.
+
Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. This field has an equivalent non-net property, like <samp>monster.Health</samp> (<samp>int</samp>) instead of <samp>monster.health</samp> (<samp>NetBool</samp>). Change your code to use the suggested property instead.
    
===FieldName is a Net* field...===
 
===FieldName is a Net* field...===
Line 85: Line 85:  
Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
 
Your code is referencing a [[Modding:Modder Guide/Game Fundamentals#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
 
<ul>
 
<ul>
<li>For a reference type (i.e. one that can contain <tt>null</tt>), you can use the <tt>.Value</tt> property (or <tt>.FieldDict</tt> for a <tt>NetDictionary</tt>):
+
<li>For a reference type (i.e. one that can contain <samp>null</samp>), you can use the <samp>.Value</samp> property (or <samp>.FieldDict</samp> for a <samp>NetDictionary</samp>):
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
if (building.indoors.Value == null)
 
if (building.indoors.Value == null)
Line 96: Line 96:  
   // ...
 
   // ...
 
</syntaxhighlight></li>
 
</syntaxhighlight></li>
<li>For a value type (i.e. one that can't contain <tt>null</tt>), check if the parent is null (if needed) and compare with <tt>.Value</tt>:
+
<li>For a value type (i.e. one that can't contain <samp>null</samp>), check if the parent is null (if needed) and compare with <samp>.Value</samp>:
 
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
 
if (item != null && item.category.Value == 0)
 
if (item != null && item.category.Value == 0)
105,560

edits

Navigation menu