开始摸索CQF

This commit is contained in:
2025-11-28 12:00:42 +08:00
parent 3d14169b0d
commit fb578cfb99
11 changed files with 556 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
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;
}
}
}
}