From 6969e7baff57495c0d7667e8b683c4919ff7a333 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 16 Feb 2020 22:02:48 -0700 Subject: [PATCH] expose make_unrepairable --- README.md | 6 +++++- init.lua | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f8cc4e7..7e6582a 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,8 @@ Anvil mod by Sokomine, originally a part of the Cottages mod but extracted to st This anvil (and its associated hammer) allows a player to repair worn tools. Place the worn tool in the anvil's inventory and strike it with the hammer to improve its condition. -By default, a hammer can be repaired on the anvil just like any other tool, allowing for infinite recycling of worn tools. Set "anvil_hammer_is_repairable false" to prevent this. \ No newline at end of file +By default, a hammer can be repaired on the anvil just like any other tool, allowing for infinite recycling of worn tools. Set "anvil_hammer_is_repairable false" to prevent this. + +Any tool belonging to the group "not_repaired_by_anvil" can't be repaired at an anvil. + +The API function anvil.make_unrepairable(item_name) can be used as a convenience function to add this group to an already-registered tool. \ No newline at end of file diff --git a/init.lua b/init.lua index 3b45d88..9c84536 100644 --- a/init.lua +++ b/init.lua @@ -16,15 +16,15 @@ minetest.register_alias("castle:anvil", "anvil:anvil") local hammer_repairable = minetest.setting_getbool("anvil_hammer_is_repairable") if hammer_repairable == nil then hammer_repairable = true end -local make_unrepairable = function(item_name) +anvil.make_unrepairable = function(item_name) local item_def = minetest.registered_items[item_name] if item_def then item_def.groups.not_repaired_by_anvil = 1 minetest.override_item(item_name, {groups = item_def.groups}) end end -make_unrepairable("technic:water_can") -make_unrepairable("technic:lava_can") +anvil.make_unrepairable("technic:water_can") +anvil.make_unrepairable("technic:lava_can") -- internationalization boilerplate local MP = minetest.get_modpath(minetest.get_current_modname())