Veilheim/Map/SharedMapSystem.cs
/// <summary>
///     Apply sent exploration data to local map
/// </summary>
/// <param name="sender"></param>
/// <param name="mapData"></param>
Apply sent exploration data to local map
Apply sent exploration data to local map
public static void RPC_Veilheim_ReceiveExploration(long sender, ZPackage mapData)
        {
            if (mapData == null)
            {
                return;
            }
            if (ZNet.instance.IsServerInstance())
            {
                Logger.LogInfo($"Received map data from client #{sender}");
                ApplyMapData(mapData);
                var tempPlayerInfos = new List<ZNet.PlayerInfo>();
                ZNet.instance.GetOtherPublicPlayers(tempPlayerInfos);
                var newMapData = new ZPackage(CreateExplorationData());
                foreach (var player in tempPlayerInfos)
                {
                    Logger.LogInfo($"Sending map data to player {player.m_name} #{ZNet.instance.GetPeerByPlayerName(player.m_name)}");
                    ZRoutedRpc.instance.InvokeRoutedRPC(ZNet.instance.GetPeerByPlayerName(player.m_name).m_uid, nameof(RPC_Veilheim_ReceiveExploration),
                        newMapData);
                }
            }
            if (ZNet.instance.IsClientInstance())
            {
                Logger.LogInfo("Received map data from server");
                ApplyMapData(mapData);
            }
        }
public static void RPC_Veilheim_ReceiveExploration ( long sender , ZPackage mapData ) { if ( mapData == null ) { return ; } if ( ZNet . instance . IsServerInstance ( ) ) { Logger . LogInfo ( $" Received map data from client # { sender } " ) ; ApplyMapData ( mapData ) ; var tempPlayerInfos = new List < ZNet . PlayerInfo > ( ) ; ZNet . instance . GetOtherPublicPlayers ( tempPlayerInfos ) ; var newMapData = new ZPackage ( CreateExplorationData ( ) ) ; foreach ( var player in tempPlayerInfos ) { Logger . LogInfo ( $" Sending map data to player  { player . m_name }  # { ZNet . instance . GetPeerByPlayerName ( player . m_name ) } " ) ; ZRoutedRpc . instance . InvokeRoutedRPC ( ZNet . instance . GetPeerByPlayerName ( player . m_name ) . m_uid , nameof ( RPC_Veilheim_ReceiveExploration ) , newMapData ) ; } } if ( ZNet . instance . IsClientInstance ( ) ) { Logger . LogInfo ( " " ) ; ApplyMapData ( mapData ) ; } }
Apply sent exploration data to local map
Apply sent exploration data to local map
// Set flag to prevent enqueuing again for sending, since it can be new
sender
long
None
mapData
ZPackage
None