No wear out in creative and replace add_wear with add_wear_by_uses (#76)

This commit is contained in:
Mikita Wiśniewski 2024-05-21 01:22:39 +07:00 committed by GitHub
parent a6d1f55f0a
commit 01b6f3c56d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -384,10 +384,11 @@ minetest.register_tool("nether:lightstaff_eternal", {
sound = {breaks = "default_tool_breaks"},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if lightstaff_on_use(user, "#23F", 0) then -- was "#8088FF" or "#13F"
if lightstaff_on_use(user, "#23F", 0) -- was "#8088FF" or "#13F"
and not minetest.is_creative_enabled(user) then
-- The staff of Eternal Light wears out, to limit how much
-- a player can alter the nether with it.
itemstack:add_wear(65535 / (nether.lightstaff_uses - 1))
itemstack:add_wear_by_uses(nether.lightstaff_uses)
end
return itemstack
end