Fix early mech dismount leaving you armed #2781
Merged
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
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. SinceCharacter::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
Additional context