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

`Spring.GetUnitWeaponHaveFreeLineOfFire` has terrible interface

Open
#1,846 0 comments 0 reactions 0 assignees View on GitHub
area: documentation area: Lua API bug
Dominant language
C++
Stars
683
Forks
293
Avg merge
3d 2h
Merged PRs (30d)
40

Description

* it has four different argument sets, making it hard to intuit what is going on.
* worse, arguments overlap between the sets, but are on different positions. For example in one set, 3rd arg is a target unitID. In another, you can also pass target unitID but it's now the 6th arg, with 3rd arg being the source X coordinate.
* none of these are documented.
* it seems to have a similar problem as #1826 where an explicit `nil` changes behaviour (by making it interpret args according to a different set).
* there doesn't seem to be a set that would check against the weapon's current target. There is one that seems to check line of fire towards {0, 0, 0} coordinates, oversight?

Contributor guide

Open the contributing guide

Research direction

Start at the Spring.GetUnitWeaponHaveFreeLineOfFire entry point and trace its four argument sets, overlapping positions, and explicit nil behavior; compare the concern with issue #1826. Done means the intended interface and current-target behavior are decided, documented, and covered by the relevant tests or API checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.