Skip to content

Commit

Permalink
fix spouses getting out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
reyqn committed Feb 20, 2023
1 parent 103cea2 commit 699eb93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Harmony/HarmonyPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using StardewModdingAPI;
using StardewValley;
using StardewValley.Buildings;
using StardewValley.Locations;
using StardewValley.Menus;
using StardewValley.Network;

Expand All @@ -29,6 +30,7 @@ internal static void Initialize(IMonitor monitor, IModHelper modHelper, string i
harmonyInstance.Patch(original: AccessTools.Method(typeof(Multiplayer), nameof(StardewValley.Multiplayer.broadcastLocationDelta)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(BroadcastLocationDelta_Prefix)));
harmonyInstance.Patch(original: AccessTools.Method(typeof(Multiplayer), nameof(StardewValley.Multiplayer.processIncomingMessage)), postfix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(ProcessIncomingMessage_Postfix)));
harmonyInstance.Patch(original: AccessTools.Method(typeof(Building), nameof(Building.updateInteriorWarps)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(UpdateInteriorWarps_Prefix)));
harmonyInstance.Patch(original: AccessTools.Method(typeof(Cabin), nameof(Cabin.getPorchStandingSpot)), prefix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(GetPorchStandingSpot_Prefix)));
harmonyInstance.Patch(original: AccessTools.Method(typeof(ChatBox), nameof(ChatBox.receiveChatMessage)), postfix: new HarmonyMethod(typeof(HarmonyPatcher), nameof(ReceiveChatMessage_Postfix)));
}

Expand Down Expand Up @@ -163,6 +165,18 @@ public static bool UpdateInteriorWarps_Prefix(Building __instance, GameLocation
}
}

private static bool GetPorchStandingSpot_Prefix(Cabin __instance, ref Point __result)
{
try {
__result = new Point(__instance.warps.First().TargetX, __instance.warps.First().TargetY);
return false;
}
catch (Exception e) {
_monitor.Log($"Failed in {nameof(GetPorchStandingSpot_Prefix)}:\n{e}", LogLevel.Error);
return true;
}
}

internal static void ReceiveChatMessage_Postfix(long sourceFarmer, string message)
{
try
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "CabinStacker",
"Author": "reyqn",
"Version": "1.1.0",
"Version": "1.1.1",
"Description": "This will allow you to stack cabins in multiplayer, each player using the farmhouse as its own cabin. You can now play with an unlimited number of friends, without wasting space for your crops and other buildings.",
"UniqueID": "reyqn.CabinStacker",
"EntryDll": "CabinStacker.dll",
Expand Down

0 comments on commit 699eb93

Please sign in to comment.