Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/HarmonyPatches/Hediff_Mechlink_PostAdd_Patch.cs
2026-02-25 17:30:59 +08:00

33 lines
1.0 KiB
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 ArachnaeSwarm
{
[HarmonyPatch(typeof(Hediff_Mechlink), "PostAdd")]
public static class Hediff_Mechlink_PostAWULA_Patch
{
public static bool Prefix(Hediff_Mechlink __instance, DamageInfo? dinfo)
{
// 检查 hediff 的 defName 是否是我们要排除的
if (__instance.def.defName == "WULA_Addons_Antenna_Hediff_Base")
{
// 执行基础逻辑但不弹出信件
if (!ModLister.CheckBiotech("Mechlink"))
{
__instance.pawn.health.RemoveHediff(__instance);
return false; // 跳过原始方法
}
PawnComponentsUtility.AddAndRemoveDynamicComponents(__instance.pawn);
// 不弹出信件,直接返回
return false; // 跳过原始方法
}
// 对于其他 hediff正常执行原始方法
return true;
}
}
}