compatibility w/ broken tools

This commit is contained in:
flux 2023-03-29 15:51:33 -07:00
parent 549c697bc0
commit cb9a744a1b
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
4 changed files with 29 additions and 2 deletions

View File

@ -659,7 +659,7 @@ stds.cottages = {
},
other_fields = true,
},
"broken_tools",
"carts",
"default",
"doors",

View File

@ -12,6 +12,7 @@ cottages = {
has = {
anvil = minetest.get_modpath("anvil"),
broken_tools = minetest.get_modpath("broken_tools"),
bucket = minetest.get_modpath("bucket"),
default = minetest.get_modpath("default"),
doors = minetest.get_modpath("doors"),

View File

@ -5,4 +5,24 @@ author = Sokomine
description = Contains nodes for building medieval houses.
url = https://github.com/sokomine/cottages
version = 2023-02-08
optional_depends = anvil, bucket, default, doors, env_sounds, ethereal, farming, moreblocks, node_entity_queue, player_api, player_monoids, stairs, stairsplus, stamina, technic, unified_inventory, wool, workbench
optional_depends = """
anvil,
broken_tools,
bucket,
default,
doors,
env_sounds,
ethereal,
farming,
moreblocks,
node_entity_queue,
player_api,
player_monoids,
stairs,
stairsplus,
stamina,
technic,
unified_inventory,
wool,
workbench
"""

View File

@ -18,6 +18,7 @@ local v_sub = vector.subtract
local get_safe_short_description = cottages.util.get_safe_short_description
local resolve_item = cottages.util.resolve_item
local has_broken_tools = cottages.has.broken_tools
local has_stamina = cottages.has.stamina
local repair_amount = cottages.settings.anvil.repair_amount
@ -185,6 +186,11 @@ function anvil.use_anvil(pos, puncher)
-- do the actual repair
tool:add_wear(-repair_amount)
if has_broken_tools then
broken_tools.fix_tool(tool)
end
inv:set_stack("input", 1, tool)
-- damage the hammer slightly