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

Fix early mech dismount leaving you armed #2781

Merged
merged 3 commits into from
May 13, 2023

Conversation

chaosvolt
Copy link
Member

Summary

SUMMARY: Bugfixes "Mounting mechs now checks that you're still mounted before handing you the mech's weapon"

Purpose of change

It was discovered by Kierst on the BN discord that if you have a mech that gets stuck in a pit, and you attempt to mount it again while it's still in there, you'll bug out and get tossed off again yet end up with the mech's gun glued to your hands. This aims to prevent that.

Describe the solution

In character.cpp, changed Character::mount_creature so that the parts of the function that handle giving out the mech gun check to make sure the player still counts as riding the mech before doing so. Since Character::forced_dismount doesn't actually interrupt this sequence of events when it triggers, this ensures that the player will at least not be stuck with a weapon they now can't drop, which prevents them from re-mounting their mech to potentially fix themselves.

Describe alternatives you've considered

Rigging it so that Character::mount_creature can't trigger trap effects midway through, on the basis that the mech itself technically isn't moving, would be another hypothetical way to fix this.

But if any other event dislodges the player from the mech midway through mounting their mech, like being pushed by an explosion, snared by a grappler zombie, or their mech getting shot out from under them before boarding has finished, this change still ensures that any unexpected interruption of the mounting action can't softlock the player with an undroppable gun.

Testing

  1. Compiled and load-tested.
  2. Spawned in a mech, carded it, and boarded it to test that the gun still appears in my hands like normal.
  3. Tested dismounted the mech, weapon vanishes as normal.
  4. Re-boarded and walked the mech into a pit to yeet myself, confirmed the gun is removed like normal.
  5. Tried and failed to get back on the mech while it was stuck in a pit, confirmed I'm no longer left with a gun I can't get rid of, and the last two messages in the normal process of climbing into the mech don't print.
  6. Checked affected file for astyle.

Additional context

@github-actions github-actions bot added the src PR changes related to source code. label May 9, 2023
@scarf005 scarf005 self-requested a review May 12, 2023 08:49
@scarf005 scarf005 self-assigned this May 12, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

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

Testing

Compiled and load-tested.
Spawned in a mech, carded it, and boarded it to test that the gun still appears in my hands like normal.

image

Tested dismounted the mech, weapon vanishes as normal.

image

Re-boarded and walked the mech into a pit to yeet myself, confirmed the gun is removed like normal.

Tried and failed to get back on the mech while it was stuck in a pit, confirmed I'm no longer left with a gun I can't get rid of, and the last two messages in the normal process of climbing into the mech don't print.

image

image

LGTM

@scarf005 scarf005 merged commit 642ff9a into cataclysmbnteam:upload May 13, 2023
16 checks passed
@chaosvolt chaosvolt deleted the mech-goes-yeet branch May 13, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src PR changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants