[2.0.66] LuaPlayer.can_build_from_cursor ignores position being out of reach

Bugs which we just recently fixed in our development version and will reach you in the next release.
geekofalltrades
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 23, 2024 12:52 am
Contact:

[2.0.66] LuaPlayer.can_build_from_cursor ignores position being out of reach

Post by geekofalltrades »

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.
geekofalltrades
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 23, 2024 12:52 am
Contact:

Re: [2.0.66] LuaPlayer.can_build_from_cursor ignores position being out of reach

Post by geekofalltrades »

There's some more strangeness here that I don't understand. build_from_cursor seems to be able to place items further away from the player than their reach, but there is still a distance beyond which it fails to place them with "Cannot reach." But can_build_from_cursor still returns true even when the distance is further than the player can reach and further than build_from_cursor can reach.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16103
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.66] LuaPlayer.can_build_from_cursor ignores position being out of reach

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”