From c23251134600a1f1e7660d8b31b5375b21e091d9 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Tue, 20 Jun 2023 01:17:12 -0400 Subject: [PATCH] fireflies - backport Use add_wear_by_uses to fix incorrect uses counts * backporting https://github.com/minetest/minetest_game/commit/d7dd15782c2fc6b83704fa25d9db535a74d03e53 to fix https://github.com/minetest/minetest_game/pull/2959 but will only work for recent engines.. 0.4.16/5.2.X will still suffers from such problem --- mods/fireflies/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/fireflies/init.lua b/mods/fireflies/init.lua index f5058a8..34d073a 100644 --- a/mods/fireflies/init.lua +++ b/mods/fireflies/init.lua @@ -4,6 +4,8 @@ local m_eth = minetest.get_modpath("ethereal") -- detecting cretive engine over creative privilegies local m_cre = minetest.get_modpath("creative") +-- check recent versions +local is_55 = has_feature("dynamic_add_media_table") -- firefly minetest.register_node("fireflies:firefly", { @@ -59,7 +61,7 @@ minetest.register_tool("fireflies:bug_net", { end if not m_cre then if creative.is_enabled_for(player:get_player_name()) then - itemstack:add_wear(256) + if is_55 then itemstack:add_wear(256) else itemstack:add_wear_by_uses(256) end return itemstack end end