Trigger network master if endpoint is not fully charged

This commit is contained in:
2023-11-16 17:33:36 +01:00
parent 8724b563c4
commit bd51f1d18f
2 changed files with 14 additions and 3 deletions

View File

@@ -134,6 +134,16 @@ machine.onTimer=function(pos,elapsed,config)
shouldRerunTimer,shouldUpdateFormspec=config.onTimer(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