Skip to content

Alert player on units being reclaimed by enemy#7274

Draft
PexoDev wants to merge 3 commits intobeyond-all-reason:masterfrom
PexoDev:issue-5428/alert-on-units-being-reclaimed
Draft

Alert player on units being reclaimed by enemy#7274
PexoDev wants to merge 3 commits intobeyond-all-reason:masterfrom
PexoDev:issue-5428/alert-on-units-being-reclaimed

Conversation

@PexoDev
Copy link
Copy Markdown
Contributor

@PexoDev PexoDev commented Mar 30, 2026

Work done

  • Implemented new alert on reclaim step issuing "UnitUnderAttack" notification (it could be extended in the future with more matching "Unit Being Reclaimed" alert I guess).
  • Cached all Spring methods and removed commented out code in sfx_notifications.lua

Addresses Issue(s)

Issue #5428

Test steps

  • Start game
  • Spawn any allied unit, preferably a pacifist one for ease of testing, f.e. armlab
  • Spawn enemy lazarus/con nearby
  • Watch it reclaim your lab, the notification about units being under attack will be issued

@github-actions
Copy link
Copy Markdown
Contributor

Integration Test Results

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

Results for commit 2d33a57. ± Comparison against base commit 4a68988.

return players
end

if gadgetHandler:IsSyncedCode() then
Copy link
Copy Markdown
Contributor Author

@PexoDev PexoDev Mar 30, 2026

Choose a reason for hiding this comment

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

I'd imagine that this new "OnReclaim" alert would belong better to Unsynced code, next to UnitDamaged, but I can't get gadget:AllowUnitBuildStep to invoke in the Unsynced section.

I would imagine this has something to do with it belonging to LuaHandleSynced

Would appreciate some guidance here, as this also complicates how to sound this alert only for the owner of the unit, and not the whole team (it'd be inconsistent with other UnitAttacked notifications)

end

if GG.notifications and GG.notifications.queueNotification then
GG["notifications"].queueNotification("UnitsUnderAttack", "teamID", tostring(unitTeamID))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So currently it notifies the whole team, which is clearly unacceptable.

The problem I'm facing is extracting unit ownership here in unsynced context, as AllowUnitBuildStep gets invoked in this context exclusively, and UnitDamaged doesn't trigger for reclaim.

It would be an abysmal waste of procesing to create a dictionary of units ownership for this reason alone, so manual unit ownership tracking is also off the table.

What other options do I have?

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.

1 participant