From aedf234ae50ce3de41a9a932f2530e4f9f2ba545 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Thu, 6 Jan 2022 10:13:18 +0100 Subject: [PATCH] Allow to turn the concentrator with the new screwdriver --- basic_machines/concentrator.lua | 14 +++++++++++++- tools/screwdriver.lua | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/basic_machines/concentrator.lua b/basic_machines/concentrator.lua index 40e836d..cba0f58 100644 --- a/basic_machines/concentrator.lua +++ b/basic_machines/concentrator.lua @@ -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, diff --git a/tools/screwdriver.lua b/tools/screwdriver.lua index e0bf50a..26f0929 100644 --- a/tools/screwdriver.lua +++ b/tools/screwdriver.lua @@ -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