[0.14.9] [rrrola] Selection box mouse hit problems

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
akastalker
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 27, 2016 10:52 pm
Contact:

[0.14.9] [rrrola] Selection box mouse hit problems

Post by akastalker »

I was making a mod with flying units (flying - means its graphics and selection box shifted upwards from entity centre (Y -= 3 in my case) and it has empty collision mask). And I noticed that selection box acts weird - as my unit was wandering around and I was hovering my mouse cursor over its selection box, selection box kept appearing and disappearing where it shouldn't.

I made a little mod (in attachment, just start new game) to reproduce a problem on standing still vanilla biters with shifted upward selection box. Problem do not seems to be appear on vanilla entities where selection-box is small enough or not shifted that high up. Edges where selection box shows and hides seems to be aligned with horizontal lines with even coordinates (Y = -4-2,0,2,4), so I hope this is just some miscalculation bug.

Video showing the problem: https://www.dropbox.com/s/sxcoqv0i08nwo ... 0.mp4?dl=0
SelectionBoxBug_0.0.1.zip
Small mod to reproduce the problem
(2.27 KiB) Downloaded 92 times

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.9] Selection box mouse hit problems

Post by kovarex »

The selection box rectangle doesn't have [0, 0] inside, which is not valid specification.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.9] [rrrola] Selection box mouse hit problems

Post by kovarex »

I added the check and error message to the loading code.

User avatar
akastalker
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 27, 2016 10:52 pm
Contact:

Re: [0.14.9] [rrrola] Selection box mouse hit problems

Post by akastalker »

Alright. So, can I force my object to render above high entities (like trees or poles) with its center within its graphics? Or do I have to make selection box underneath its graphics?

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.9] [rrrola] Selection box mouse hit problems

Post by kovarex »

akastalker wrote:Alright. So, can I force my object to render above high entities (like trees or poles) with its center within its graphics? Or do I have to make selection box underneath its graphics?
You can make the graphics to be higher, every sprite/animation etc. has the property shift. (It is used in base on many places)

User avatar
akastalker
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 27, 2016 10:52 pm
Contact:

Re: [0.14.9] [rrrola] Selection box mouse hit problems

Post by akastalker »

Sorry for bothering you with this again, but...
kovarex wrote:The selection box rectangle doesn't have [0, 0] inside, which is not valid specification.
But all base robots don't have it :?

Code: Select all

type = "combat-robot",
name = "defender",
...
selection_box = {{-0.5, -1.5}, {0.5, -0.5}}
You can make the graphics to be higher, every sprite/animation etc. has the property shift. (It is used in base on many places)
I already shifted my graphics up and its shadow right from centre of entity. It's the only way I found to render graphics above trees.
Though, I had to lift it quite a lot: trees are high, so 3 tiles up did make my entity look like it's not crawling under trees.
Then I wanted to have selection box over my graphics, so I shifted it up 3 tiles too, and it started this weird behaviour.

Base flying robots are shifted only 1 tile up (graphics and selection boxes), but they seems to be rendering in different pass overlapping only each other (even big electric pole cannot overlap them).
Shifting selection box only 1 tile up doesn't trigger the problem, but It is not enough to make real flying selectable unit.

I think, I just remove my selection box. Looks like it's not worth it. I cannot even select it in heavy-belted area - only belt can be selected and there are no gap between them to select my entity. Also, you cannot mine logistics/construction robots in this situation - you mine building\belt\tree under it instead (can't tell if this is bug or by design).

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.14.9] [rrrola] Selection box mouse hit problems

Post by kovarex »

This is why for selection box, the 0,0 can be at most 0.5 far from the bounding box. It needs to be generally near, as the logic of searching for entity to be selected is based on the collision box which is based on position. So when the selection box is too far, the entity isn't found when searching things to select.

Post Reply

Return to “Resolved Problems and Bugs”