LuaControl.can_place_tile
- protocol_1903
- Filter Inserter

- Posts: 392
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
LuaControl.can_place_tile
Same as LuaControl.can_place_entity but for tiles, to run easier checks on normal tile buildability rules
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903
Re: LuaControl.can_place_tile
Surely you'd want can_place_tiles more. I don't imagine it's often the case that you want to check only a single tile.
(also, can_place_entity is found in LuaPlayer and LuaSurface, not in LuaControl; I'd expect you want the tile function for both)
(also, can_place_entity is found in LuaPlayer and LuaSurface, not in LuaControl; I'd expect you want the tile function for both)
Re: LuaControl.can_place_tile
By placing a given tile it may make placing another invalid (tile placement rules can require you do not build within x distance of another tile). So can place tiles is not likely to be super useful.
If you want to get ahold of me I'm almost always on Discord.
Re: LuaControl.can_place_tile
That is kinda true, though it's more that it would create a potential trap for modders, who don't realize this, and then try to use can_place_tiles on tiles where the placement rules include such a restriction - never mind how other tiles/entities might change after each tile is placed (either due to prototype/built-in or scripted behavior). The only way to accurately resolve can_place_tiles is to, well, simulate the placement of each tile. Which would require actually forking the world and placing each and every tile requested until they are either all place, or one of them fails to place - expensive.Rseding91 wrote: Fri Nov 14, 2025 4:28 pm By placing a given tile it may make placing another invalid (tile placement rules can require you do not build within x distance of another tile). So can place tiles is not likely to be super useful.
can_place_tile is still useful, though.
A variation of can_place_tile, can_place_any_of_tiles, which returns true if at least one tile in a list can be placed, could be also be useful, and might cover some use cases for can_place_tiles.
- protocol_1903
- Filter Inserter

- Posts: 392
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: LuaControl.can_place_tile
I'd be expecting this more as a 'does the game engine and the tile placement logic of these tiles make them compatible' check rather than 'could i place this EXACT tile on this EXACT other tile' type beat but an implementation like that could be useful
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903

