From a64feda571d61c43c61181fd4009643d4646feed Mon Sep 17 00:00:00 2001 From: still222 <118853487+still222@users.noreply.github.com> Date: Wed, 19 Aug 2026 09:48:23 +0500 Subject: [PATCH 1/4] Update Alerts.cs --- Source/Client/Patches/Alerts.cs | 64 ++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/Source/Client/Patches/Alerts.cs b/Source/Client/Patches/Alerts.cs index a0b9982e1..ee6262174 100644 --- a/Source/Client/Patches/Alerts.cs +++ b/Source/Client/Patches/Alerts.cs @@ -1,6 +1,5 @@ using HarmonyLib; using Verse; -using Multiplayer.API; using System.Collections.Generic; using RimWorld; using System.Linq; @@ -11,9 +10,10 @@ namespace Multiplayer.Client; [HarmonyPatch(typeof(SlaveRebellionUtility), nameof(SlaveRebellionUtility.IsUnattendedByColonists))] public static class Patch_SlaveRebellionUtility_IsUnattendedByColonists { + [HarmonyPostfix] public static void Postfix(Map map, ref bool __result) { - if (!MP.IsInMultiplayer) return; + if (Multiplayer.Client == null) return; // If any slave is from player's faction __result = __result && map.mapPawns.SlavesOfColonySpawned @@ -25,9 +25,10 @@ public static void Postfix(Map map, ref bool __result) [HarmonyPatch(typeof(Alert_SlavesUnsuppressed), nameof(Alert_SlavesUnsuppressed.Targets), MethodType.Getter)] public static class Patch_Alert_SlavesUnsuppressed_Targets { + [HarmonyPostfix] public static void Postfix(ref List __result) { - if (!MP.IsInMultiplayer) return; + if (Multiplayer.Client == null) return; __result = __result.Where(pawn => pawn.Faction == Faction.OfPlayer).ToList(); } @@ -40,10 +41,65 @@ public static void Postfix(ref List __result) [HarmonyPatch(typeof(Alert_AbandonedBaby), "AbandonedBabies")] public static class Patch_Alert_AbandonedBaby_MultifactionWarning { + [HarmonyPostfix] public static void Postfix(ref List __result) { - if (!MP.IsInMultiplayer) return; + if (Multiplayer.Client == null) return; __result = __result.Where(pawn => !pawn.Faction.IsPlayer || pawn.MapHeld.ParentFaction == Faction.OfPlayer).ToList(); } + +} + +// Vanilla uses (mostly) "needs.food.TicksStarving" to determine +// if animals are hungry/starving. Which in async results in +// constant warnings, when viewed from another, higher tick map. +// We ensure that animals in the list are actually starving. +[HarmonyPatch(typeof(Alert_StarvationAnimals), nameof(Alert_StarvationAnimals.StarvingAnimals), MethodType.Getter)] +public static class Patch_Alert_StarvationAnimals +{ + [HarmonyPostfix] + public static void Postfix(Alert_StarvationAnimals __instance, ref List __result) + { + if (Multiplayer.Client == null || !Multiplayer.GameComp.asyncTime) + return; + + for (int i = __instance.starvingAnimalsResult.Count - 1; i >= 0; i--) + { + Pawn animal = __instance.starvingAnimalsResult[i]; + + if (!animal.needs.food.Starving) + __instance.starvingAnimalsResult.RemoveAt(i); + } + + __result = __instance.starvingAnimalsResult; + } + +} + +// Exact same idea as in "Patch_Alert_StarvationAnimals", +// but this class is written slightly differently +[HarmonyPatch(typeof(Alert_PennedAnimalHungry), nameof(Alert_PennedAnimalHungry.CalculateTargets))] +public static class Patch_Alert_PennedAnimalHungry +{ + [HarmonyPostfix] + public static void Postfix(Alert_PennedAnimalHungry __instance) + { + if (Multiplayer.Client == null || !Multiplayer.GameComp.asyncTime) + return; + + for (int i = __instance.targets.Count - 1; i >= 0; i--) + { + Pawn animal = __instance.targets[i].Pawn; + + if (!animal.needs.food.Starving) + { + __instance.targets.RemoveAt(i); + __instance.pawnNames.RemoveAt(i); + } + + } + + } + } From cc2bb5615627237f17baeead3927d0f39e504ff4 Mon Sep 17 00:00:00 2001 From: still222 <118853487+still222@users.noreply.github.com> Date: Wed, 19 Aug 2026 09:57:00 +0500 Subject: [PATCH 2/4] AbandonedBabies using nameof --- Source/Client/Patches/Alerts.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Client/Patches/Alerts.cs b/Source/Client/Patches/Alerts.cs index ee6262174..5c52567cf 100644 --- a/Source/Client/Patches/Alerts.cs +++ b/Source/Client/Patches/Alerts.cs @@ -38,7 +38,7 @@ public static void Postfix(ref List __result) // You will not get abandoned warning: (baby from other faction without the same faction adult) // for (other) player owned babies at all, unless it's happened directly on YOUR base. // Example: someone catapulted their baby on your map. Your own babies get a different set of warning, which works fine. -[HarmonyPatch(typeof(Alert_AbandonedBaby), "AbandonedBabies")] +[HarmonyPatch(typeof(Alert_AbandonedBaby), nameof(Alert_AbandonedBaby.AbandonedBabies))] public static class Patch_Alert_AbandonedBaby_MultifactionWarning { [HarmonyPostfix] From d07684b4bf1eaa541da4789fa198e206ebd32d55 Mon Sep 17 00:00:00 2001 From: still222 <118853487+still222@users.noreply.github.com> Date: Wed, 19 Aug 2026 12:57:59 +0500 Subject: [PATCH 3/4] Update Alerts.cs Renaming patch classes to be inline with the rest of the code --- Source/Client/Patches/Alerts.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Client/Patches/Alerts.cs b/Source/Client/Patches/Alerts.cs index 5c52567cf..439acc3df 100644 --- a/Source/Client/Patches/Alerts.cs +++ b/Source/Client/Patches/Alerts.cs @@ -8,7 +8,7 @@ namespace Multiplayer.Client; // Add faction check to "slaves unattended" warning [HarmonyPatch(typeof(SlaveRebellionUtility), nameof(SlaveRebellionUtility.IsUnattendedByColonists))] -public static class Patch_SlaveRebellionUtility_IsUnattendedByColonists +public static class SlaveRebellionUtility_IsUnattendedByColonists_Patch { [HarmonyPostfix] public static void Postfix(Map map, ref bool __result) @@ -23,7 +23,7 @@ public static void Postfix(Map map, ref bool __result) // Add faction check to "slaves unsuppressed" warning [HarmonyPatch(typeof(Alert_SlavesUnsuppressed), nameof(Alert_SlavesUnsuppressed.Targets), MethodType.Getter)] -public static class Patch_Alert_SlavesUnsuppressed_Targets +public static class Alert_SlavesUnsuppressed_Targets_Patch { [HarmonyPostfix] public static void Postfix(ref List __result) @@ -39,7 +39,7 @@ public static void Postfix(ref List __result) // for (other) player owned babies at all, unless it's happened directly on YOUR base. // Example: someone catapulted their baby on your map. Your own babies get a different set of warning, which works fine. [HarmonyPatch(typeof(Alert_AbandonedBaby), nameof(Alert_AbandonedBaby.AbandonedBabies))] -public static class Patch_Alert_AbandonedBaby_MultifactionWarning +public static class Alert_AbandonedBaby_AbandonedBabies_Patch { [HarmonyPostfix] public static void Postfix(ref List __result) @@ -56,7 +56,7 @@ public static void Postfix(ref List __result) // constant warnings, when viewed from another, higher tick map. // We ensure that animals in the list are actually starving. [HarmonyPatch(typeof(Alert_StarvationAnimals), nameof(Alert_StarvationAnimals.StarvingAnimals), MethodType.Getter)] -public static class Patch_Alert_StarvationAnimals +public static class Alert_StarvationAnimals_StarvingAnimals_Patch { [HarmonyPostfix] public static void Postfix(Alert_StarvationAnimals __instance, ref List __result) @@ -80,7 +80,7 @@ public static void Postfix(Alert_StarvationAnimals __instance, ref List __ // Exact same idea as in "Patch_Alert_StarvationAnimals", // but this class is written slightly differently [HarmonyPatch(typeof(Alert_PennedAnimalHungry), nameof(Alert_PennedAnimalHungry.CalculateTargets))] -public static class Patch_Alert_PennedAnimalHungry +public static class Alert_PennedAnimalHungry_CalculateTargets_Patch { [HarmonyPostfix] public static void Postfix(Alert_PennedAnimalHungry __instance) From f4b1905ca98b62f1cb2494a042fbd8c1e8bc4194 Mon Sep 17 00:00:00 2001 From: still222 <118853487+still222@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:00:04 +0500 Subject: [PATCH 4/4] Update Alerts.cs --- Source/Client/Patches/Alerts.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Client/Patches/Alerts.cs b/Source/Client/Patches/Alerts.cs index 439acc3df..bafa021ae 100644 --- a/Source/Client/Patches/Alerts.cs +++ b/Source/Client/Patches/Alerts.cs @@ -53,7 +53,7 @@ public static void Postfix(ref List __result) // Vanilla uses (mostly) "needs.food.TicksStarving" to determine // if animals are hungry/starving. Which in async results in -// constant warnings, when viewed from another, higher tick map. +// constant warnings when viewed from another, higher tick map. // We ensure that animals in the list are actually starving. [HarmonyPatch(typeof(Alert_StarvationAnimals), nameof(Alert_StarvationAnimals.StarvingAnimals), MethodType.Getter)] public static class Alert_StarvationAnimals_StarvingAnimals_Patch