Allow to turn the concentrator with the new screwdriver

This commit is contained in:
Joachim Stolberg 2022-01-06 10:13:18 +01:00
parent ca8929fa9d
commit aedf234ae5
2 changed files with 15 additions and 3 deletions

View File

@ -3,7 +3,7 @@
TechAge
=======
Copyright (C) 2019-2021 Joachim Stolberg
Copyright (C) 2019-2022 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
@ -54,6 +54,12 @@ local names = networks.register_junction("techage:concentrator", 2/8, Boxes, Tub
local name = "techage:concentrator"..networks.junction_type(pos, Tube, "R", node.param2)
minetest.swap_node(pos, {name = name, param2 = node.param2})
end,
ta_rotate_node = function(pos, node, new_param2)
Tube:after_dig_node(pos)
minetest.swap_node(pos, {name = node.name, param2 = new_param2})
Tube:after_place_node(pos)
M(pos):set_int("push_dir", techage.side_to_outdir("R", new_param2))
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_node(pos)
end,
@ -93,6 +99,12 @@ names = networks.register_junction("techage:ta4_concentrator", 2/8, Boxes, Tube,
local name = "techage:ta4_concentrator"..networks.junction_type(pos, Tube, "R", node.param2)
minetest.swap_node(pos, {name = name, param2 = node.param2})
end,
ta_rotate_node = function(pos, node, new_param2)
Tube:after_dig_node(pos)
minetest.swap_node(pos, {name = node.name, param2 = new_param2})
Tube:after_place_node(pos)
M(pos):set_int("push_dir", techage.side_to_outdir("R", new_param2))
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
Tube:after_dig_node(pos)
end,

View File

@ -54,12 +54,12 @@ end
local function store_node_param2(user, node)
user:get_meta():set_string("techage_screwdriver_param2", node.param2)
user:get_meta():set_int("techage_screwdriver_param2", node.param2)
minetest.chat_send_player(user:get_player_name(), S("Block alignment stored!"))
end
local function turn_node_param2(pos, node, ndef, user)
local param2 = user:get_meta():get_string("techage_screwdriver_param2")
local param2 = user:get_meta():get_int("techage_screwdriver_param2") or 0
if ndef.ta_rotate_node then
ndef.ta_rotate_node(pos, node, param2)
else