From 9db8d950146dbb55bbdcd5b788f445f95f936c6f Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Wed, 22 Nov 2023 20:28:38 +0100 Subject: [PATCH] Notify network master when machine is not fully charged --- machines/common.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/machines/common.lua b/machines/common.lua index c502ac0..86bfe33 100644 --- a/machines/common.lua +++ b/machines/common.lua @@ -292,6 +292,16 @@ function industrialtest.internal.registerMachine(config) shouldRerunTimer,shouldUpdateFormspec=config.activeOnTimer(pos,elapsed,meta,inv) end + local def=minetest.registered_nodes[minetest.get_node(pos).name] + if def.groups and def.groups._industrialtest_hasPowerInput and not industrialtest.api.isFullyCharged(meta) then + local networks=industrialtest.api.isAttachedToNetwork(meta) + if networks then + for _,network in ipairs(networks) do + minetest.get_node_timer(network):start(industrialtest.updateDelay) + end + end + end + if shouldUpdateFormspec then machine.updateFormspec(pos,config) end