fix(aasystem): refresh unpack menu and fix unit overlap after assembly - #101
Merged
Conversation
Two bugs in CTLDCrateAssemblyManager._assemble: 1. Menu never refreshed: crates were destroyed via c:destroy() directly, bypassing CTLDCrateManager, so OnCrateCleared was never published and _refreshNearbyPlayers never fired. Now uses cm:destroyCrate(crateName) which publishes the event and triggers the existing refresh contract. 2. S-300 TEL D (NoCrate, amount=2) spawned on top of Big Bird SR: the arc-step formula used arcRad/partAmount (full circle) instead of arcSegment/partAmount (part's reserved segment). Fixed. Fixes: FIX-AASYSTEM-UNPACK-BUGS tickets 01 + 02. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewer's GuideRoutes AA system crate destruction through CTLDCrateManager to ensure OnCrateCleared is published (refreshing the F10 unpack menu) and corrects the spawn geometry in _buildSpawnArrays so multi-unit parts are distributed within their arc segment; adds focused unit tests, backlog documentation, and changelog entries for the FIX-AASYSTEM-UNPACK-BUGS work. Sequence diagram for AA system unpack menu refresh via CTLDCrateManagersequenceDiagram
actor Pilot
participant CTLDCrateAssemblyManager
participant CTLDCrateManager
participant F10Menu
Pilot->>CTLDCrateAssemblyManager:_assemble(heli, crate, allCrates, template, range)
CTLDCrateAssemblyManager->>CTLDCrateAssemblyManager:_buildSpawnArrays(template, systemParts, origin, heli)
loop destroy consumed crates
CTLDCrateAssemblyManager->>CTLDCrateManager:getInstance()
CTLDCrateAssemblyManager->>CTLDCrateManager:destroyCrate(crateName)
CTLDCrateManager-->>CTLDCrateManager:OnCrateCleared
CTLDCrateManager->>CTLDCrateManager:_refreshNearbyPlayers(position)
CTLDCrateManager->>F10Menu:refreshUnpackSection()
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the
CTLDCrateAssemblyManager _assemble publishes OnCrateCleared per consumed cratespec, you restoreEventDispatcher.getInstance().publishusing a freshgetInstance()call; consider storing the originalEventDispatcher.getInstance()object inbefore_eachand restoringpublishon that same instance inafter_eachto avoid subtle bugs if the singleton instantiation logic ever changes. - The S-300 template lookup logic is duplicated between
buildS300Parts()and the_assemble publishes OnCrateClearedtest; extracting a shared helper for fetching the S-300 template would reduce repetition and keep the tests easier to maintain if template names or layout change.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the `CTLDCrateAssemblyManager _assemble publishes OnCrateCleared per consumed crate` spec, you restore `EventDispatcher.getInstance().publish` using a fresh `getInstance()` call; consider storing the original `EventDispatcher.getInstance()` object in `before_each` and restoring `publish` on that same instance in `after_each` to avoid subtle bugs if the singleton instantiation logic ever changes.
- The S-300 template lookup logic is duplicated between `buildS300Parts()` and the `_assemble publishes OnCrateCleared` test; extracting a shared helper for fetching the S-300 template would reduce repetition and keep the tests easier to maintain if template names or layout change.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Extract shared s300TemplateAndParts() helper used by both the geometry and menu-refresh describe blocks, eliminating duplicated S-300 template lookup logic. - Store EventDispatcher instance in before_each and restore publish on that same object in after_each, avoiding any risk of restoring onto a different singleton instance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FullGas1
added a commit
that referenced
this pull request
Aug 4, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes both bugs reported during field testing of the S-300 (SAM long range). Covers all AA systems -- both code paths are generic.
Test plan
Generated with Claude Code
Summary by Sourcery
Fix AA system unpack behaviour by refreshing the F10 unpack menu after assembly and correcting spawn geometry to prevent overlapping units.
Bug Fixes:
Enhancements:
Documentation:
Tests: