diff --git a/mod.conf b/mod.conf index ba70b47..2746cf3 100644 --- a/mod.conf +++ b/mod.conf @@ -6,4 +6,4 @@ description = Contains nodes for building medieval houses. url = https://github.com/sokomine/cottages version = 2022-09-29 depends = futil -optional_depends = 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, bucket, default, doors, env_sounds, ethereal, farming, moreblocks, node_entity_queue, player_api, player_monoids, stairs, stairsplus, stamina, technic, unified_inventory, wool, workbench diff --git a/modules/anvil/compat.lua b/modules/anvil/compat.lua index 7fc284c..a9860fa 100644 --- a/modules/anvil/compat.lua +++ b/modules/anvil/compat.lua @@ -25,3 +25,11 @@ if cottages.has.technic then cottages.anvil.make_unrepairable("technic:mining_drill_mk3_4") cottages.anvil.make_unrepairable("technic:mining_drill_mk3_5") end + +if cottages.has.anvil then + minetest.clear_craft({output = "anvil:anvil"}) + minetest.register_alias_force("anvil:anvil", "cottages:anvil") + + minetest.clear_craft({output = "anvil:hammer"}) + minetest.register_alias_force("anvil:hammer", "cottages:hammer") +end diff --git a/settings.lua b/settings.lua index 3275fc8..a911b3b 100644 --- a/settings.lua +++ b/settings.lua @@ -1,5 +1,7 @@ local s = minetest.settings +local has_anvil_mod = not not cottages.has.anvil + cottages.settings = { anvil = { enabled = s:get_bool("cottages.anvil.enabled", true), @@ -9,9 +11,9 @@ cottages.settings = { hud_timeout = tonumber(s:get("cottages.anvil.hud_timeout")) or 2, -- seconds repair_amount = tonumber(s:get("cottages.anvil.repair_amount")) or 4369, stamina = tonumber(s:get("cottages.anvil.stamina")) or 40, - formspec_enabled = s:get_bool("cottages.anvil.formspec_enabled", true), - tool_hud_enabled = s:get_bool("cottages.anvil.tool_hud_enabled", true), - tool_entity_enabled = s:get_bool("cottages.anvil.tool_entity_enabled", false), + formspec_enabled = s:get_bool("cottages.anvil.formspec_enabled", not has_anvil_mod), + tool_hud_enabled = s:get_bool("cottages.anvil.tool_hud_enabled", not has_anvil_mod), + tool_entity_enabled = s:get_bool("cottages.anvil.tool_entity_enabled", has_anvil_mod), tool_entity_displacement = tonumber(s:get("cottages.anvil.tool_entity_displacement")) or 2 / 16, },