[2.0.66] LuaPlayer.can_build_from_cursor ignores position being out of reach
Posted: Sat Sep 13, 2025 6:02 am
What did you do?
Used LuaPlayer.can_build_from_cursor to check if the player could build from the cursor at a position out of their reach, then LuaPlayer.build_from_cursor to build at that position.
What happened?
LuaPlayer.can_build_from_cursor returned true, even though the position in question was out of the player's reach. When LuaPlayer.build_from_cursor was called to build in that position, it failed, because the position was out of reach. (Entity was not built, error sound played, and "Cannot reach" floating text appeared on screen.)
What did you expect to happen instead? It might be obvious to you, but do it anyway!
LuaPlayer.can_build_from_cursor should return false, since the player cannot build in that position: it's too far away. Or, LuaPlayer.build_from_cursor should succeed for that position, as can_build_from_cursor indicated it would, even if it would be out of reach if built normally.
Does it happen always, once, or sometimes?
Always.
Used LuaPlayer.can_build_from_cursor to check if the player could build from the cursor at a position out of their reach, then LuaPlayer.build_from_cursor to build at that position.
What happened?
LuaPlayer.can_build_from_cursor returned true, even though the position in question was out of the player's reach. When LuaPlayer.build_from_cursor was called to build in that position, it failed, because the position was out of reach. (Entity was not built, error sound played, and "Cannot reach" floating text appeared on screen.)
What did you expect to happen instead? It might be obvious to you, but do it anyway!
LuaPlayer.can_build_from_cursor should return false, since the player cannot build in that position: it's too far away. Or, LuaPlayer.build_from_cursor should succeed for that position, as can_build_from_cursor indicated it would, even if it would be out of reach if built normally.
Does it happen always, once, or sometimes?
Always.