diff --git a/tools/repairkit.lua b/tools/repairkit.lua index fab6f38..1ef971e 100644 --- a/tools/repairkit.lua +++ b/tools/repairkit.lua @@ -222,13 +222,29 @@ local function on_place(itemstack, placer, pointed_thing) end end +local function repair(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local pos = pointed_thing.under + if not placer or minetest.is_protected(pos, placer:get_player_name()) then + return + end + local number = techage.get_node_number(pos) + if number and not techage.get_node_info(number) then + techage.repair_number(pos) + minetest.chat_send_player(placer:get_player_name(), "Node repaired!") + itemstack:add_wear(65636/200) + return itemstack + end + end +end + minetest.register_tool("techage:repairkit", { description = S("TechAge Repair Kit"), inventory_image = "techage_repairkit.png", wield_image = "techage_repairkit.png^[transformR270", groups = {cracky=1, book=1}, - --on_use = repair, - --on_place = repair, + on_use = repair, + on_place = repair, node_placement_prediction = "", stack_max = 1, }) @@ -254,3 +270,12 @@ minetest.register_craft({ {"default:steel_ingot", "", ""}, }, }) + +--minetest.register_craft({ +-- output = "techage:repairkit", +-- recipe = { +-- {"", "", ""}, +-- {"", "techage:end_wrench", ""}, +-- {"", "", ""}, +-- }, +--})