expose make_unrepairable
This commit is contained in:
parent
a6fa5984e2
commit
6969e7baff
@ -3,3 +3,7 @@ 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.
|
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.
|
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.
|
6
init.lua
6
init.lua
@ -16,15 +16,15 @@ minetest.register_alias("castle:anvil", "anvil:anvil")
|
|||||||
local hammer_repairable = minetest.setting_getbool("anvil_hammer_is_repairable")
|
local hammer_repairable = minetest.setting_getbool("anvil_hammer_is_repairable")
|
||||||
if hammer_repairable == nil then hammer_repairable = true end
|
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]
|
local item_def = minetest.registered_items[item_name]
|
||||||
if item_def then
|
if item_def then
|
||||||
item_def.groups.not_repaired_by_anvil = 1
|
item_def.groups.not_repaired_by_anvil = 1
|
||||||
minetest.override_item(item_name, {groups = item_def.groups})
|
minetest.override_item(item_name, {groups = item_def.groups})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
make_unrepairable("technic:water_can")
|
anvil.make_unrepairable("technic:water_can")
|
||||||
make_unrepairable("technic:lava_can")
|
anvil.make_unrepairable("technic:lava_can")
|
||||||
|
|
||||||
-- internationalization boilerplate
|
-- internationalization boilerplate
|
||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user