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

Spring.SetUnitRepairable function feature request

Open
#2,478 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
683
Forks
293
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Currently, there is the following unit behavior issue:
1. User attempts to reclaim one of their own units
2. User tells nano turret to do something else
3. Nano turret gets an idle fight command and repairs up the unit that was being reclaimed.
4. Frustration, user has to start the reclaim again

The unit_immobile_builder.lua widget is responsible for the idle fight command on the BAR end. However, all it does is issue a fight command, and the engine decides on the repair.

It is proposed that the engine will add a Spring.SetUnitRepairable(unitID, bool). This will set a flag that will control whether builders are allowed to repair a particular unit. This seems to me as the most generic solution that doesn't mess with engine defaults.

On the BAR side, the solution to this issue would look like this:
```
widget:CommandNotify(...)
if cmdID == RECLAIM then
Spring.SetUnitRepairable(targetID, false)
end
if cmdID == REPAIR or cmdID == GUARD then
Spring.SetUnitRepairable(targetID, true)
end
end
```

The engine would have something like this:
```
bool CBuilder::CanRepairUnit(const CUnit* u) const
{
if (!u->isRepairable)
return false;
// Rest of the function
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the unit_immobile_builder.lua widget and its CommandNotify handling, then trace the engine's CBuilder::CanRepairUnit path. Determine how the proposed Spring.SetUnitRepairable flag should affect repair decisions and how the widget should toggle it for RECLAIM, REPAIR, and GUARD; done means reclaiming is not undone by an idle fight command while normal repair remains possible.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.