Notify network master when machine is not fully charged
This commit is contained in:
parent
079c0df83a
commit
9db8d95014
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue