From 319d3102f6f03e9af4c46a275ad1d4b93932785e Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Wed, 1 Mar 2023 21:19:00 +0100 Subject: [PATCH] Take into account machine ioConfig when transferring power --- api.lua | 2 +- machines.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index c0d43ca..c56d2f6 100644 --- a/api.lua +++ b/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 diff --git a/machines.lua b/machines.lua index 5aae5d5..0f50424 100644 --- a/machines.lua +++ b/machines.lua @@ -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