Get prototype tree (in data stage)
Posted: Tue Feb 12, 2019 1:48 pm
For some applications, its useful to know the complete prototype hierarchy.
Some use cases: in factorio calculator apps or factoriomaps, if you want to get all the signals types: `item, fluid, virtual`, but if you just iterate over those three from `data.raw`, it will be far from complete. Currently, apart from `item`, you also have to iterate: `"ammo", "capsule", "gun", "item-with-entity-data", "item-with-label", "item-with-inventory", "blueprint-book", "item-with-tags", "selection-tool", "blueprint", "deconstruction-item", "module", "rail-planner", "tool", "armor", "mining-tool", "repair-tool"`.
Currently, the only way to obtain this list is to hardcode it into your mod, and manually update it for every version of the game, which is quite error prone.
It would be nice if there was a function that returned the complete prototype hierarchy similar to the one found on https://wiki.factorio.com/Prototype_definitions.
I'm not sure if there are any applications beyond the data stage, but in the data stage for sure it would be useful.
Some use cases: in factorio calculator apps or factoriomaps, if you want to get all the signals types: `item, fluid, virtual`, but if you just iterate over those three from `data.raw`, it will be far from complete. Currently, apart from `item`, you also have to iterate: `"ammo", "capsule", "gun", "item-with-entity-data", "item-with-label", "item-with-inventory", "blueprint-book", "item-with-tags", "selection-tool", "blueprint", "deconstruction-item", "module", "rail-planner", "tool", "armor", "mining-tool", "repair-tool"`.
Currently, the only way to obtain this list is to hardcode it into your mod, and manually update it for every version of the game, which is quite error prone.
It would be nice if there was a function that returned the complete prototype hierarchy similar to the one found on https://wiki.factorio.com/Prototype_definitions.
I'm not sure if there are any applications beyond the data stage, but in the data stage for sure it would be useful.