Use add_wear_by_uses function

This commit is contained in:
Wuzzy 2022-08-05 23:51:40 +02:00
parent 52a0383b92
commit 973ff324a8
5 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ local function handle_wrench( itemstack, player, pointed_thing, mode, uses )
if (mode == hades_doors.ADJUST_LOCKING or mode == hades_doors.ADJUST_CLOSING) and
(not minetest.is_creative_enabled( player_name )) and has_wear then
itemstack:add_wear( 65535 / config.wrench_usage_limit - 1 )
itemstack:add_wear_by_uses(config.wrench_usage_limit)
end
end
end

View File

@ -57,7 +57,7 @@ hades_farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
}, true)
if not minetest.is_creative_enabled(name) then
itemstack:add_wear(65535/(uses-1))
itemstack:add_wear_by_uses(uses)
end
return itemstack
end

View File

@ -74,7 +74,7 @@ function hades_gaia.staffgaia_on_use(itemstack, user, pointed_thing, uses)
cotrig(pt.under, user:get_player_name())
if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:add_wear(65535/(uses-1))
itemstack:add_wear_by_uses(uses)
end
return itemstack
end

View File

@ -4387,7 +4387,7 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net,
chance = chance_net
tool:add_wear(4000) -- 17 uses
tool:add_wear_by_uses(17)
clicker:set_wielded_item(tool)
@ -4395,7 +4395,7 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net,
chance = chance_lasso
tool:add_wear(650) -- 100 uses
tool:add_wear_by_uses(100)
clicker:set_wielded_item(tool)

View File

@ -170,7 +170,7 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
end
if not minetest.is_creative_enabled(player_name) then
itemstack:add_wear(65535 / ((uses or USES) - 1))
itemstack:add_wear_by_uses(uses or USES_DEFAULT)
end
return itemstack