This commit is contained in:
Tourswen
2025-12-14 17:17:58 +08:00
parent fa3531c2fd
commit 66c4ce1177
2 changed files with 4 additions and 7 deletions

View File

@@ -10,15 +10,12 @@ namespace WulaFallenEmpire
[HarmonyPatch(typeof(Pawn), "ThreatDisabled")] [HarmonyPatch(typeof(Pawn), "ThreatDisabled")]
public static class Patch_Pawn_ThreatDisabled public static class Patch_Pawn_ThreatDisabled
{ {
public static void Postfix(Pawn __instance, IAttackTargetSearcher disabledFor, ref bool __result) public static void Postfix(Pawn __instance, ref bool __result)
{ {
if (!__result) return; // 如果已经判定为无威胁检查是否有CompAutonomousMech组件
if (!__instance.IsColonyMech) return; if (__result && __instance.GetComp<CompAutonomousMech>() != null)
var comp = __instance.GetComp<CompAutonomousMech>();
if (comp != null && comp.CanFightAutonomously)
{ {
__result = false; __result = false; // 强制设置为有威胁
} }
} }
} }