Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_BlockDamage.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

26 lines
874 B
C#

namespace Harmony.BlockDamagePatches
{
[HarmonyPatch(typeof(BlockDamage))]
[HarmonyPatch("OnEntityCollidedWithBlock")]
public class OnEntityCollidedWithBlockPatch
{
public static bool Prefix(BlockDamage __instance, ref bool __result, WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, Entity _targetEntity)
{
if (_targetEntity is EntityNPCRebirth)
{
if (_targetEntity.EntityClass.Properties.Values.ContainsKey("PreventTrapDamage"))
{
string preventTrapDamage = _targetEntity.EntityClass.Properties.Values["PreventTrapDamage"];
if (preventTrapDamage == "true")
{
return false;
}
}
}
return true;
}
}
}