Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/HarmonyPatches/Faction_ShouldHaveLeader_Patch.cs
2025-11-28 12:00:42 +08:00

26 lines
778 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 Verse;
namespace WulaFallenEmpire
{
/// <summary>
/// 为Wula_PIA_Legion_Faction派系排除领袖检查错误
/// 通过修改ShouldHaveLeader属性实现
/// </summary>
[HarmonyPatch(typeof(Faction), "get_ShouldHaveLeader")]
public static class Faction_ShouldHaveLeader_Patch
{
[HarmonyPostfix]
public static void Postfix(Faction __instance, ref bool __result)
{
// 对于Wula_PIA_Legion_Faction派系强制返回false
// 这样原代码中的检查 if (ShouldHaveLeader && leader == null) 就不会触发
if (__instance.def?.defName == "Wula_PIA_Legion_Faction")
{
__result = false;
}
}
}
}