Skip to content

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

@Garanas

Description

@Garanas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions