public static void FarmHouse_resetLocalState_Postfix(ref FarmHouse __instance) { try { Farmer f = __instance.owner; if (f == null) { return; } ModEntry.PMonitor.Log($"reset farmhouse state - upgrade level {__instance.upgradeLevel}"); Misc.ResetSpouses(f); if (f.currentLocation == __instance && Misc.IsInBed(__instance, f.GetBoundingBox())) { f.position.Value = Misc.GetFarmerBedPosition(__instance); } if (ModEntry.config.CustomBed && __instance.upgradeLevel > 0) { Maps.ReplaceBed(__instance); } if (__instance.upgradeLevel > 0 && __instance.upgradeLevel < 4) { Maps.BuildSpouseRooms(__instance); __instance.setFloors(); } if (Misc.ChangingKidsRoom()) { if (__instance.upgradeLevel > 1 && __instance.upgradeLevel < 4) { NPCPatches.SetCribs(__instance); Maps.ExpandKidsRoom(__instance); } } if (Misc.GetSpouses(f, 0).ContainsKey("Sebastian") && Game1.netWorldState.Value.hasWorldStateID("sebastianFrog")) { if (Game1.random.NextDouble() < 0.1 && Game1.timeOfDay > 610) { DelayedAction.playSoundAfterDelay("croak", 1000, null, -1); } } } catch (Exception ex) { Monitor.Log($"Failed in {nameof(FarmHouse_resetLocalState_Postfix)}:\n{ex}", LogLevel.Error); } }
public static void FarmHouse_updateFarmLayout_Postfix(ref FarmHouse __instance) { try { if (Misc.ChangingKidsRoom()) { Monitor.Log($"Changing kids room for {__instance}"); if (__instance.upgradeLevel > 1 && __instance.upgradeLevel < 4) { //NPCPatches.SetCribs(__instance); Maps.ExpandKidsRoom(__instance); } } } catch (Exception ex) { Monitor.Log($"Failed in {nameof(FarmHouse_resetLocalState_Postfix)}:\n{ex}", LogLevel.Error); } }