From b36da79c0447187df2d0102684e73d909cb18b75 Mon Sep 17 00:00:00 2001 From: chksm Date: Sun, 15 May 2022 17:24:36 +0100 Subject: [PATCH] get_flow_count should now support *FlowStatistics types --- script/fetcher.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/fetcher.lua b/script/fetcher.lua index 60440c7..6495907 100644 --- a/script/fetcher.lua +++ b/script/fetcher.lua @@ -56,7 +56,8 @@ this.callOverlayFunction = function(functionName, callback, name, parent, args) end -- flow statistics - elseif functionName == "get_flow_count" and (parent.object_name == "LuaFlowStatistics" or parent.object_name == "LuaItemProductionFlowStatistics") then + -- worst hack to validate that parent inherits from FlowStatistics + elseif functionName == "get_flow_count" and string.sub(parent.object_name, -14) == "FlowStatistics" then if args[2] == 'input' then isInput = true else isInput = false end @@ -83,6 +84,11 @@ this.callOverlayFunction = function(functionName, callback, name, parent, args) end + elseif functionName == "get_flow_count" then + + game.players[1].print("Cannot get_flow_count for unexpected instance of:") + game.players[1].print(parent.object_name) + end end