beyond-all-reason / beyond-all-reason/RecoilEngine

[FR] Add a way to get units by command targetee

Open
#878 2 comments 0 reactions 0 assignees View on GitHub
area: Lua API enhancement
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Bill of materials to be done before starting this ticket:
* awareness of #2125

----

Consider this setup. A unit is the target of a guard command and two attack commands, one of which is queued:
![image](https://github.com/beyond-all-reason/spring/assets/2573076/952679e2-2bba-4810-ae6e-9c13953cdf5f)

The request is to add something like:
`Spring.GetTargetingUnits(targeteeID, commandID, bool queued = false) -> { targeters }`

So in the example:
* `Spring.GetTargetingUnits(1, CMD.GUARD)` -> `{2}`
* `Spring.GetTargetingUnits(1, CMD.ATTACK)` -> `{4}`
* `Spring.GetTargetingUnits(1, CMD.ATTACK, true)` -> `{3, 4}`
* `Spring.GetTargetingUnits(1, CMD.ATTACK)` -> `{}` if called from LuaUI (can read allied units' queue only!)
* `Spring.GetTargetingUnits(1, CMD.REPAIR)` -> `{}`

For now, targeteeID can probably only be a unit. With #717 you could pass a featureID too, with CMD.RECLAIM and RESURRECT being some useful commands to pass in that case.

Contributor guide

Open the contributing guide

Research direction

Start with prerequisite issue #2125 and the proposed Spring.GetTargetingUnits entry point, focusing on how unit command targets and queued commands are represented. Done means the API returns matching targeters for the requested command, optionally includes queued commands, and applies the stated LuaUI visibility behavior; no implementation files or tests are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
api, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.