From 4fb911f5a2e2499e0c139450d35ac99ddd5a5fa8 Mon Sep 17 00:00:00 2001 From: Someone Date: Sat, 1 Jun 2019 20:44:57 +0200 Subject: [PATCH] Updated and gitified another trivial mod. --- License.txt | 19 +++++++++++++++++++ changelog.txt | 6 ++++++ control.lua | 28 ++++++++++++++++++++++++++++ info.json | 10 ++++++++++ 4 files changed, 63 insertions(+) create mode 100644 License.txt create mode 100644 changelog.txt create mode 100644 control.lua create mode 100644 info.json diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..ae7e15e --- /dev/null +++ b/License.txt @@ -0,0 +1,19 @@ +Copyright (c) 2018-2020 Someone + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..07bdc5e --- /dev/null +++ b/changelog.txt @@ -0,0 +1,6 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.17.1 +Date: 2019-06-01 + + Changed: + - Another trivial mod gitified and updated to Factorio 0.17.x diff --git a/control.lua b/control.lua new file mode 100644 index 0000000..845a24a --- /dev/null +++ b/control.lua @@ -0,0 +1,28 @@ + +script.on_event(defines.events.on_tick, function(event) + if event.tick % 5000 == 0 then + local f = game.forces["player"] + log("\n\ntick:"..game.tick.."\titem\tproduced\tconsumed\tlost\tdiff") + for k, prod in pairs(f.item_production_statistics.input_counts) do + local cons = 0 + local lost = 0 + if f.item_production_statistics.output_counts[k] then + cons = f.item_production_statistics.output_counts[k] + end + if f.kill_count_statistics.output_counts[k] then + lost = f.kill_count_statistics.output_counts[k] + end + log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost)) + end + for k, cons in pairs(f.item_production_statistics.output_counts) do + local prod = 0 + local lost = 0 + if f.kill_count_statistics.output_counts[k] then + lost = f.kill_count_statistics.output_counts[k] + end + if not f.item_production_statistics.input_counts[k] then + log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost)) + end + end + end +end) diff --git a/info.json b/info.json new file mode 100644 index 0000000..b6ceb1b --- /dev/null +++ b/info.json @@ -0,0 +1,10 @@ +{ + "name": "some-benchmark", + "version": "0.17.1", + "title": "Someone's production benchmark logger", + "author": "someone1337", + "homepage": "https://git.somenet.org/pub/jan/factorio_some-benchmark.git", + "description": "Periodic logging of production/consumption stats.", + "dependencies": ["base >= 0.17"], + "factorio_version": "0.17" +} -- 2.43.0