Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/HarmonyPatches/WULA_MechUnit/Patche_SkillSystem.cs
2026-02-24 12:02:38 +08:00

29 lines
718 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.
// File: HarmonyPatches/SkillSystemPatches.cs
using HarmonyLib;
using RimWorld;
using Verse;
namespace WulaFallenEmpire
{
/// <summary>
/// 针对SkillRecord.Interval()的补丁,防止在机甲上出现空引用
/// </summary>
[HarmonyPatch(typeof(SkillRecord))]
[HarmonyPatch("Interval")]
public static class Patch_SkillRecord_Interval
{
[HarmonyPrefix]
public static bool Prefix(SkillRecord __instance)
{
// 额外检查如果pawn.story为null也跳过
if (__instance?.Pawn?.story == null)
{
return false; // 跳过原方法
}
return true; // 执行原方法
}
}
}