Veilheim/Map/PortalsOnMap.cs
/// <summary>
///     RPC to handle initial sync to a new peer
/// </summary>
/// <param name="sender"></param>
/// <param name="teleporterZPackage"></param>
RPC to handle initial sync to a new peer
RPC to handle initial sync to a new peer
public static void RPC_Veilheim_TeleporterSyncInit(long sender, ZPackage teleporterZPackage)
        {
            if (ZNet.instance.IsServerInstance() || ZNet.instance.IsLocalInstance())
            {
                Logger.LogMessage($"Sending portal data to peer #{sender}");
                var portals = PortalList.GetPortals();
                if (ZNet.instance.IsLocalInstance())
                {
                    UpdatePins(portals);
                }
                var package = portals.ToZPackage();
                ZRoutedRpc.instance.InvokeRoutedRPC(sender, nameof(RPC_Veilheim_TeleporterSyncInit), package);
            }
            if (ZNet.instance.IsClientInstance())
            {
                if (teleporterZPackage != null && teleporterZPackage.Size() > 0 && sender == ZRoutedRpc.instance.GetServerPeerID())
                {
                    Logger.LogMessage("Received portal data from server");
                    portalsFromServer = PortalList.FromZPackage(teleporterZPackage);
                    UpdatePins(portalsFromServer);
                }
            }
        }
public static void RPC_Veilheim_TeleporterSyncInit ( long sender , ZPackage teleporterZPackage ) { if ( ZNet . instance . IsServerInstance ( ) || ZNet . instance . IsLocalInstance ( ) ) { Logger . LogMessage ( $" Sending portal data to peer # { sender } " ) ; var portals = PortalList . GetPortals ( ) ; if ( ZNet . instance . IsLocalInstance ( ) ) { UpdatePins ( portals ) ; } var package = portals . ToZPackage ( ) ; ZRoutedRpc . instance . InvokeRoutedRPC ( sender , nameof ( RPC_Veilheim_TeleporterSyncInit ) , package ) ; } if ( ZNet . instance . IsClientInstance ( ) ) { if ( teleporterZPackage != null && teleporterZPackage . Size ( ) > 0 && sender == ZRoutedRpc . instance . GetServerPeerID ( ) ) { Logger . LogMessage ( " " ) ; portalsFromServer = PortalList . FromZPackage ( teleporterZPackage ) ; UpdatePins ( portalsFromServer ) ; } } }
RPC to handle initial sync to a new peer
RPC to handle initial sync to a new peer
// SERVER SIDE // CLIENT SIDE // Read package and create pins from portal list
sender
long
None
teleporterZPackage
ZPackage
None