public static void DeepWoodsInitServerAnswerReceived(string[] deepWoodsLevelNames) { if (Game1.IsMasterGame) { return; } ModEntry.Log("DeepWoodsInitServerAnswerReceived", StardewModdingAPI.LogLevel.Trace); DeepWoodsManager.AddAll(deepWoodsLevelNames); EasterEggFunctions.RestoreAllEasterEggsInGame(); // WoodsObelisk.RestoreAllInGame(); <- Not needed, server already sends correct building mod.isDeepWoodsGameRunning = true; }
private void OnDayStarted(object sender, DayStartedEventArgs args) { ModEntry.Log("TimeEvents_AfterDayStarted", StardewModdingAPI.LogLevel.Trace); InitGameIfNecessary(); if (!isDeepWoodsGameRunning) { return; } DeepWoodsManager.LocalDayUpdate(Game1.dayOfMonth); EasterEggFunctions.InterceptIncubatorEggs(); }
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(); }
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); } }
private void PlayerWarped(Farmer who, GameLocation prevLocation, GameLocation newLocation) { if (!isDeepWoodsGameRunning) { return; } if (prevLocation is DeepWoods dw1 && newLocation is DeepWoods dw2 && dw1.Name == dw2.Name) { return; } if (newLocation is Woods woods) { OpenPassageInSecretWoods(woods); } DeepWoodsManager.PlayerWarped(who, prevLocation as DeepWoods, newLocation as DeepWoods, newLocation); if (newLocation is AnimalHouse animalHouse) { EasterEggFunctions.CheckEggHatched(who, animalHouse); } }