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

`Spring.SetUnitShieldState` has poor multiple interface

Open
#1,635 0 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

It is one of:
* `Spring.SetUnitShieldState(unitID, number weaponNum, number power)` -> sets power for the given shield.
* `Spring.SetUnitShieldState(unitID, number weaponNum, bool enabled)` -> sets whether given shield is enabled.
* `Spring.SetUnitShieldState(unitID, number power)` -> sets power for the primary shield.
* `Spring.SetUnitShieldState(unitID, bool enabled)` -> sets whether primary shield is enabled.

This is a pretty unfriendly interface which is a nightmare to document.

Add functions that do one specific thing (keeping the existing one for back compat):
* `Spring.SetUnitShieldPower(unitID, number power, number? weaponNum)` -> sets power for given shield; to primary shield if unspecified.
* `Spring.SetUnitShieldEnabled(unitID, bool enabled, number? weaponNum)` -> sets whether given shield is enabled; primary if unspecified.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing Spring.SetUnitShieldState entry point and trace how its overloads reach shield state handling. Add the separate Spring.SetUnitShieldPower and Spring.SetUnitShieldEnabled entry points while retaining the existing interface for compatibility; done means both primary and optional-weapon forms are supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.