Notify network master when machine is not fully charged

This commit is contained in:
mrkubax10 2023-11-22 20:28:38 +01:00
parent 079c0df83a
commit 9db8d95014
1 changed files with 10 additions and 0 deletions

View File

@ -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