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

[low prio FR] add `wupget:AllowBuildGrid`

Open
#989 3 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

`wupget:AllowBuildingGrid(wantedX, wantedZ, unitDefID, options) -> cappedX, cappedZ`.

Say you drag a 7x7 box of buildings. So the function receives 7, 7 as the input. (options are like CTRL or ALT which make the box behave differently)
And you return 4, 5. Now the drag behaves as if you only dragged that far:
![image](https://github.com/beyond-all-reason/spring/assets/2573076/4717136d-fefb-4894-b2d3-fe16198fb3ab)

Note that the function is unsynced and happens continuously as you adjust the drag (perhaps only if the numbers/options change and not actually continuously, but both seem fine), and the built-in UI reflects the resulting grid.

The main practical purpose for existing games would be to limit accidental giant orders that lag everybody, but it seems generally useful (for example if somebody made a starcraft style game they could limit barracks grids to 2xN because else the middle row has some completely surrounded buildings with no exit).

Perhaps there would also be a version for line-build? Unsure what interface that one would take.

Contributor guide

Open the contributing guide

Research direction

No file or test is named; start by locating the building-grid handling and the existing wupget API entry points. Define the AllowBuildingGrid interface and verify that the built-in UI uses its capped dimensions during drag operations, while deciding whether line-build support is in scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.