diff --git a/lua_controller/controller.lua b/lua_controller/controller.lua index 68fe4df..bdeab02 100644 --- a/lua_controller/controller.lua +++ b/lua_controller/controller.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2020 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -654,4 +654,27 @@ techage.register_node({"techage:ta4_lua_controller"}, { return "unsupported" end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local meta = minetest.get_meta(pos) + local number = meta:get_string("number") + + if topic == 1 and payload[1] == 1 then + set_input(pos, number, src, "on") + elseif topic == 1 and payload[1] == 0 then + set_input(pos, number, src, "off") + else + return 2 + end + return 0 + end, + on_beduino_request_data = function(pos, src, topic, payload) + local meta = minetest.get_meta(pos) + + if topic == 129 then + local running = meta:get_int("running") or STATE_STOPPED + return 0, running + else + return 2, "" + end + end, }) diff --git a/lua_controller/sensorchest.lua b/lua_controller/sensorchest.lua index 5a483b9..5344879 100644 --- a/lua_controller/sensorchest.lua +++ b/lua_controller/sensorchest.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2020 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -46,6 +46,13 @@ local function send_command(pos) end end +local function get_stack(pos, idx) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack("main", idx) + return stack:get_name(), stack:get_count() +end + local function get_stacks(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() @@ -215,7 +222,7 @@ techage.register_node({"techage:ta4_sensor_chest"}, { elseif topic == "action" then local meta = minetest.get_meta(pos) local number = meta:get_string("node_number") - return PlayerActions[number][1], PlayerActions[number][2] + return (PlayerActions[number] or {})[1], (PlayerActions[number] or {})[2] elseif topic == "stacks" then return get_stacks(pos) elseif topic == "text" then @@ -226,6 +233,40 @@ techage.register_node({"techage:ta4_sensor_chest"}, { return "unsupported" end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + if topic == 66 then + local meta = minetest.get_meta(pos) + meta:set_string("text", tostring(payload)) + meta:set_string("formspec", formspec2(pos)) + return 0 + else + return 2 + end + end, + on_beduino_request_data = function(pos, src, topic, payload) + if topic == 131 then -- Chest State + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return 0, {techage.get_inv_state(inv, "main")} + elseif topic == 138 and payload[1] == 1 then -- Sensor Chests State (action) + local meta = minetest.get_meta(pos) + local number = meta:get_string("node_number") + local action = (PlayerActions[number] or {})[2] or "None" + return 0, {({put = 1, get = 2})[action] or 0} + elseif topic == 138 and payload[1] == 2 then -- Sensor Chests State (player name) + local meta = minetest.get_meta(pos) + local number = meta:get_string("node_number") + return 0, {(PlayerActions[number] or {})[1]} + elseif topic == 138 and payload[1] == 3 then -- Sensor Chests State (stack item name) + local name, _ = get_stack(pos, payload[2] or 1) + return 0, {name} + elseif topic == 138 and payload[1] == 4 then -- Sensor Chests State (stack item count) + local _, count = get_stack(pos, payload[2] or 1) + return 0, {count} + else + return 2, "" + end + end, }) minetest.register_craft({ diff --git a/move_controller/doorcontroller.lua b/move_controller/doorcontroller.lua index f859290..2b99ad7 100644 --- a/move_controller/doorcontroller.lua +++ b/move_controller/doorcontroller.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2020 Joachim Stolberg + Copyright (C) 2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -124,6 +124,17 @@ techage.register_node({"techage:ta3_doorcontroller"}, { swap_door_nodes(pos, false) end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + if topic == 1 and payload[1] == 1 then + swap_door_nodes(pos, true) + return 0 + elseif topic == 1 and payload[1] == 0 then + swap_door_nodes(pos, false) + return 0 + else + return 2 + end + end, }) minetest.register_craft({ diff --git a/move_controller/doorcontroller2.lua b/move_controller/doorcontroller2.lua index 0a7f458..19204d1 100644 --- a/move_controller/doorcontroller2.lua +++ b/move_controller/doorcontroller2.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2020-2021 Joachim Stolberg + Copyright (C) 2020-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -345,6 +345,17 @@ techage.register_node({"techage:ta3_doorcontroller2"}, { end return false end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + if topic == 1 and payload[1] == 1 then + return hide_nodes(pos) and 0 or 3 + elseif topic == 1 and payload[1] == 0 then + return show_nodes(pos) and 0 or 3 + elseif topic == 9 then -- Exchange Block + local nvm = techage.get_nvm(pos) + return exchange_nodes(pos, nvm, payload[1] or 1) and 0 or 3 + end + return 2 + end, on_node_load = function(pos) local meta = M(pos) local nvm = techage.get_nvm(pos) diff --git a/move_controller/flycontroller.lua b/move_controller/flycontroller.lua index 7bdf96c..4f1c7ed 100644 --- a/move_controller/flycontroller.lua +++ b/move_controller/flycontroller.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2020-2021 Joachim Stolberg + Copyright (C) 2020-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -228,6 +228,33 @@ techage.register_node({"techage:ta5_flycontroller"}, { end return false end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 11 then + if payload[1] == 1 then + nvm.moveBA = true + nvm.running = true + return fly.move_to_other_pos(pos, false) and 0 or 3 + elseif payload[1] == 2 then + nvm.moveBA = false + nvm.running = true + return fly.move_to_other_pos(pos, true) and 0 or 3 + elseif payload[1] == 3 then + nvm.moveBA = nvm.moveBA == false + nvm.running = true + return fly.move_to_other_pos(pos, nvm.moveBA == false) and 0 or 3 + end + else + return 2 + end + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 129 then + return 0, {nvm.running and 1 or 6} + end + return 2, "" + end, }) minetest.register_craft({ diff --git a/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index ab000ec..8afaeee 100644 --- a/move_controller/movecontroller.lua +++ b/move_controller/movecontroller.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2020-2021 Joachim Stolberg + Copyright (C) 2020-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -204,6 +204,33 @@ techage.register_node({"techage:ta4_movecontroller"}, { end return false end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 11 then + if payload[1] == 1 then + nvm.moveBA = true + nvm.running = true + return fly.move_to_other_pos(pos, false) and 0 or 3 + elseif payload[1] == 2 then + nvm.moveBA = false + nvm.running = true + return fly.move_to_other_pos(pos, true) and 0 or 3 + elseif payload[1] == 3 then + nvm.moveBA = nvm.moveBA == false + nvm.running = true + return fly.move_to_other_pos(pos, nvm.moveBA == false) and 0 or 3 + end + else + return 2 + end + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 129 then + return 0, {nvm.running and 1 or 6} + end + return 2, "" + end, }) minetest.register_craft({ diff --git a/move_controller/turncontroller.lua b/move_controller/turncontroller.lua index effcddc..33a3b56 100644 --- a/move_controller/turncontroller.lua +++ b/move_controller/turncontroller.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2020-2021 Joachim Stolberg + Copyright (C) 2020-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -156,6 +156,43 @@ techage.register_node({"techage:ta4_turncontroller"}, { end return false end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 12 then + if payload[1] == 1 then + local nvm = techage.get_nvm(pos) + local new_posses = fly.rotate_nodes(pos, nvm.lpos, "l") + if new_posses then + nvm.lpos = new_posses + return 0 + end + return 3 + elseif payload[1] == 2 then + local nvm = techage.get_nvm(pos) + local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") + if new_posses then + nvm.lpos = new_posses + return 0 + end + return 3 + elseif payload[1] == 3 then + local nvm = techage.get_nvm(pos) + local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") + if new_posses then + nvm.lpos = new_posses + new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") + if new_posses then + nvm.lpos = new_posses + return 0 + end + end + return 3 + end + return 2 + else + return 2 + end + end, }) minetest.register_craft({ diff --git a/oil/drillbox.lua b/oil/drillbox.lua index deec9fb..0061596 100644 --- a/oil/drillbox.lua +++ b/oil/drillbox.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2020 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -255,6 +255,12 @@ local tubing = { on_recv_message = function(pos, src, topic, payload) return CRD(pos).State:on_receive_message(pos, topic, payload) end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + return CRD(pos).State:on_beduino_request_data(pos, topic, payload) + end, on_node_load = function(pos, node) CRD(pos).State:on_node_load(pos) local nvm = techage.get_nvm(pos) diff --git a/oil/pumpjack.lua b/oil/pumpjack.lua index 7088107..ff66028 100644 --- a/oil/pumpjack.lua +++ b/oil/pumpjack.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 @@ -186,6 +186,24 @@ local tubing = { return CRD(pos).State:on_receive_message(pos, topic, payload) end end, + on_beduino_request_data = function(pos, src, topic, payload) + if topic == 134 then -- Load + local storage_pos = M(pos):get_string("storage_pos") + if storage_pos ~= "" then + local amount, capa = techage.explore.get_oil_amount(P(storage_pos)) + if amount and capa and capa > 0 then + if payload[1] == 1 then + return 0, {techage.power.percent(capa or 0, amount or 0)} + else + return 0, {math.min(amount or 0, 65535)} + end + end + end + return 2 + else + return CRD(pos).State:on_beduino_request_data(pos, topic, payload) + end + end, on_node_load = function(pos, node) CRD(pos).State:on_node_load(pos) if node.name == "techage:ta3_pumpjack_act" then diff --git a/oil/reboiler.lua b/oil/reboiler.lua index 51cdc41..a78d7fd 100644 --- a/oil/reboiler.lua +++ b/oil/reboiler.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 @@ -254,15 +254,6 @@ liquid.register_nodes({"techage:ta3_reboiler", "techage:ta3_reboiler_on"}, Pipe, power.register_nodes({"techage:ta3_reboiler", "techage:ta3_reboiler_on"}, Cable, "con") techage.register_node({"techage:ta3_reboiler", "techage:ta3_reboiler_on"}, { - on_recv_message = function(pos, src, topic, payload) - local nvm = techage.get_nvm(pos) - if topic == "state" then - nvm.state = nvm.state or techage.STOPPED - return techage.StateStrings[nvm.state] - else - return "unsupported" - end - end, on_node_load = function(pos, node) if node.name == "techage:ta3_reboiler_on" then play_sound(pos) diff --git a/power/powerswitch.lua b/power/powerswitch.lua index ede50c3..95378ab 100644 --- a/power/powerswitch.lua +++ b/power/powerswitch.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2020 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -255,6 +255,36 @@ techage.register_node({"techage:powerswitch", "techage:powerswitch_on", return "unsupported" end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local node = techage.get_node_lvm(pos) + if topic == 1 and payload[1] == 1 and node.name == "techage:powerswitch" then + switch_on(pos, node, nil, "techage:powerswitch_on") + return 0 + elseif topic == 1 and payload[1] == 1 and node.name == "techage:powerswitchsmall" then + switch_on(pos, node, nil, "techage:powerswitchsmall_on") + return 0 + elseif topic == 1 and payload[1] == 0 and node.name == "techage:powerswitch_on" then + switch_off(pos, node, nil, "techage:powerswitch") + return 0 + elseif topic == 1 and payload[1] == 0 and node.name == "techage:powerswitchsmall_on" then + switch_off(pos, node, nil, "techage:powerswitchsmall") + return 0 + else + return 2 + end + end, + on_beduino_request_data = function(pos, src, topic, payload) + local node = techage.get_node_lvm(pos) + if topic == 142 then + if node.name == "techage:powerswitch_on" or + node.name == "techage:powerswitchsmall_on" then + return 0, {1} + end + return 0, {0} + else + return 2, "" + end + end, }) minetest.register_craft({ diff --git a/solar/inverter.lua b/solar/inverter.lua index 94c87ed..dc65574 100644 --- a/solar/inverter.lua +++ b/solar/inverter.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 @@ -218,6 +218,17 @@ techage.register_node({"techage:ta4_solar_inverter"}, { return State:on_receive_message(pos, topic, payload) end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 135 then -- Delivered Power + return 0, {math.floor((nvm.provided or 0) + 0.5)} + else + return State:on_beduino_request_data(pos, topic, payload) + end + end, }) control.register_nodes({"techage:ta4_solar_inverter"}, { diff --git a/solar/minicell.lua b/solar/minicell.lua index 1364ec1..6eedee5 100644 --- a/solar/minicell.lua +++ b/solar/minicell.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 @@ -120,6 +120,20 @@ techage.register_node({"techage:ta4_solar_minicell"}, { return "unsupported" end end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 145 then -- Solar Cell State + if nvm.providing then + return 0, {2} + elseif (nvm.capa or 0) > 0 then + return 0, {1} + else + return 0, {0} + end + else + return 2, "" + end + end, on_node_load = function(pos) minetest.get_node_timer(pos):start(CYCLE_TIME) end, diff --git a/ta3_power/akkubox.lua b/ta3_power/akkubox.lua index f856c6f..e3276a7 100644 --- a/ta3_power/akkubox.lua +++ b/ta3_power/akkubox.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2020 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -172,6 +172,17 @@ techage.register_node({"techage:ta3_akku"}, { return State:on_receive_message(pos, topic, payload) end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 134 then -- load + return 0, {math.floor(techage.power.percent(PWR_CAPA, nvm.capa) + 0.5)} + else + return State:on_beduino_request_data(pos, topic, payload) + end + end, }) control.register_nodes({"techage:ta3_akku"}, { diff --git a/ta3_power/tiny_generator.lua b/ta3_power/tiny_generator.lua index db82c46..a6d31a9 100644 --- a/ta3_power/tiny_generator.lua +++ b/ta3_power/tiny_generator.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 @@ -338,6 +338,19 @@ techage.register_node({"techage:tiny_generator", "techage:tiny_generator_on"}, { return State:on_receive_message(pos, topic, payload) end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 135 then + return 0, {nvm.provided or 0} + elseif topic == 132 then + return 0, {techage.fuel.get_fuel_amount(nvm)} + else + return State:on_beduino_request_data(pos, topic, payload) + end + end, on_node_load = function(pos, node) State:on_node_load(pos) if node.name == "techage:tiny_generator_on" then diff --git a/ta4_power/electricmeter.lua b/ta4_power/electricmeter.lua index 75c149b..ca10ad9 100644 --- a/ta4_power/electricmeter.lua +++ b/ta4_power/electricmeter.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 @@ -160,6 +160,17 @@ techage.register_node({"techage:ta4_electricmeter"}, { return State:on_receive_message(pos, topic, payload) end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 146 then -- Consumption + return 0, {math.floor((nvm.units or 0) / techage.CYCLES_PER_DAY)} + else + return State:on_beduino_request_data(pos, topic, payload) + end + end, }) control.register_nodes({"techage:ta4_electricmeter"}, { diff --git a/ta4_power/laser.lua b/ta4_power/laser.lua index 9391d2d..ad1eb73 100644 --- a/ta4_power/laser.lua +++ b/ta4_power/laser.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2021 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg GPL v3 See LICENSE.txt for more information @@ -135,6 +135,14 @@ techage.register_node({"techage:ta4_laser_emitter"}, { return "unsupported" end end, + on_beduino_request_data = function(pos, src, topic, payload) + if topic == 142 then -- Binary State + local nvm = techage.get_nvm(pos) + return 0, {nvm.running and 1 or 0} + else + return 2, "" + end + end, }) power.register_nodes({"techage:ta4_laser_emitter", "techage:ta4_laser_receiver"}, Cable, "special", {"F"}) diff --git a/ta4_power/transformer.lua b/ta4_power/transformer.lua index 225df2c..d1ff216 100644 --- a/ta4_power/transformer.lua +++ b/ta4_power/transformer.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 @@ -150,6 +150,12 @@ techage.register_node({"techage:ta4_transformer"}, { on_recv_message = function(pos, src, topic, payload) return State:on_receive_message(pos, topic, payload) end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + return State:on_beduino_request_data(pos, topic, payload) + end, }) control.register_nodes({"techage:ta4_transformer"}, { diff --git a/teleport/teleport_pipe.lua b/teleport/teleport_pipe.lua index 7196ea6..e07a167 100644 --- a/teleport/teleport_pipe.lua +++ b/teleport/teleport_pipe.lua @@ -186,6 +186,12 @@ techage.register_node({"techage:ta5_tele_pipe"}, { on_recv_message = function(pos, src, topic, payload) return State:on_receive_message(pos, topic, payload) end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + return State:on_beduino_request_data(pos, topic, payload) + end, }) power.register_nodes({"techage:ta5_tele_pipe"}, Cable, "con", {"B", "R", "F", "D", "U"}) diff --git a/teleport/teleport_tube.lua b/teleport/teleport_tube.lua index 11517d3..d1e278a 100644 --- a/teleport/teleport_tube.lua +++ b/teleport/teleport_tube.lua @@ -175,6 +175,12 @@ techage.register_node({"techage:ta5_tele_tube"}, { on_recv_message = function(pos, src, topic, payload) return State:on_receive_message(pos, topic, payload) end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + return State:on_beduino_receive_cmnd(pos, topic, payload) + end, + on_beduino_request_data = function(pos, src, topic, payload) + return State:on_beduino_request_data(pos, topic, payload) + end, }) power.register_nodes({"techage:ta5_tele_tube"}, Cable, "con", {"B", "R", "F", "D", "U"}) diff --git a/wind_turbine/rotor.lua b/wind_turbine/rotor.lua index 34670ea..a73e6b3 100644 --- a/wind_turbine/rotor.lua +++ b/wind_turbine/rotor.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2021 DS-Minetest, Joachim Stolberg + Copyright (C) 2019-2022 DS-Minetest, Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -307,6 +307,37 @@ techage.register_node({"techage:ta4_wind_turbine"}, { return "unsupported" end end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 1 and payload[1] == 1 then + State:start(pos, nvm) + elseif topic == 1 and payload[1] == 0 then + State:stop(pos, nvm) + else + return 2 + end + return 0 + end, + on_beduino_request_data = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == 129 then + local node = minetest.get_node(pos) + if node.name == "ignore" then -- unloaded node? + return 0, {7} -- unloaded + end + if nvm.error then + return 0, {5} -- fault + elseif techage.is_running(nvm) then + return 0, {1} -- running + else + return 0, {6} -- stopped + end + elseif topic == 135 then -- Delivered Power + return 0, {nvm.delivered or 0} + else + return 2, "" + end + end, on_node_load = function(pos) local nvm = techage.get_nvm(pos) add_rotor(pos, nvm, true)