forked from mrkubax10/industrialtest
Only split power distribution between not fully charged endpoints
This commit is contained in:
parent
51058a39cb
commit
32669afafe
12
api.lua
12
api.lua
@ -229,7 +229,17 @@ industrialtest.api.powerFlow=function(pos)
|
||||
return false,false
|
||||
end
|
||||
local powerFlow=meta:get_int("industrialtest.powerFlow")
|
||||
local powerDistribution=math.floor(powerFlow/#network)
|
||||
local endpointCount=0
|
||||
for _,endpoint in ipairs(network) do
|
||||
local endpointMeta=minetest.get_meta(endpoint.position)
|
||||
if not industrialtest.api.isFullyCharged(endpointMeta) then
|
||||
endpointCount=endpointCount+1
|
||||
end
|
||||
end
|
||||
if endpointCount==0 then
|
||||
return false,false
|
||||
end
|
||||
local powerDistribution=math.floor(powerFlow/endpointCount)
|
||||
local transferred=false
|
||||
local roomAvailable=false
|
||||
for _,endpoint in ipairs(network) do
|
||||
|
Loading…
Reference in New Issue
Block a user