Don't draw empty red "colliding" selection boxes

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Don't draw empty red "colliding" selection boxes

Post by Deadlock989 »

Selection boxes have a few ways they can be influenced. The default for selection_box is documented as {{0, 0}, {0, 0}}, which has zero area and is described as "empty". Empty selection boxes can't be moused-over and therefore the entity is unselectable. Furthermore, if selectable_in_game is set to false, no (yellow) selection box is drawn at all, whether empty or not.

However the red "colliding selection box" (I don't know how if it has a proper name), the one you get when you can't place an entity because it collides with something, is still drawn even if selectable_in_game is false. If the entity has an empty selection_box, the corners of the box collapse to the entity's centre and it resembles a red cross-hair. I've tried a few other flags and properties but none of them seem to affect this (please let me know if I am missing something).

My expectation was that selectable_in_game = false would also stop the red collision warning selection box from being drawn.
Image

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

Re: Don't draw empty red "colliding" selection boxes

Post by Rseding91 »

Related to this: in 2.0 I changed the rendering logic so if a zero-sized area is given it instead renders it as a 1x1. Since there are still areas/times "all the things in this area" get rendered for selection (for example the editor, or deconstruction planners) and the crosses were always super confusing to anyone seeing them.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Don't draw empty red "colliding" selection boxes

Post by Deadlock989 »

If you mean a 1x1 tile, then it's going to be even more desirable to have a property/flag that hides the red "colliding" selection box, or have selectable_in_game make it go away as well. It would break hacks like this one which currently only shows the tiny red cross, I was planning on using a similar method. If something's not selectable then it must also not be deconstructible so I don't think the bounding box brackets should be shown at any time.
Image

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

Re: Don't draw empty red "colliding" selection boxes

Post by Rseding91 »

I'm not against that idea. However currently setting selectable_in_game = false does not prevent an entity from being deconstructed. It also does not prevent it from colliding with other entities or from being built by the player.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Don't draw empty red "colliding" selection boxes

Post by Deadlock989 »

Rseding91 wrote:
Sun Oct 29, 2023 2:00 pm
I'm not against that idea. However currently setting selectable_in_game = false does not prevent an entity from being deconstructed. It also does not prevent it from colliding with other entities or from being built by the player.
I didn't say that it did.

I don't mind what goes into the cake, I just need a way of making the red crosses not be shown. When 1.2 drops and the red crosses become tile-sized boxes, it will break existing mods (e.g. Nullius).
Image

Post Reply

Return to “Modding interface requests”