]> git.somenet.org - factorio/some-benchmark.git/blob - control.lua
RELEASE 1.0.0. - No functional changes.
[factorio/some-benchmark.git] / control.lua
1
2 script.on_event(defines.events.on_tick, function(event)
3         if event.tick % 7200 == 0 then
4         local f = game.forces["player"]
5         log("\n\ntick:"..game.tick.."\titem\tproduced\tconsumed\tlost\tdiff")
6         for k, prod in pairs(f.item_production_statistics.input_counts) do
7             local cons = 0
8             local lost = 0
9             if f.item_production_statistics.output_counts[k] then
10                 cons = f.item_production_statistics.output_counts[k]
11             end
12             if f.kill_count_statistics.output_counts[k] then
13                 lost = f.kill_count_statistics.output_counts[k]
14             end
15             log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost))
16         end
17         for k, cons in pairs(f.item_production_statistics.output_counts) do
18             local prod = 0
19             local lost = 0
20             if f.kill_count_statistics.output_counts[k] then
21                 lost = f.kill_count_statistics.output_counts[k]
22             end
23             if not f.item_production_statistics.input_counts[k] then
24                 log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost))
25             end
26         end
27
28         for k, prod in pairs(f.fluid_production_statistics.input_counts) do
29             local cons = 0
30             local lost = 0
31             if f.fluid_production_statistics.output_counts[k] then
32                 cons = f.fluid_production_statistics.output_counts[k]
33             end
34             if f.kill_count_statistics.output_counts[k] then
35                 lost = f.kill_count_statistics.output_counts[k]
36             end
37             log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost))
38         end
39         for k, cons in pairs(f.fluid_production_statistics.output_counts) do
40             local prod = 0
41             local lost = 0
42             if f.kill_count_statistics.output_counts[k] then
43                 lost = f.kill_count_statistics.output_counts[k]
44             end
45             if not f.fluid_production_statistics.input_counts[k] then
46                 log("\t"..k.."\t"..prod.."\t"..(-cons).."\t"..(-lost).."\t"..(prod-cons-lost))
47             end
48         end
49     end
50 end)