From e64e3a1fcfb83b482667768f3ee7d3890d4d5f94 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Wed, 29 Mar 2023 10:15:19 +0200 Subject: [PATCH] Fix power returning back from transformer to where it came from --- machines.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/machines.lua b/machines.lua index 7f3534d..8764284 100644 --- a/machines.lua +++ b/machines.lua @@ -1229,8 +1229,8 @@ local function registerTransformer(config) local lowerPowerDistribution=0 for key,value in ipairs(neighbourPositions) do - if industrialtest.api.hasPowerStorage(minetest.get_meta(value)) then - local normalized=industrialtest.api.normalizeSide(pos,key) + local normalized=industrialtest.api.normalizeSide(pos,key) + if industrialtest.api.hasPowerStorage(minetest.get_meta(value)) and industrialtest.api.isPowerOutput(meta,normalized) then if normalized==5 then upperPowerDistribution=config.upperFlow else @@ -1262,9 +1262,12 @@ local function registerTransformer(config) end end + meta:set_string("industrialtest.ioConfig","aaaaaa") + return (meta:get_int("industrialtest.powerAmount")>0 and roomAvailable) end, - _industrialtest_onPowerFlow=function(pos) + _industrialtest_onPowerFlow=function(pos,side) + industrialtest.api.changeIoConfig(minetest.get_meta(pos),industrialtest.api.normalizeSide(pos,side),"i") minetest.get_node_timer(pos):start(industrialtest.updateDelay) end }