Files
ArachnaeSwarm/Source/ArachnaeSwarm/HarmonyPatches/Patch_SettlementDefeatUtility_CheckDefeated.cs
2025-09-21 14:20:33 +08:00

25 lines
800 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using HarmonyLib;
using RimWorld;
using RimWorld.Planet;
using Verse;
using System.Linq;
namespace ArachnaeSwarm
{
[HarmonyPatch(typeof(SettlementDefeatUtility), "CheckDefeated")]
public static class Patch_SettlementDefeatUtility_CheckDefeated
{
[HarmonyPrefix]
public static bool Prefix(Settlement factionBase)
{
// 如果目标没有地图或者地图上存在B端传送门则跳过原版的失败检查
if (!factionBase.HasMap || factionBase.Map.listerBuildings.AllBuildingsColonistOfClass<Building_WormholePortal_B>().Any())
{
return false; // 返回 false, 阻止原版方法执行
}
// 否则,正常执行原版方法
return true;
}
}
}