Veilheim/Map/PortalsOnMap.cs
/// <summary>
///     CLIENT SIDE: React to setting tag on portal
/// </summary>
CLIENT SIDE: React to setting tag on portal
CLIENT SIDE : React to setting tag on portal
private static void ResyncAfterTagChange(On.TeleportWorld.orig_RPC_SetTag orig, TeleportWorld self, long sender, string tag)
        {
            orig(self, sender, tag);
            if (ZNet.instance.IsServerInstance())
            {
                return;
            }
            Logger.LogInfo("Portal tag changed");
            if (ZNet.instance.IsLocalInstance())
            {
                Logger.LogInfo("Sending portal sync request to server");
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), nameof(RPC_Veilheim_TeleporterSync), new ZPackage());
            }
            if (ZNet.instance.IsClientInstance())
            {
                Logger.LogInfo("Forcing ZDO to server");
                var temp = self.m_nview.GetZDO();
                ZDOMan.instance.GetZDO(temp.m_uid);
                ZDOMan.instance.GetPeer(ZRoutedRpc.instance.GetServerPeerID()).ForceSendZDO(temp.m_uid);
                Logger.LogInfo("Sending deferred portal sync request to server");
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(5000);
                    ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), nameof(RPC_Veilheim_TeleporterSync), new ZPackage());
                });
            }
        }
private static void ResyncAfterTagChange ( On . TeleportWorld . orig_RPC_SetTag orig , TeleportWorld self , long sender , string tag ) { orig ( self , sender , tag ) ; if ( ZNet . instance . IsServerInstance ( ) ) { return ; } Logger . LogInfo ( " " ) ; if ( ZNet . instance . IsLocalInstance ( ) ) { Logger . LogInfo ( " " ) ; ZRoutedRpc . instance . InvokeRoutedRPC ( ZRoutedRpc . instance . GetServerPeerID ( ) , nameof ( RPC_Veilheim_TeleporterSync ) , new ZPackage ( ) ) ; } if ( ZNet . instance . IsClientInstance ( ) ) { Logger . LogInfo ( " " ) ; var temp = self . m_nview . GetZDO ( ) ; ZDOMan . instance . GetZDO ( temp . m_uid ) ; ZDOMan . instance . GetPeer ( ZRoutedRpc . instance . GetServerPeerID ( ) ) . ForceSendZDO ( temp . m_uid ) ; Logger . LogInfo ( " " ) ; Task . Factory . StartNew ( ( ) => { Thread . Sleep ( 5000 ) ; ZRoutedRpc . instance . InvokeRoutedRPC ( ZRoutedRpc . instance . GetServerPeerID ( ) , nameof ( RPC_Veilheim_TeleporterSync ) , new ZPackage ( ) ) ; } ) ; } }
CLIENT SIDE: React to setting tag on portal
CLIENT SIDE : React to setting tag on portal
// Send trigger to server // Force sending ZDO to server // Wait for ZDO to be sent else server won't have accurate information to send back // Send trigger to server
orig
On.TeleportWorld.orig_RPC_SetTag
self
TeleportWorld
sender
long
tag
string