This commit is contained in:
Tourswen
2025-11-18 20:40:48 +08:00
parent 6b94929803
commit 878657af47
9 changed files with 265 additions and 128 deletions

View File

@@ -0,0 +1,32 @@
using HarmonyLib;
using RimWorld;
using Verse;
namespace ArachnaeSwarm
{
[HarmonyPatch(typeof(Hediff_Mechlink), "PostAdd")]
public static class Hediff_Mechlink_PostAdd_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;
}
}
}