Factorio Dashboard Exporter


Exports live factory statistics (power, machines, production, trains, logistics, resources, platforms, research) for an external dashboard. All work is spread across ticks with a hard per-tick budget, so it does not stall the game like /silent-command polling does. Data is written to script-output/fdash/ and is also available via a remote interface for RCON.

Utilities
a month ago
2.0
82
Logistics Trains Fluids Logistic network Power

b Don't create an export file

2 months ago

Mod don't create an export file in scripts-output/fdash. I solved by changing publish.lua and protoexport.lua
Singleplayer, Factorio 2.077

publish.lua:
helpers.write_file(DIR .. name, publish.snapshot_json(), false, 0) -> helpers.write_file(DIR .. name, publish.snapshot_json(), false)

helpers.write_file(DIR .. "index.json", table.concat({
'{"protocol":', PROTOCOL,
',"seq":', storage.pubseq,
',"tick":', tick,
',"file":', jstr(name), '}'
}), false, 0) -> }), false)

protoexport.lua:
local function append(text)
helpers.write_file(FILE, text, true, 0) -> helpers.write_file(FILE, text, true)
end

if s.phase == 0 then
helpers.write_file(FILE, "{", false, 0) -> helpers.write_file(FILE, "{", false)
s.phase = 1
s.i = 0
s.names = nil
s.first = true
append(publish.jstr(PHASES[1].key) .. ":{")
return 1
end

a month ago

Thanks a lot for the report and for tracking it down!
You were right about the cause: the exporter called helpers.write_file with for_player = 0, which means "write only to the server's output".
A singleplayer game has no server, so nothing ended up in script-output/fdash.

I didn't drop the argument completely, because in multiplayer every client would then write the snapshot files too.
Instead, the mod now checks game.is_multiplayer():
in singleplayer it writes without for_player, in multiplayer it keeps 0 so only the server writes.
Tested on 2.0.77 in singleplayer and on a dedicated server.

Fixed in 0.2.3, which is available now. You can remove your local patch and update normally.

New response