コード例 #1
0
        private void InitGameIfNecessary()
        {
            ModEntry.Log("InitGameIfNecessary(" + isDeepWoodsGameRunning + ")", StardewModdingAPI.LogLevel.Trace);

            // Make sure our interceptor is set.
            // E.g. MTN overrides Game1.multiplayer instead of wrapping.
            Game1MultiplayerAccessProvider.InterceptMultiplayerIfNecessary();

            if (isDeepWoodsGameRunning)
            {
                return;
            }

            if (Game1.IsMasterGame)
            {
                DeepWoodsSettings.DoLoad();
                DeepWoodsManager.Add();
                EasterEggFunctions.RestoreAllEasterEggsInGame();
                WoodsObelisk.RestoreAllInGame();
                isDeepWoodsGameRunning = true;
            }
            else
            {
                DeepWoodsManager.Remove();
                hasRequestedInitMessageFromServer = true;
                Game1.MasterPlayer.queueMessage(Settings.Network.DeepWoodsMessageId, Game1.player, new object[] { NETWORK_MESSAGE_DEEPWOODS_INIT });
            }
        }
コード例 #2
0
        public static void DeepWoodsInitServerAnswerReceived(List <string> deepWoodsLevelNames)
        {
            if (Game1.IsMasterGame)
            {
                return;
            }

            ModEntry.Log("DeepWoodsInitServerAnswerReceived", StardewModdingAPI.LogLevel.Debug);

            DeepWoodsManager.AddAll(deepWoodsLevelNames);
            EasterEggFunctions.RestoreAllEasterEggsInGame();
            // WoodsObelisk.RestoreAllInGame(); <- Not needed, server already sends correct building
            mod.isDeepWoodsGameRunning = true;
        }
コード例 #3
0
        private void SaveEvents_AfterSave(object sender, EventArgs args)
        {
            ModEntry.Log("SaveEvents_AfterSave", StardewModdingAPI.LogLevel.Trace);

            isBeforeSaveCount--;

            if (isBeforeSaveCount > 0)
            {
                ModEntry.Log("AfterSave event was called before save has finished. Ignoring.", StardewModdingAPI.LogLevel.Warn);
                return;
            }

            if (isBeforeSaveCount < 0)
            {
                ModEntry.Log("AfterSave event was called without previous BeforeSave call. Mod is now in unknown state, all hell might break lose.", StardewModdingAPI.LogLevel.Error);
                return;
            }

            DeepWoodsManager.Restore();
            EasterEggFunctions.RestoreAllEasterEggsInGame();
            WoodsObelisk.RestoreAllInGame();
        }
コード例 #4
0
        private void InitGameIfNecessary()
        {
            ModEntry.Log("InitGameIfNecessary(" + isDeepWoodsGameRunning + ")", StardewModdingAPI.LogLevel.Trace);

            if (isDeepWoodsGameRunning)
            {
                return;
            }

            if (Game1.IsMasterGame)
            {
                DeepWoodsSettings.DoLoad();
                DeepWoodsManager.Add();
                EasterEggFunctions.RestoreAllEasterEggsInGame();
                WoodsObelisk.RestoreAllInGame();
                isDeepWoodsGameRunning = true;
            }
            else
            {
                DeepWoodsManager.Remove();
                ModEntry.SendMessage(MessageId.RequestMetadata, Game1.MasterPlayer.UniqueMultiplayerID);
            }
        }