Page 1 of 1

LuaEntityPrototype - counts in items_to_place_this

Posted: Mon Oct 01, 2018 8:43 am
by Therax
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

Re: LuaEntityPrototype - counts in items_to_place_this

Posted: Mon Oct 01, 2018 9:43 pm
by Rseding91
Ok. it's changed for 0.17.

Re: LuaEntityPrototype - counts in items_to_place_this

Posted: Tue Oct 02, 2018 12:40 am
by mrudat
Huh. I had assumed that curved rail would require { "straight-rail", "straight-rail", "straight-rail", "straight-rail", "straight-rail" }, but never checked to confirm.