From a5eef1c5de77fa7770877802e66c3e1c53f9a0da Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 24 Apr 2019 18:59:36 -0400 Subject: update castles, areas, homedecor, plantlife, gloopblocks, hotbar, inspector, maptools, mesecons, moreblocks, moreores, technic, teleport_request, and worldedit switched to caverealms_lite (with minor fixes by me) switched to CWz's fork of player_textures The homedecor update brings in the big split, and will require you to re-enable all modpack components in order to avoid loss of content. --- anvil/init.lua | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) (limited to 'anvil/init.lua') diff --git a/anvil/init.lua b/anvil/init.lua index fa554cd..324fba1 100644 --- a/anvil/init.lua +++ b/anvil/init.lua @@ -7,18 +7,32 @@ anvil = { setting = { - item_displacement = 7/16, + item_displacement = 2/16, } } 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) + 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") + -- internationalization boilerplate local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") -- the hammer for the anvil -minetest.register_tool("anvil:hammer", { + +local hammer_def = { description = S("Steel blacksmithing hammer"), _doc_items_longdesc = S("A tool for repairing other tools at a blacksmith's anvil."), _doc_items_usagehelp = S("Use this hammer to strike blows upon an anvil bearing a damaged tool and you can repair it. It can also be used for smashing stone, but it is not well suited to this task."), @@ -34,7 +48,13 @@ minetest.register_tool("anvil:hammer", { }, damage_groups = {fleshy=6}, } -}) +} + +if not hammer_repairable then + hammer_def.groups = {["not_repaired_by_anvil"] = 1} +end + +minetest.register_tool("anvil:hammer", hammer_def) local tmp = {} @@ -92,7 +112,14 @@ local update_item = function(pos, node) tmp.texture = inv:get_stack("input", 1):get_name() local e = minetest.add_entity(pos,"anvil:item") local yaw = math.pi*2 - node.param2 * math.pi/2 - e:setyaw(yaw) + if e.set_rotation == nil then + -- This is for 0.4.16 support, remove it eventually + e:set_yaw(yaw) + pos.y = pos.y + 5/16 + e:set_pos(pos) + else + e:set_rotation({x=-1.5708, y=yaw, z=0}) -- x is pitch, 1.5708 is 90 degrees. + end end end @@ -161,14 +188,17 @@ minetest.register_node("anvil:anvil", { if listname~="input" then return 0 end - if (listname=='input' - and(stack:get_wear() == 0 - or minetest.get_item_group(stack:get_name(), "not_repaired_by_anvil") ~= 0 - or stack:get_name() == "technic:water_can" - or stack:get_name() == "technic:lava_can" )) then - - minetest.chat_send_player( player:get_player_name(), S('This anvil is for damaged tools only.')) - return 0 + if (listname=='input') then + if (stack:get_wear() == 0) then + minetest.chat_send_player( player:get_player_name(), S('This anvil is for damaged tools only.')) + return 0 + end + + if (minetest.get_item_group(stack:get_name(), "not_repaired_by_anvil") ~= 0) then + local item_def = minetest.registered_items[stack:get_name()] + minetest.chat_send_player( player:get_player_name(), S('@1 cannot be repaired with an anvil.', item_def.description)) + return 0 + end end if meta:get_inventory():room_for_item("input", stack) then -- cgit v1.2.3