Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force destruction of out-of-control DropShips and larger #5845

Merged

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Aug 3, 2024

This is the final step to completing the Errata from #770: enforce destruction of DropShips (and larger) that crash while out of control.

Note: this may be gilding the lily, as the chances of most DropShips surviving crashes is slim already. But this will ensure that, after all damage is dealt and terrain is re-arranged, the crashing unit will be utterly kaput.

Testing:

  • Crashed some out-of-control DropShips
  • Ran all 3 projects' unit tests.

Close #770

@Sleet01 Sleet01 requested a review from HammerGS August 3, 2024 04:30
@@ -207,9 +206,9 @@ public MovePath addStep(final MoveStepType type, final boolean noCost) {
}

public MovePath addStep(final MoveStepType type, final Map<Integer, Integer> additionalIntData) {
return addStep(new MoveStep(this, type, additionalIntData));
return addStep(new MoveStep(this, type, additionalIntData));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IDEA just reallllly disliked the formatting in this file.

@@ -4898,6 +4898,7 @@ else if (game.getBoard().onGround()) {
private Vector<Report> processCrash(Entity entity, int vel, Coords c) {
Vector<Report> vReport = new Vector<>();
Report r;
boolean destroyDropShip = false; // save for later
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New code part 1.

Comment on lines 4917 to 4921
// If out of control, destruction (of DropShips and larger) is assured.
destroyDropShip = (entity instanceof Dropship || entity instanceof Jumpship)
&& ((IAero) entity).isOutControlTotal();

// Technically bring to a halt; actual landing is handled elsewhere.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New code part 2.

Comment on lines 5171 to 5178
if (destroyDropShip) {
// Out-of-control DropShip that crashes is automatically destroyed.
r = new Report(9708, Report.PUBLIC);
r.indent();
r.addDesc(entity);
vReport.addAll(destroyEntity(entity, "Crashed while out of control!"));
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New code part 3; actually finishes the job.

Copy link

codecov bot commented Aug 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.99%. Comparing base (6a651eb) to head (a55a508).
Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5845      +/-   ##
============================================
- Coverage     28.99%   28.99%   -0.01%     
  Complexity    13930    13930              
============================================
  Files          2512     2512              
  Lines        267279   267289      +10     
  Branches      47833    47837       +4     
============================================
+ Hits          77509    77510       +1     
- Misses       185820   185829       +9     
  Partials       3950     3950              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@NickAragua NickAragua left a comment

Choose a reason for hiding this comment

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

While it looks fine (other than the minor cleanup), I'm likely to introduce an unofficial option to keep large craft alive upon crashing. Because, dammit, if the thing's hull integrity is intact, we should be able to keep it going.

megamek/src/megamek/server/GameManager.java Show resolved Hide resolved
megamek/src/megamek/server/GameManager.java Outdated Show resolved Hide resolved
@Sleet01
Copy link
Collaborator Author

Sleet01 commented Aug 3, 2024

While it looks fine (other than the minor cleanup), I'm likely to introduce an unofficial option to keep large craft alive upon crashing. Because, dammit, if the thing's hull integrity is intact, we should be able to keep it going.

I can add an option to turn this rule off, but as a reminder, it's only for Large Craft crashing while out of control. If they crash due to loss of thrust or some other reason, they'll be treated as before.

@Sleet01 Sleet01 requested a review from NickAragua August 3, 2024 06:54
@Sleet01 Sleet01 force-pushed the Fix_770_destroy_crashing_out_of_control_DSes branch from 8af3671 to a55a508 Compare August 3, 2024 09:57
@Sleet01 Sleet01 merged commit 3a15b11 into MegaMek:master Aug 3, 2024
5 checks passed
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.

New Errata - Impacting crashes of Aero Units
2 participants