Skip to content

Idle builders auto repair#7338

Open
Flameink wants to merge 9 commits intobeyond-all-reason:masterfrom
Flameink:flameink/idle_builder_auto_repair
Open

Idle builders auto repair#7338
Flameink wants to merge 9 commits intobeyond-all-reason:masterfrom
Flameink:flameink/idle_builder_auto_repair

Conversation

@Flameink
Copy link
Copy Markdown
Contributor

@Flameink Flameink commented Apr 3, 2026

Work done

Idle mobile builders now auto-repair units within a range that depends on the movement state.
They go back to their starting point when done or when target leaves the leash radius.
They won't repair any units that have been reclaimed by the player within 1 minute.

The radius is pretty conservative, build radius + 100, or +200 at most when on roam.

AI / LLM usage statement:

I used claude to help me write this. I made sure it was up to quality standards and tested.

Note: This has been approved by GDT a while back, I'm just getting to this.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Integration Test Results

16 tests  ±0   8 ✅ ±0   4s ⏱️ -1s
 1 suites ±0   8 💤 ±0 
 1 files   ±0   0 ❌ ±0 

Results for commit 4e6787b. ± Comparison against base commit fdfc55c.

♻️ This comment has been updated with latest results.

@loveridge
Copy link
Copy Markdown
Contributor

It should not uncloak commanders, and commanders that are wanting to cloak shouldn't start repairing once they become idle.

@loveridge
Copy link
Copy Markdown
Contributor

Units on hold position can be in range to repair a unit, but not initiate the repair. armlab for instance

@Flameink
Copy link
Copy Markdown
Contributor Author

Flameink commented Apr 4, 2026

Yeah, I'm not taking into account the width of the unit, the center of the unit needs to be in the build radius for it to work. It's a known issue.
For the cloak thing, how do I tell if a unit's visibility state is set to cloaked?

@Flameink
Copy link
Copy Markdown
Contributor Author

Flameink commented Apr 4, 2026

Builders on hold position that have started automatically repairing a unit can move after the unit if it moves out of range. This may be acceptable though.

I think this is due to the polling rate. If you use a slower unit it doesn't move.

@loveridge
Copy link
Copy Markdown
Contributor

Yeah, I'm not taking into account the width of the unit, the center of the unit needs to be in the build radius for it to work. It's a known issue. For the cloak thing, how do I tell if a unit's visibility state is set to cloaked?

For cloak, you can track which units are attempting to cloak when the command is issued. I've done it in UnitCommand, but maybe CommandNotify would work as well:

function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag)
	if unitTeam ~= myTeamID then return end
	if cmdID == CMD_CLOAK then
		unitSeekingCloak[unitID] = cmdParams[1] == 1
	end

For the width, perhaps you can add the damaged unit's radius to the check.

@loveridge
Copy link
Copy Markdown
Contributor

Builders on hold position that have started automatically repairing a unit can move after the unit if it moves out of range. This may be acceptable though.

I think this is due to the polling rate. If you use a slower unit it doesn't move.

Yeah, you are right about that I think.

@WybrenKoelmans
Copy link
Copy Markdown
Contributor

Very nice! Would you mind crediting uBdead for the original widget somewhere?

@Flameink
Copy link
Copy Markdown
Contributor Author

Flameink commented Apr 4, 2026

Sure? I wrote this from scratch though, and didn't use his widget at all.

@WybrenKoelmans
Copy link
Copy Markdown
Contributor

Oh alright I assumed you based it on the original widget.

@sorenmarkert
Copy link
Copy Markdown
Contributor

Will they assist on construction as well?

@Flameink
Copy link
Copy Markdown
Contributor Author

Flameink commented Apr 5, 2026

No, this is only for repair. Assisting construction isn't free

Copy link
Copy Markdown
Collaborator

@efrec efrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nits

@Flameink
Copy link
Copy Markdown
Contributor Author

Flameink commented Apr 5, 2026

Nits have been nitted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants