Skip to content

Commit

Permalink
Fix early mech dismount leaving you armed (cataclysmbnteam#2781)
Browse files Browse the repository at this point in the history
* Fix early mech dismount leaving you armed

* refactor: use auto

---------

Co-authored-by: scarf <[email protected]>
  • Loading branch information
chaosvolt and scarf005 authored May 13, 2023
1 parent 7bbaa01 commit 642ff9a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,16 @@ void Character::mount_creature( monster &z )
guy.setpos( pnt );
}
z.facing = facing;
add_msg_if_player( m_good, _( "You climb on the %s." ), z.get_name() );
if( z.has_flag( MF_RIDEABLE_MECH ) ) {
if( !z.type->mech_weapon.is_empty() ) {
item mechwep = item( z.type->mech_weapon );
wield( mechwep );
// Make sure something didn't interrupt this process and knock the player off partway through!
if( has_effect( effect_riding ) ) {
add_msg_if_player( m_good, _( "You climb on the %s." ), z.get_name() );
if( z.has_flag( MF_RIDEABLE_MECH ) ) {
if( !z.type->mech_weapon.is_empty() ) {
auto mechwep = item{ z.type->mech_weapon };
wield( mechwep );
}
add_msg_if_player( m_good, _( "You hear your %s whir to life." ), z.get_name() );
}
add_msg_if_player( m_good, _( "You hear your %s whir to life." ), z.get_name() );
}
// some rideable mechs have night-vision
recalc_sight_limits();
Expand Down

0 comments on commit 642ff9a

Please sign in to comment.