Changes

Jump to navigation Jump to search
m
Text replacement - "(e.g. " to "(''e.g.'', "
Line 96: Line 96:     
===Send messages===
 
===Send messages===
You can send a message to mods on all connected computers (including the current one) using the <samp>SendMessage</samp> method. The destination can range from very narrow (e.g. one mod on one connected computer) to very broad (all mods on all computers). The message won't be sent back to the mod instance that sent it, but it can be sent to the same mod on other computers.
+
You can send a message to mods on all connected computers (including the current one) using the <samp>SendMessage</samp> method. The destination can range from very narrow (''e.g.'', one mod on one connected computer) to very broad (all mods on all computers). The message won't be sent back to the mod instance that sent it, but it can be sent to the same mod on other computers.
    
When sending a message, you must specify three things:
 
When sending a message, you must specify three things:
Line 137: Line 137:     
==Per-screen data==
 
==Per-screen data==
[[Multiplayer|Split-screen multiplayer]] swaps the entire game state between each player, so each mod runs across every player. For example, with four local players the [[Modding:Modder Guide/APIs/Events#GameLoop.UpdateTicked|<samp>UpdateTicked</samp>]] event would be raised four times per tick. The game manages its own state automatically (e.g. <samp>Game1.activeClickableMenu</samp>), but if your mod stores info in its own fields you may need to handle those yourself.
+
[[Multiplayer|Split-screen multiplayer]] swaps the entire game state between each player, so each mod runs across every player. For example, with four local players the [[Modding:Modder Guide/APIs/Events#GameLoop.UpdateTicked|<samp>UpdateTicked</samp>]] event would be raised four times per tick. The game manages its own state automatically (''e.g.'', <samp>Game1.activeClickableMenu</samp>), but if your mod stores info in its own fields you may need to handle those yourself.
    
SMAPI provides <code>PerScreen&lt;T&gt;</code> to make that easy. You use it by creating '''readonly''' fields for your values (which can be any value from <samp>int</samp> to entire class instances):
 
SMAPI provides <code>PerScreen&lt;T&gt;</code> to make that easy. You use it by creating '''readonly''' fields for your values (which can be any value from <samp>int</samp> to entire class instances):
107,190

edits

Navigation menu