Skip to content

Make primary-action target visibility protection opt-in - #328

Open
Guffawaffle wants to merge 6 commits into
STFC-Mod:devfrom
Guffawaffle:fix/dismissed-primary-target-upstream
Open

Guffawaffle wants to merge 6 commits into
STFC-Mod:devfrom
Guffawaffle:fix/dismissed-primary-target-upstream

Conversation

@Guffawaffle

@Guffawaffle Guffawaffle commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The primary-action shortcut can send a fleet to the last target's cached coordinates after its popup is dismissed. Some players also use this behavior to repeat a command.

Add [control] primary_requires_visible_target = false. The default preserves existing commands and retry behavior. Set it to true to require a visible target viewer and its parent, or an active visible Set Course control for movement, and cancel the pending retry on Escape. Secondary-only actions keep their existing checks, and Armada joining retains its existing visibility-state decision in both modes.

Share the viewer visibility predicate with CanHideViewers() and the hide helpers. Include the native star-viewer base binding and Boolean unboxing correction needed for the opt-in parent checks.

Validation: Windows release build and local actual-source fixtures for both option modes, Armada joining, secondary actions, movement visibility, and boxed parent visibility. The corresponding downstream protection has prior gameplay coverage; this revised upstream artifact has not been separately game-tested. Windows and both macOS architecture builds are checked by CI.

@netniV netniV 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 feel I'm gonna get annoyed by this change as I've been using it like this for a long time to make sure something goes ;-)

Comment thread mods/src/patches/parts/hotkeys.cc Outdated
Comment on lines +1290 to +1296
template <typename T> bool IsObjectViewerShowing(T* widget)
{
auto* visibility = widget ? widget->_visibilityController : nullptr;
auto* parent = widget ? widget->Parent : nullptr;
return visibility && (visibility->_state == VisibilityState::Visible || visibility->_state == VisibilityState::Show)
&& parent && parent->IsShowing;
}

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'm sure there's CanHideViewers() for this functonality?

Comment thread mods/src/patches/parts/hotkeys.cc Outdated

spdlog::info("have armada? {}, State {}", (armada_widget ? "Yes" : "No"), (int)armada_state);
if (armada_widget && (armada_state == VisibilityState::Visible || armada_state == VisibilityState::Show)) {
if (IsObjectViewerShowing(armada_widget)) {

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.

The function doesn't work here.

@Guffawaffle Guffawaffle changed the title Prevent primary action from using dismissed targets Make primary-action target visibility protection opt-in Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants