Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a hook to the 'drag-filter' event that happens in the engine #30

Open
Garanas opened this issue Sep 1, 2023 · 2 comments
Open

Add a hook to the 'drag-filter' event that happens in the engine #30

Garanas opened this issue Sep 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Garanas
Copy link
Member

Garanas commented Sep 1, 2023

Description

When you drag-select units the engine automatically attempts to filter them. As an example: if you drag select a tank and an engineer you'll select the tank.

Even though this behavior is fine, it doesn't give us control to customize the behavior.

Suggested change

To completely disable the engine behavior and to give Lua a chance to implement its own filtering. Specifically it would be a function that gives you all the units in the drag selection event, and the units it ends up returning would become your selection.

At the moment this is done as a post processing step as part of the OnSelectionChanged function in lua\ui\game\gamemain.lua.

As an example of the new Lua function: OnSelectionDrag(units: UserUnit[]) : UserUnit[]. It would be part of the module lua\ui\game\gamemain.lua.

What we can do with it

This would allow us to properly implement the filtering of the selection. It would also prevent 'accidentally' filtering of a selection when, for example, a UI script calls SelectUnits.

A few examples of what we can do with it are in https://github.com/FAForever/fa/pull/4905/files , which is on hold because it would likely break any UI mod that relies on how the selection works.

@4z0t
Copy link
Member

4z0t commented Sep 24, 2024

@Garanas
Copy link
Member Author

Garanas commented Sep 24, 2024

That is really nice 👍 , let's discuss how it works over voice next weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants