Changes

Jump to navigation Jump to search
update links
Line 156: Line 156:     
===This implicitly converts...===
 
===This implicitly converts...===
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/package/avoid-implicit-net-field-cast for details.''"
    
Your code is referencing a [[#Net fields|net field]], which can cause subtle bugs. The field you're referencing 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 [[#Net fields|net field]], which can cause subtle bugs. The field you're referencing 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.
    
===FieldName is a Net* field...===
 
===FieldName is a Net* field...===
Sample warning: "'''{0}' is a Net{1} field; consider using the {2} property instead. See https://smapi.io/buildmsg/avoid-net-field for details.''"
+
Sample warning: "'''{0}' is a Net{1} field; consider using the {2} property instead. See https://smapi.io/package/avoid-net-field for details.''"
    
Your code is referencing a [[#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
 
Your code is referencing a [[#Net fields|net field]], which can cause subtle bugs. You should access the underlying value instead:
Line 183: Line 183:     
===The FieldName field is obsolete...===
 
===The FieldName field is obsolete...===
Sample warning: "''The 'Character.friendships' field is obsolete and should be replaced with 'friendshipData'. See https://smapi.io/buildmsg/avoid-obsolete-field for details.''"
+
Sample warning: "''The 'Character.friendships' field is obsolete and should be replaced with 'friendshipData'. See https://smapi.io/package/avoid-obsolete-field for details.''"
    
You're referencing a field which should no longer be used. Use the suggested field name instead to fix it.
 
You're referencing a field which should no longer be used. Use the suggested field name instead to fix it.
Line 204: Line 204:     
===Why not use implicit net field conversion?===
 
===Why not use implicit net field conversion?===
The migration guide suggests [[#Net fields|avoiding net field implicit conversion]]. This may be the most tedious part of the migration for many mods, and the code compiles fine without doing that, so it's tempting to just skip this step. That's not recommended. Although net field conversions will work fine in most cases, their conversion rules can cause strange bugs in unexpected places. It's better to avoid it altogether, rather than learn all the different cases where they'll cause problems. If you really want, you can [https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#code-warnings disable the build warnings] and decide for yourself when to use the implicit conversion.
+
The migration guide suggests [[#Net fields|avoiding net field implicit conversion]]. This may be the most tedious part of the migration for many mods, and the code compiles fine without doing that, so it's tempting to just skip this step. That's not recommended. Although net field conversions will work fine in most cases, their conversion rules can cause strange bugs in unexpected places. It's better to avoid it altogether, rather than learn all the different cases where they'll cause problems. If you really want, you can [https://smapi.io/package/code-warnings disable the build warnings] and decide for yourself when to use the implicit conversion.
    
[[Category:Modding]]
 
[[Category:Modding]]
translators
8,404

edits

Navigation menu