Skip to content

Fix fleet and battle messages when planets or moons are destroyed - #1494

Open
tiweb442 wants to merge 3 commits into
lanedirt:mainfrom
tiweb442:fix/1341-destroyed-moon-messages
Open

Fix fleet and battle messages when planets or moons are destroyed#1494
tiweb442 wants to merge 3 commits into
lanedirt:mainfrom
tiweb442:fix/1341-destroyed-moon-messages

Conversation

@tiweb442

Copy link
Copy Markdown
Contributor

Summary

  • Add FleetMissionPlanetFormatter to emit [planet], [coordinates], or [debrisfield] tags so fleet messages never store broken [planet][/planet] placeholders when a body was deleted
  • Redirect active return/inbound missions to the parent planet before a moon is removed (not only outbound launches)
  • Snapshot attacker origin name/coords/type in battle reports and use stored data when the origin planet no longer exists

Fixes #1341

Test plan

  • ./vendor/bin/phpunit tests/Unit/FleetMissionPlanetFormatterTest.php
  • Transport from moon → destroy moon mid-flight → arrival/return messages render valid text
  • Attack report still shows attacker origin after attacker moon is destroyed

Made with Cursor

Use coordinate/debris fallbacks instead of empty [planet] tags when
planet IDs are missing, redirect active return missions to the parent
planet before moon deletion, and snapshot attacker origin data in battle
reports. Fixes lanedirt#1341

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442

Copy link
Copy Markdown
Contributor Author

Related PRs from tiweb442 (same deployment / review batch)

Issue PR
#1341 Destroyed moons/planets break messages #1494 (this)
#1472 Phalanx wrap-around #1491
#1446 Fleet movement during moon destruction #1492
#1395 Unban + vacation lock #1493
#1327 Email system #1375

What this fixes: Fleet messages no longer emit broken [planet][/planet] tags when planet_id_* is null after moon/planet deletion; active return missions are redirected to the parent planet before moon removal; battle reports snapshot attacker origin data at creation time.

Merge order: Independent of #1491#1493. Touches MoonDestructionMission.php like #1492 but different lines (battle report snapshot vs $friendlyStatus).

@tiweb442

Copy link
Copy Markdown
Contributor Author

Ready for maintainer review — preview is live and mergeable with main.

@lanedirt @jackbayliss Could you review when you have a moment? Fork PRs may also need “Approve and run workflows” so Pint / PHPStan / Docker tests run (currently only PR Preview has completed).

Test on preview: https://pr-1494.preview.ogamex.dev

Use int|null for PHPStan noShortNullableType, and assign FleetMission
attributes directly in unit tests to avoid mass-assignment exceptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442

Copy link
Copy Markdown
Contributor Author

CI fixes pushed:

  1. PHPStan: ?intint|null on buildAttackerPlanetSnapshot
  2. Unit tests: assign FleetMission attributes directly instead of constructor mass-assignment

Keep FleetMissionPlanetFormatter for destroyed planet/moon message tags
while using main's null-safe player variables for message recipients.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

Preview deployment

Preview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.

Status URL Commit Last deployed
✅ Live https://pr-1494.preview.ogamex.dev dfba27c 2026-07-24 22:06:58 UTC
Test accounts (click to expand)
Email (login) Password Role Class Planets Description
test1@ogamex.dev test admin Collector 2 Admin, high resources, mining focus
test2@ogamex.dev test player General 1 Military focus, ships & fleet
test3@ogamex.dev test player Discoverer 1 Exploration, probes & cargo ships
test4@ogamex.dev test player None 1 New player, no class selected yet
test5@ogamex.dev test moderator Collector 1 Moderator, balanced setup
test6@ogamex.dev test player General 1 Vacation mode enabled
test7@ogamex.dev test player General 3 Heavy defense across planets
test8@ogamex.dev test player Discoverer 1 Fleet focus, inactive (i) 8 days
test9@ogamex.dev test player Collector 1 Beginner, long inactive (I) 40 days
test10@ogamex.dev test player General 5 Endgame, 90 unread messages

This preview will be automatically destroyed when the PR is closed.

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.

[BUG] Destroyed moons break messages

1 participant