Command line flag (dump-defines) to dump prototype defines

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Redruin
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jan 29, 2021 10:48 pm
Contact:

Command line flag (dump-defines) to dump prototype defines

Post by Redruin »

What?
1.1.77's patch notes add several data-extraction oriented command line options:
  • Added a command line flag (dump-data) to dump data-raw to the script output folder as json.
  • Added a command line flag (dump-icon-sprites) to dump prototype icons to the script output folder.
  • Added a command line flag (dump-prototype-locale) to dump prototype locale to the script output folder.
My proposal is to add another option (dump-defines) that would dump either a Lua or JSON table of the API defines to script output.
Why?
In order for the Factorio data-stage of the load process to take place, this table must exist in the Lua context under the name `defines`. This is important when emulating this load process (a la my module draftsman), but the data is not provided in Wube's official factorio-data repo, nor the official API website. Instead, it has to be manually extracted from the game (for each game version) with the command:

Code: Select all

/c game.write_file("defines.lua", "defines = " .. serpent.block(defines, {indent="    "}))
By adding a command line option for this it potentially opens up the option for a completely automated workflow where all information needed for the load-process can be extracted automatically on Factorio version bump.
Alternatively:
It would also be perfectly fine if this defines file was included in some way in the "factorio-data" repo, which would make this option unnecessary. But I imagine that such data actually lies in C++ code (which will have to be converted every version anyway) and introducing such a file might create complications.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 627
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Command line flag (dump-defines) to dump prototype defines

Post by Xorimuth »

You can use the existing command line arguments to load a specific directory of mods (which would have a mod that runs your defines dump command) and to load into a specific save so that the mod is loaded and can run its command.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Post Reply

Return to “Ideas and Suggestions”