Page 1 of 1

[0.14.9] [rrrola] Selection box mouse hit problems

Posted: Sat Sep 24, 2016 5:11 am
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 106 times

Re: [0.14.9] Selection box mouse hit problems

Posted: Tue Oct 04, 2016 1:35 pm
by kovarex
The selection box rectangle doesn't have [0, 0] inside, which is not valid specification.

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

Posted: Tue Oct 04, 2016 1:36 pm
by kovarex
I added the check and error message to the loading code.

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

Posted: Tue Oct 04, 2016 5:50 pm
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?

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

Posted: Wed Oct 05, 2016 12:54 am
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)

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

Posted: Thu Oct 06, 2016 11:03 pm
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).

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

Posted: Wed Oct 19, 2016 5:46 pm
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.