Skip to content

feat: select idle builders by distance to camera - #5498

Open
hihoman23 wants to merge 7 commits into
beyond-all-reason:masterfrom
hihoman23:select-closest-idle-builder
Open

feat: select idle builders by distance to camera#5498
hihoman23 wants to merge 7 commits into
beyond-all-reason:masterfrom
hihoman23:select-closest-idle-builder

Conversation

@hihoman23

Copy link
Copy Markdown
Member

Work done

The idle builder list is sorted by distance to the camera to select the closest idle builder to the camera.

fixes #5496

Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
@sprunk

sprunk commented Jul 17, 2025

Copy link
Copy Markdown
Collaborator

Might want to add support for sorting via distance to cursor (which is the better alternative when using a hotkey instead of clicking a button with a mouse). Apprently this action doesn't explicitly support a hotkey yet (?) so it's probably fine to just leave a FIXME or a ticket or something. Also it would be good to apply this behaviour to other actions that select something (also not necessarily in this PR).

@ZephyrSkies7
ZephyrSkies7 dismissed saurtron’s stale review January 7, 2026 20:52

Stale review, Saurtron still out of commission, refer to #5498 (comment) for hihoman's logic. TLDR; Saurtron's comment is sound and should ideally follow his suggestion, but it isn't an outright blocker.

@ZephyrSkies7

Copy link
Copy Markdown
Contributor

@SethDGamre @sprunk @efrec
If any of you 3 can give this a look over one more time, I can merge it, I trust hihoman's code but it's been a while since this PR opened so good to check in case any adjacent files had adjustments

@efrec efrec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the point about splitting the difference between searches from hotkey and non-hotkey input. But LGTM otherwise, code is sane, only hoping for a future enhancement.

@sprunk sprunk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks alright. I haven't tested though.

Comment thread luaui/Widgets/gui_idle_builders.lua Outdated
@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

16 tests   7 ✅  3s ⏱️
 1 suites  9 💤
 1 files    0 ❌

Results for commit 4f5ba55.

♻️ This comment has been updated with latest results.

@TheChronographer

Copy link
Copy Markdown
Collaborator
image

@sprunk

sprunk commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

Sounds worth addressing but it's not from this PR.

@TheChronographer

Copy link
Copy Markdown
Collaborator

Left click works great, cycles though all idles in distance from camera. Right click, which also moves the camera, seems weird though.

image

In the above screenshot/configuration, the next right click is actually going to the rez bot on the far RIGHT of the screen (off the current camera fov) and not the one on the left, in fact repeatedly pressing it never went to the one on the left. There are many such configurations depending on when the selection was changed and where camera started.

In Master/Stable it correctly cycles through every idle unit with repeated clicks.

@efrec

efrec commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

We pulled and tested in PR review and think similarly. This is close but not completed.

WatchTheFort
WatchTheFort previously approved these changes Mar 19, 2026
@WatchTheFort
WatchTheFort dismissed their stale review March 19, 2026 19:08

Further gameplay testing required

@WatchTheFort

Copy link
Copy Markdown
Member

@hihoman23 Have you had a chance to address TheChronographer's feedback?

@hihoman23

Copy link
Copy Markdown
Member Author

No, not yet but I can reproduce the issue.

@hihoman23

Copy link
Copy Markdown
Member Author

It should be fixed now.

@github-actions

Copy link
Copy Markdown
Contributor

Integration Test Results

16 tests   8 ✅  3s ⏱️
 1 suites  8 💤
 1 files    0 ❌

Results for commit f2ac041.

@PtaQQ

PtaQQ commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Pulled the pr, seems to still select cons at random to me

2026-04-02.21-14-18.mp4

@WatchTheFort

Copy link
Copy Markdown
Member

@hihoman23 Any feedback on this?

@hihoman23

Copy link
Copy Markdown
Member Author

I can't fully see how the planes are arranged, but it seems to work fine on my branch, so I can't really repro.

@hihoman23

Copy link
Copy Markdown
Member Author

@PtaQQ could you maybe send another clip of this happening?

@PtaQQ

PtaQQ commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Sorry, I missed your message, here is another video: https://youtu.be/E-8Pk3_WU4A

I'm not sure if I'm doing something wrong or I misunderstood the intent of the PR, but basically it seems it selects builders in an order of closest to furthest from world origin (0,0 coords).

Also, when using the ctrl+b keybind (legacy keys for select AllMap+_Builder_Idle+_ClearSelection_SelectOne+) it has a slightly different behaviour too.
@hihoman23

@WatchTheFort

Copy link
Copy Markdown
Member

@hihoman23 Any updates on this?

@efrec efrec added the Needs Implementer The original author is no longer able to work on the pull request. label Jul 22, 2026
@efrec

efrec commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Needs a retest and to be updated.

May have new behaviors with mouse bindings soon: beyond-all-reason/RecoilEngine#3116

Since the mouse actions could become unbound.

@burnhamrobertp

Copy link
Copy Markdown
Contributor

No additional changes are striclty required as far as the mouse bindings are concerned, just that this would continue to behave using the hard-coded mouse buttons without adjustment (and you shouldn't do that adjustment until that PR is in anyways).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Implementer The original author is no longer able to work on the pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select *nearest* idle constructor

10 participants