diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-11-02 18:00:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 18:00:38 +0100 |
commit | 480011c7813fee5033c3c6c99b38cde8ef1b4350 (patch) | |
tree | a678fa486149d815ce6195b0f0434dc910d97d87 | |
parent | 9294e770ca1360f3d90edd4afc02730b87b0765e (diff) | |
download | advtrains-480011c7813fee5033c3c6c99b38cde8ef1b4350.tar.gz advtrains-480011c7813fee5033c3c6c99b38cde8ef1b4350.tar.bz2 advtrains-480011c7813fee5033c3c6c99b38cde8ef1b4350.zip |
Fix entity damage
Animals from mobs weren't damaged because they have the immortal group set.
Instead, we check for the existence of "fleshy".
-rw-r--r-- | advtrains/trainlogic.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index f76ec9d..0f71ad6 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -598,8 +598,8 @@ function advtrains.train_step_b(id, train, dtime) --- 8c damage other objects --- local objs = minetest.get_objects_inside_radius(rcollpos, 2) for _,obj in ipairs(objs) do - if not obj:is_player() and not obj:get_armor_groups().immortal==1 then - obj:punch(nil, 1, { full_punch_interval = 1.0, damage_groups = {fleshy = 1000}, }, nil) + if not obj:is_player() and obj:get_armor_groups().fleshy and obj:get_armor_groups().fleshy > 0 then + obj:punch(obj, 1, { full_punch_interval = 1.0, damage_groups = {fleshy = 1000}, }, nil) end end end |