LuaEntityPrototype - counts in items_to_place_this

Post Reply
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

LuaEntityPrototype - counts in items_to_place_this

Post 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
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaEntityPrototype - counts in items_to_place_this

Post by Rseding91 »

Ok. it's changed for 0.17.
If you want to get ahold of me I'm almost always on Discord.

User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 229
Joined: Fri Feb 16, 2018 5:21 am
Contact:

Re: LuaEntityPrototype - counts in items_to_place_this

Post 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.

Post Reply

Return to “Implemented mod requests”