diff --git a/mods/ITEMS/mcl_throwing/ender_pearl.lua b/mods/ITEMS/mcl_throwing/ender_pearl.lua index a3fb42ebe..6d7cec271 100644 --- a/mods/ITEMS/mcl_throwing/ender_pearl.lua +++ b/mods/ITEMS/mcl_throwing/ender_pearl.lua @@ -34,6 +34,7 @@ minetest.register_entity("mcl_throwing:ender_pearl_entity",{ get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, + on_step = vl_projectile.update_projectile, _lastpos={}, _thrower = nil, -- Player ObjectRef of the player who threw the ender pearl _vl_projectile = { @@ -127,6 +128,4 @@ minetest.register_entity("mcl_throwing:ender_pearl_entity",{ end end }, - - on_step = vl_projectile.update_projectile, }) diff --git a/mods/ITEMS/mcl_throwing/snowball.lua b/mods/ITEMS/mcl_throwing/snowball.lua index 88f3d32ee..3116bdf00 100644 --- a/mods/ITEMS/mcl_throwing/snowball.lua +++ b/mods/ITEMS/mcl_throwing/snowball.lua @@ -50,9 +50,10 @@ minetest.register_entity("mcl_throwing:snowball_entity", { get_staticdata = mcl_throwing.get_staticdata, on_activate = mcl_throwing.on_activate, + + on_step = vl_projectile.update_projectile, _thrower = nil, _lastpos = nil, - _vl_projectile = { behaviors = { vl_projectile.collides_with_solids, @@ -74,6 +75,5 @@ minetest.register_entity("mcl_throwing:snowball_entity", { }, damage_groups = { snowball_vulnerable = 3 }, }, - on_step = vl_projectile.update_projectile, }) diff --git a/mods/ITEMS/vl_projectile/init.lua b/mods/ITEMS/vl_projectile/init.lua index 7d82f02fd..c5a18e725 100644 --- a/mods/ITEMS/vl_projectile/init.lua +++ b/mods/ITEMS/vl_projectile/init.lua @@ -109,6 +109,7 @@ function mod.collides_with_entities(self, dtime, entity_def, projectile_def) local dmg = projectile_def.damage_groups or 0 local hit = nil + local owner = self._vl_projectile.owner local objects = minetest.get_objects_inside_radius(pos, 1.5) for i = 1,#objects do @@ -116,9 +117,9 @@ function mod.collides_with_entities(self, dtime, entity_def, projectile_def) local entity = object:get_luaentity() if entity and entity.name ~= self.object:get_luaentity().name then - if object:is_player() and self._thrower ~= object:get_player_name() then + if object:is_player() and owner ~= object:get_player_name() then return handle_entity_collision(self, entity_def, projectile_def, object) - elseif (entity.is_mob == true or entity._hittable_by_projectile) and (self._thrower ~= object) then + elseif (entity.is_mob == true or entity._hittable_by_projectile) and (owner ~= object) then return handle_entity_collision(self, entity_def, projectile_def, object) end end