MForster / factorio-rust-tools

A Rust library to export prototype definitions from Factorio.
4 stars 1 forks source link

Export icon paths for prototypes #30

Closed MForster closed 1 year ago

MForster commented 1 year ago

Icon paths are not available in Factorio's runtime stage, so we must resort to getting them in the data stage. Unfortunately data structures in the data stage are a bit messy, so we need to apply some heuristics to map icons into the prototypes that we get in the runtime stage. We add an icon property to a prototype if it's name and object_name or type match the section names and section element names in data.raw.

Incompatible change: To avoid double parsing, FactorioExporter::export now returns a serde_yaml::Value instead of a String.