Use repairkit to reactivate broken techage nodes

This commit is contained in:
Joachim Stolberg 2023-01-24 21:24:14 +01:00
parent 436fec17d2
commit d8d655e516

View File

@ -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", ""},
-- {"", "", ""},
-- },
--})