26 lines
792 B
C#
26 lines
792 B
C#
namespace Harmony.BlockMinePatches
|
|
{
|
|
[HarmonyPatch(typeof(BlockMine))]
|
|
[HarmonyPatch("OnEntityWalking")]
|
|
public class OnEntityWalkingPatch
|
|
{
|
|
public static bool Prefix(BlockMine __instance, WorldBase _world, int _x, int _y, int _z, BlockValue _blockValue, Entity entity)
|
|
{
|
|
if (entity is EntityNPCRebirth)
|
|
{
|
|
if (entity.EntityClass.Properties.Values.ContainsKey("PreventTrapDamage"))
|
|
{
|
|
string preventTrapDamage = entity.EntityClass.Properties.Values["PreventTrapDamage"];
|
|
|
|
if (preventTrapDamage == "true")
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|