Beispiel #1
0
        /// <summary>
        ///     CLIENT SIDE: Initially pull portals after SetMapData on Minimap
        /// </summary>
        private static void UpdatePortalPins(On.Minimap.orig_SetMapData orig, Minimap self, byte[] data)
        {
            orig(self, data);

            if (ZNet.instance.IsServerInstance())
            {
                return;
            }

            if (!ConfigUtil.Get <bool>("Map", "showPortalsOnMap"))
            {
                return;
            }

            if (ZNet.instance.IsLocalInstance())
            {
                Logger.LogMessage("Initializing portals");
                UpdatePins(PortalList.GetPortals());
            }

            if (ZNet.instance.IsClientInstance())
            {
                Logger.LogMessage("Sending portal sync request to server");
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), nameof(RPC_Veilheim_TeleporterSyncInit), new ZPackage());
            }
        }
Beispiel #2
0
        /// <summary>
        ///     After SetMapData is done, send it to the server
        ///     TODO: Check if configuration is loaded already, data should not be sent if map sharing is disabled
        /// </summary>
        private static void InitialSendRequest(On.Minimap.orig_SetMapData orig, Minimap self, byte[] data)
        {
            // Prevent queueing up loaded data
            isInSetMapData = true;

            orig(self, data);

            if (ConfigUtil.Get <bool>("MapServer", "shareMapProgression"))
            {
                Logger.LogInfo("Sending Map data initially to server");
                // After login, send map data to server (and get new map data back)
                var pkg = new ZPackage(CreateExplorationData().ToArray());
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), nameof(RPC_Veilheim_ReceiveExploration), pkg);
            }

            isInSetMapData = false;
        }