diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index d967ef49..b61c4979 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -669,7 +669,7 @@ function mobs:register_mob(name, def) end if self.timer > 3 then local pos = vector.round(self.object:getpos()) - entity_physics(pos, 3) -- hurt player/mobs caught in blast area + entity_physics(pos, 3, self) -- hurt player/mobs caught in blast area if minetest.find_node_near(pos, 1, {"group:water"}) or minetest.is_protected(pos, "") then self.object:remove() @@ -1106,8 +1106,8 @@ function mobs:explosion(pos, radius, fire, smoke, sound) local n = minetest.get_node(p).name -- do NOT destroy protection nodes but DO destroy nodes in protected area if not n:find("protector:") - --and not minetest.is_protected(p, "") - and minetest.get_item_group(n.name, "unbreakable") ~= 1 then + and not minetest.is_protected(p, "") + and minetest.get_item_group(n, "unbreakable") ~= 1 then -- if chest then drop items inside if n == "default:chest" then local meta = minetest.get_meta(p) @@ -1180,19 +1180,20 @@ function calc_velocity(pos1, pos2, old_vel, power) end -- modified from TNT mod -function entity_physics(pos, radius) +function entity_physics(pos, radius, self) radius = radius * 2 local objs = minetest.get_objects_inside_radius(pos, radius) local obj_pos, obj_vel, dist for _, obj in pairs(objs) do obj_pos = obj:getpos() obj_vel = obj:getvelocity() - dist = math.max(1, vector.distance(pos, obj_pos)) + --dist = math.max(1, vector.distance(pos, obj_pos)) if obj_vel ~= nil then obj:setvelocity(calc_velocity(pos, obj_pos, obj_vel, radius * 10)) end - local damage = (4 / dist) * radius - obj:set_hp(obj:get_hp() - damage) + --local damage = (4 / dist) * radius + obj:punch(self.object, 1.0,{full_punch_interval=1.0, damage_groups = {fleshy=self.damage} }) + --obj:set_hp(obj:get_hp() - damage) end end