Add can_player_place functionality

Post Reply
blueblue
Long Handed Inserter
Long Handed Inserter
Posts: 75
Joined: Tue Apr 11, 2017 7:39 pm
Contact:

Add can_player_place functionality

Post by blueblue »

I need a function that allows me to check wether a player could place an entity. The surface.can_place function returns false if a placement location e.g. of an inserter is blocked by items, which is not what I want. My current method to deal with this is removing all items in the target location, calling the can_place method and putting the items back in place if the entity is still not placeable. I'm sure this is not good for performance and there are probably a couple other issues with that method.

I suggest something like a flag ignore_items in LuaSurface::can_place or a function LuaPlayer::can_player_build.

See also viewtopic.php?f=28&t=53503
unique_2 on discord and mod portal

Post Reply

Return to “Implemented mod requests”