25 lines
800 B
C#
25 lines
800 B
C#
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;
|
||
}
|
||
}
|
||
} |