Crates.io | truegrf |
lib.rs | truegrf |
version | 2.1.0 |
source | src |
created_at | 2022-05-29 21:56:30.842908 |
updated_at | 2022-06-05 20:27:42.089159 |
description | TrueGRF YAML to GRF compiler |
homepage | https://github.com/TrueGRF/TrueGRF-rs |
repository | https://github.com/TrueGRF/TrueGRF-rs |
max_upload_size | |
id | 596675 |
size | 210,806 |
TrueGRF is a project to make it more accessible for anyone to create NewGRFs for OpenTTD. For more details on the project, please visit here.
This repository is the Rust part of the project, which offers a YAML to GRF compiler, both for the stand-alone tool and as npm library (via WASM).
cargo run --release -- --help
Have latest rust installed, and install wasm-pack
(with cargo install wasm-pack
).
wasm-pack build --release --target web
This gives you the required WASM files in the pkg
folder.
Check wasm-pack
how to use it in your own project.
PS: in some cases you want to replace in pkg/package.json
the module
key with main
and add "type": "module"
.
sed -i 's/"module": "truegrf.js",/"main": "truegrf.js",\n "type": "module",/' pkg/package.json
Currently TrueGRF only supports a small selection of the GRF specifications:
All other features are not (yet) supported.
In order for TrueGRF to compile the YAML to GRF, the YAML files need to be in a specific structure.
truegrf.yaml
: the main file, to indicate it is a TrueGRF project.cargoes/<name>.yaml
: one cargo definition.industries/<name>.yaml
: one industry definition.Sprites can refer to PNG files based from the root-folder.
The specific structure of the YAML can be deduced from the source files.