From 300a941b0f48ae24854f9714b173654bfaaf4a96 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 28 Sep 2024 00:17:01 +0200 Subject: [PATCH] Fix throwables' punch allow check --- mods/ITEMS/mcl_throwing/egg.lua | 3 +++ mods/ITEMS/mcl_throwing/ender_pearl.lua | 3 +++ mods/ITEMS/mcl_throwing/snowball.lua | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_throwing/egg.lua b/mods/ITEMS/mcl_throwing/egg.lua index 66802beda..1c3b0eb1d 100644 --- a/mods/ITEMS/mcl_throwing/egg.lua +++ b/mods/ITEMS/mcl_throwing/egg.lua @@ -54,6 +54,9 @@ vl_projectile.register("mcl_throwing:egg_entity",{ if self._owner == object:get_player_name() then return self.timer > 1 end + + local le = object:get_luaentity() + return le and le.is_mob or le._hittable_by_projectile or object:is_player() end, on_collide_with_solid = function(self, pos, node) if mod_target and node.name == "mcl_target:target_off" then diff --git a/mods/ITEMS/mcl_throwing/ender_pearl.lua b/mods/ITEMS/mcl_throwing/ender_pearl.lua index 9e48422db..f3e48fb78 100644 --- a/mods/ITEMS/mcl_throwing/ender_pearl.lua +++ b/mods/ITEMS/mcl_throwing/ender_pearl.lua @@ -128,6 +128,9 @@ vl_projectile.register("mcl_throwing:ender_pearl_entity",{ if self._owner == object:get_player_name() then return self.timer > 1 end + + local le = object:get_luaentity() + return le and le.is_mob or le._hittable_by_projectile or object:is_player() end, on_collide_with_entity = function(self, pos, entity) on_collide(self, pos, minetest.get_node(pos)) diff --git a/mods/ITEMS/mcl_throwing/snowball.lua b/mods/ITEMS/mcl_throwing/snowball.lua index 24b3bacb3..da1b58e25 100644 --- a/mods/ITEMS/mcl_throwing/snowball.lua +++ b/mods/ITEMS/mcl_throwing/snowball.lua @@ -59,7 +59,8 @@ vl_projectile.register("mcl_throwing:snowball_entity", { return self.timer > 1 end - return object.is_mob or object._hittable_by_projectile or object:is_player() + local le = object:get_luaentity() + return le and le.is_mob or le._hittable_by_projectile or object:is_player() end, on_collide_with_solid = function(self, pos, node) if mod_target and node.name == "mcl_target:target_off" then