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

Make godmode give Lua read access to selected units

Open
#1,659 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

1) `/cheat` and `/godmode`. Do **NOT** do `/globallos`.
2) blindly drag a box somewhere over the enemy half of the map to select the enemy starting unit.
![image](https://github.com/user-attachments/assets/5f164ecf-5d0e-42f1-ae1e-3f21b548dd1d)
3) Lua UI realizes that selection happened, but the unit is in the fog of war so interfaces like `Spring.GetUnitHealth` cannot return useful data.
![image](https://github.com/user-attachments/assets/c0711657-b808-4cb4-a1ed-0f7abec77fe2)

Remarks:
* how does the example above know the unit type if `Spring.GetUnitDefID` doesn't work? Turns out `Spring.GetSelectedUnitsSorted` assumes selected units are visible anyway so doesn't do visibility checks.
* I am unsure whether only selected units should get read access, or just all selectable. Either probably works.
* I am unsure how interfaces like `Spring.GetAllUnits()` should behave, regardless of which option in the bulletpoint above is picked.
* do not assume that only godmode lets you select enemy units, i.e. do not skip the explicit check. See #567

Contributor guide

Open the contributing guide

Research direction

Start at the /cheat and /godmode selection path, then trace the Lua interfaces Spring.GetUnitHealth, Spring.GetUnitDefID, Spring.GetSelectedUnitsSorted, and Spring.GetAllUnits. Check the explicit enemy-selection requirement in #567. Done requires a decided and verified policy for read access to selected or selectable enemy units, including how the listed interfaces behave.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
game-dev, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.