Skip to content

fix announcing derelict source deletions on other player teams - #566

Merged
phinner merged 1 commit into
xpdustry:masterfrom
JasonP01:fixAlerts
Aug 2, 2026
Merged

fix announcing derelict source deletions on other player teams#566
phinner merged 1 commit into
xpdustry:masterfrom
JasonP01:fixAlerts

Conversation

@JasonP01

@JasonP01 JasonP01 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved source-block destruction alerts to display the correct team associated with the block before it was changed or destroyed.
    • Added a fallback to the current team when previous team information is unavailable.

Note

Fix derelict source block destruction alerts sending to wrong player team

When a source block is destroyed, the alert was sent to the block's current team, which could be wrong if the block had changed teams (e.g. derelict blocks). The fix captures the block's team at TilePreChangeEvent time in a preChangeTeams map, then uses that stored team when sending the destruction announcement. The map is cleared each update tick to avoid stale entries.

Macroscope summarized bd10484.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 780af0c2-cf08-447f-8d75-8a5327c9b2f0

📥 Commits

Reviewing files that changed from the base of the PR and between eb56152 and bd10484.

📒 Files selected for processing (1)
  • imperium-mindustry/src/main/kotlin/com/xpdustry/imperium/mindustry/game/AlertListener.kt

📝 Walkthrough

Walkthrough

AlertListener now preserves source-block team ownership before tile changes. Destruction announcements use the preserved team when available and fall back to the building’s current team.

Changes

Source-team alert handling

Layer / File(s) Summary
Track and apply pre-change teams
imperium-mindustry/src/main/kotlin/com/xpdustry/imperium/mindustry/game/AlertListener.kt
AlertListener records source-block teams before tile replacement or removal, clears the map during generator updates, and uses the recorded team for destruction announcements with a current-team fallback.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit guarding teams,
Before each tile change scene.
Old owners stay in my map,
Alerts follow the proper track.
Hop, hop—ownership is seen!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the fix for incorrect announcements when source blocks are deleted under another team.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Test Results

44 tests  ±0   44 ✅ ±0   13s ⏱️ ±0s
10 suites ±0    0 💤 ±0 
10 files   ±0    0 ❌ ±0 

Results for commit bd10484. ± Comparison against base commit eb56152.

@phinner
phinner merged commit c626ae5 into xpdustry:master Aug 2, 2026
6 checks passed
@JasonP01
JasonP01 deleted the fixAlerts branch August 2, 2026 21:44
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.

2 participants