Take into account machine ioConfig when transferring power
This commit is contained in:
parent
174798262b
commit
319d3102f6
2
api.lua
2
api.lua
|
@ -64,7 +64,7 @@ industrialtest.api.powerFlow=function(pos)
|
|||
end
|
||||
local neighboursContainingPower=0
|
||||
for key,value in ipairs(neighbours) do
|
||||
if industrialtest.api.hasPowerStorage(value) then
|
||||
if industrialtest.api.hasPowerStorage(value) and value:get_string("industrialtest.ioConfig")[key%2==0 and key+1 or key-1]=="i" then
|
||||
neighboursContainingPower=neighboursContainingPower+1
|
||||
else
|
||||
neighbourPositions[key]=nil
|
||||
|
|
|
@ -18,7 +18,6 @@ local S=minetest.get_translator("industrialtest")
|
|||
|
||||
-- Generators
|
||||
local function generatorFormspec(fuelPercent,charged)
|
||||
minetest.chat_send_all(charged)
|
||||
local formspec={
|
||||
industrialtest.formspecVersion(),
|
||||
"size[10.8,12]",
|
||||
|
@ -89,6 +88,7 @@ local definition={
|
|||
meta:set_int("fuelTime",fuelTime)
|
||||
industrialtest.api.addPower(meta,100)
|
||||
meta:set_string("formspec",generatorFormspec(fuelTime/meta:get_int("maxFuelTime")*100,meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")))
|
||||
industrialtest.api.powerFlow(pos)
|
||||
if fuelTime>0 or fuelList[1]:get_count()>0 then
|
||||
return true
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue