#factorio #gaming #definition #export #prototype #com #command

app factorio-cli

用于从Factorio(http://www.factorio.com)导出原型定义的命令行工具

3个版本 (重大更改)

0.4.0 2022年11月26日
0.3.0 2022年11月9日
0.1.0 2022年11月5日

#17 in #factorio

MIT/Apache

170KB
1.5K SLoC

Factorio CLI

一个用于操作与Factorio相关的数据的轻量级实用工具。

目前的主要功能是使用factorio-exporter从Factorio导出原型定义。

crates.io上查看crate页面

示例调用

$ fct --factorio-dir ~/factorio export -f json | jq '.recipe_prototypes["iron-plate"]'
{
  "enabled": true,
  "name": "iron-plate",
  "localised_name": "Iron plate",
  "localised_description": "Unknown key: \"recipe-description.iron-plate\"",
  "category": "smelting",
  "ingredients": [
    {
      "type": "item",
      "name": "iron-ore",
      "amount": 1
    }
  ],
  "products": [
    {
      "type": "item",
      "name": "iron-plate",
      "amount": 1,
      "probability": 1
    }
  ],
  "main_product": {
    "type": "item",
    "name": "iron-plate",
    "amount": 1,
    "probability": 1
  },
  "hidden": false,
  "hidden_from_flow_stats": false,
  "hidden_from_player_crafting": false,
  "always_show_made_in": false,
  "energy": 3.2,
  "order": "b[iron-plate]",
  "group": {
    "name": "intermediate-products"
  },
  "subgroup": {
    "name": "raw-material"
  },
  "request_paste_multiplier": 30,
  "overload_multiplier": 0,
  "allow_inserter_overload": true,
  "allow_as_intermediate": true,
  "allow_intermediates": true,
  "show_amount_in_title": true,
  "always_show_products": false,
  "emissions_multiplier": 1,
  "allow_decomposition": true,
  "unlock_results": true,
  "valid": true,
  "object_name": "LuaRecipePrototype"
}

命令行

$ fct help
A collection of tools for Factorio (<http://www.factorio.com>)

Usage: fct [OPTIONS] <COMMAND>

Commands:
  export
          Exports prototypes from Factorio in JSON or YAML format
  resolve-mods
          Lists all dependencies of a set of mods, trying to find compatible versions
  download-mod
          Download a mod from the mod portal
  login
          Log in to the mod portal API and store the obtained login token
  help
          Print this message or the help of the given subcommand(s)

Options:
      --factorio-dir <FACTORIO_DIR>
          Directory where Factorio is installed. This needs to be the full version. Neither the demo nor the headless version are sufficient. This argument is optional if both of `--factorio-api-spec` and `--factorio-binary` are specified

      --factorio-api-spec <FACTORIO_API_SPEC>
          Location of the `runtime-api.json` file. Defaults to `<FACTORIO_DIR>/doc-html/runtime-api.json`.
          
          The spec can be found in the `doc-html` directory of a full Factorio installation, or [online](https://lua-api.factorio.com/latest/runtime-api.json).

      --factorio-binary <FACTORIO_BINARY>
          Location of the factorio binary. Defaults to `<FACTORIO_DIR>/bin/x64/factorio(.exe)`. This can be any Factorio binary (full, headless, demo)

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information
$ fct help export
Exports prototypes from Factorio in JSON or YAML format

Usage: fct export [OPTIONS] [MODS]...

Arguments:
  [MODS]...  Mods to install before exporting the prototypes

Options:
  -d, --destination <DESTINATION>  Path where the result should be written. Uses STDOUT if not specified
  -f, --format <FORMAT>            Format of the output [default: json] [possible values: json, yaml]
  -i, --icons                      Export icon paths
  -h, --help                       Print help information
$ fct help resolve-mods
Lists all dependencies of a set of mods, trying to find compatible versions

Usage: fct resolve-mods [MODS]...

Arguments:
  [MODS]...  A list of mods, optionally with version requirements

Options:
  -h, --help  Print help information

状态

这仍然处于原型阶段。输出将不完整并且存在错误。请尽管尝试并报告您遇到的任何问题!

变更日志中查看进度。

平台支持

此工具旨在跨平台,但目前正在Linux上进行了测试。

贡献

欢迎贡献!请随意发送拉取请求,但如果您想进行大规模更改,最好先讨论它们。

依赖项

~21–39MB
~618K SLoC