From 2c21f989ae2fd0253e99d21a7bdeed75fecaa1f6 Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 May 2022 22:29:11 +0200 Subject: [PATCH] fix(graftorio): config issues --- config/graftorio.lua | 7 ++++--- modules/graftorio/forcestats.lua | 3 ++- modules/graftorio/require.lua | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/config/graftorio.lua b/config/graftorio.lua index 2f80e5fc..20dca369 100644 --- a/config/graftorio.lua +++ b/config/graftorio.lua @@ -1,6 +1,7 @@ return { modules = { - ["forcestats"]=true, - ["general"]=true, + ["forcestats"] = true, + ["logistorage"] = false, + ["general"] = true, } -} \ No newline at end of file +} diff --git a/modules/graftorio/forcestats.lua b/modules/graftorio/forcestats.lua index fa95dc69..e7e1f9fe 100644 --- a/modules/graftorio/forcestats.lua +++ b/modules/graftorio/forcestats.lua @@ -1,5 +1,6 @@ local Event = require("utils.event") local general = require("modules.graftorio.general") +local config = require("config.graftorio") local lib = {} @@ -114,7 +115,7 @@ lib.collect_loginet = function() stats.to_charge_robot_count = (stats.to_charge_robot_count) + cell.to_charge_robot_count end - if settings.general.data["graftorio-logistic-items"].value then + if config.modules.logistorage then for name, v in pairs(network.get_contents()) do stats.items[name] = (stats.items[name] or 0) + v end diff --git a/modules/graftorio/require.lua b/modules/graftorio/require.lua index c94d0608..d4c05257 100644 --- a/modules/graftorio/require.lua +++ b/modules/graftorio/require.lua @@ -1,12 +1,14 @@ local Commands = require("expcore.commands") local config = require("config.graftorio") - -local general = require("modules.graftorio.general") local statics = require("modules.graftorio.statics") -local forcestats = {} +local forcestats = nil +local general = nil if config.modules.forcestats then forcestats = require("modules.graftorio.forcestats") end +if config.modules.general then + general = require("modules.graftorio.general") +end Commands.new_command("collectdata", "Collect data for RCON usage") :add_param("location", true) @@ -14,9 +16,10 @@ Commands.new_command("collectdata", "Collect data for RCON usage") -- this must be first as it overwrites the stats -- also makes the .other table for all forces statics.collect_statics() - general.collect_other() + if config.modules.general then general.collect_other() end if config.modules.forcestats then forcestats.collect_production() + forcestats.collect_loginet() end rcon.print(game.table_to_json(general.data.output)) return Commands.success()