mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Don't allow anvil repair if already at max health
This commit is contained in:
parent
146458112c
commit
2f88529d41
1 changed files with 2 additions and 2 deletions
|
@ -56,7 +56,7 @@ local function update_anvil_slots(meta)
|
|||
end
|
||||
|
||||
-- Same tool twice
|
||||
if input1:get_name() == input2:get_name() and def1.type == "tool" then
|
||||
if input1:get_name() == input2:get_name() and def1.type == "tool" and (input1:get_wear() > 0 or input2:get_wear() > 0) then
|
||||
-- Add tool health together plus a small bonus
|
||||
-- TODO: Combine tool enchantments
|
||||
local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST)
|
||||
|
@ -89,7 +89,7 @@ local function update_anvil_slots(meta)
|
|||
elseif material:get_name() == tooldef._repair_material then
|
||||
has_correct_material = true
|
||||
end
|
||||
if has_correct_material then
|
||||
if has_correct_material and tool:get_wear() > 0 then
|
||||
local new_wear = calculate_repair(tool:get_wear(), MAX_WEAR, MATERIAL_TOOL_REPAIR_BOOST)
|
||||
tool:set_wear(new_wear)
|
||||
name_item = tool
|
||||
|
|
Loading…
Reference in a new issue