LuaEntityPrototype - counts in items_to_place_this
Posted: Mon Oct 01, 2018 8:43 am
Currently only used in base for curved-rail, the placeable_by prototype property takes ItemToPlace, and allows placing a single entity using multiple items. But this is not exposed via the runtime API.
Mods like Bluebuild and Nanobots use items_to_place_this when reviving ghosts, but currently assume that 1 entity requires 1 item. This makes it possible to get an infinite number of rails by e.g. letting Bluebuild revive a curved-rail ghost (costing 1 rail) and then mining the curved-rail entity, yielding 4 rail items.
This can be worked around to some degree by inspecting mineable_properties for entities that follow the usual practice of yielding exactly the items needed to place the entity, but not all modded entities adhere to this.
Current API: items_to_place_this :: dictionary string → LuaItemPrototype
Proposed API: items_to_place_this :: array of SimpleItemStack
Mods like Bluebuild and Nanobots use items_to_place_this when reviving ghosts, but currently assume that 1 entity requires 1 item. This makes it possible to get an infinite number of rails by e.g. letting Bluebuild revive a curved-rail ghost (costing 1 rail) and then mining the curved-rail entity, yielding 4 rail items.
This can be worked around to some degree by inspecting mineable_properties for entities that follow the usual practice of yielding exactly the items needed to place the entity, but not all modded entities adhere to this.
Current API: items_to_place_this :: dictionary string → LuaItemPrototype
Proposed API: items_to_place_this :: array of SimpleItemStack