fireflies - backport Use add_wear_by_uses to fix incorrect uses counts

* backporting d7dd15782c
  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
master
mckaygerhard 2023-06-20 01:26:01 -04:00
parent 1bad13334f
commit 71bc2a3945
1 changed files with 3 additions and 1 deletions

View File

@ -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 engines
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