Changes

Jump to navigation Jump to search
→‎Events (SMAPI 3.0): + multiplayer events
Line 491: Line 491:  
  |arg type 3 = <tt>int</tt>
 
  |arg type 3 = <tt>int</tt>
 
  |arg desc 3 = The previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead.
 
  |arg desc 3 = The previous and current scroll value, cumulative since the game started. Mods should generally use <tt>e.Delta</tt> instead.
 +
}}
 +
|}
 +
 +
===Multiplayer===
 +
<tt>this.Helper.Events.Multiplayer</tt> has events raised for multiplayer messages and connections.
 +
 +
{| class="wikitable"
 +
|-
 +
! event
 +
! summary
 +
{{/event
 +
|group = Multiplayer
 +
|name  = ModMessageReceived
 +
|desc  = Raised after [[Modding:Modder Guide/APIs/Multiplayer#Send message|a mod message]] is received over the network.
 +
 +
|arg name 1 = <tt>e.FromPlayerID</tt>
 +
|arg type 1 = <tt>long</tt>
 +
|arg desc 1 = The unique ID of the player from whose computer the message was sent.
 +
 +
|arg name 2 = <tt>e.FromModID</tt>
 +
|arg type 2 = <tt>string</tt>
 +
|arg desc 2 = The unique ID of the mod which sent the message.
 +
 +
|arg name 3 = <tt>e.Type</tt>
 +
|arg type 3 = <tt>string</tt>
 +
|arg desc 3 = A message type which you can use to decide whether it's the one you want to handle. This isn't necessarily globally unique, so you should also check the <tt>FromModID</tt> field.
 +
 +
|arg name 4 = <tt>e.ReadAs&lt;TModel&gt;()</tt>
 +
|arg type 4 = ''method'' returns <tt>TModel</tt>
 +
|arg desc 4 = Read the underlying message data into the given model type (like <code>e.ReadAs&lt;MyMessageClass&gt;()</code> or <code>e.ReadAs&lt;string&gt;()</code>). This will return a new instance each time.
 
}}
 
}}
 
|}
 
|}
translators
8,441

edits

Navigation menu