Changes

Jump to navigation Jump to search
→‎Multiplayer: expand PeerContextReceived to mention contextual fields not being set yet for farmhands
Line 309: Line 309:  
  |group = Multiplayer
 
  |group = Multiplayer
 
  |name  = PeerContextReceived
 
  |name  = PeerContextReceived
  |desc  = Raised after the mod context for a player is received. The event is raised for any player (whether host or farmhand), including when the connecting player doesn't have SMAPI installed. This happens before the game approves the connection, so the player does not yet exist in the game. This is the earliest point where messages can be sent to the player via SMAPI.
+
  |desc  = Raised after the mod context for a player is received. The event is raised for any player (whether host or farmhand), including when the connecting player doesn't have SMAPI installed. This is the earliest point where messages can be sent to the player via SMAPI.
 +
 
 +
This happens before the game approves the connection, so the player doesn't exist in the game yet. When connecting to the host, contextual fields like <tt>Game1.IsMasterGame</tt> or <tt>Context.IsMultiplayer</tt> may not be set yet; you can check <tt>e.Peer.IsHost</tt> to know whether the current player is a farmhand, since the host context will always be received first.
 +
 
 +
    
  |arg name 1 = <tt>e.Peer</tt>
 
  |arg name 1 = <tt>e.Peer</tt>
translators
8,404

edits

Navigation menu