Upload from upload_mods.ps1
This commit is contained in:
25
Harmony/Harmony_BlockDamage.cs
Normal file
25
Harmony/Harmony_BlockDamage.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user