Skip to content

Commit

Permalink
Merge pull request #37528 from wapcaplet/no-headphone-safecracking
Browse files Browse the repository at this point in the history
Prevent safecracking attempt while wearing earbuds
  • Loading branch information
ZhilkinSerg authored Feb 1, 2020
2 parents cc69506 + 732dc8d commit 3f4c657
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static const efftype_id effect_mending( "mending" );
static const efftype_id effect_pkill2( "pkill2" );
static const efftype_id effect_teleglow( "teleglow" );
static const efftype_id effect_sleep( "sleep" );
static const efftype_id effect_earphones( "earphones" );

static const trait_id trait_DEBUG_HS( "DEBUG_HS" );
static const trait_id trait_AMORPHOUS( "AMORPHOUS" );
Expand Down Expand Up @@ -1219,8 +1220,10 @@ void iexamine::safe( player &p, const tripoint &examp )
if( p.is_deaf() ) {
add_msg( m_info, _( "You can't crack a safe while deaf!" ) );
return;
}
if( query_yn( _( "Attempt to crack the safe?" ) ) ) {
} else if( p.has_effect( effect_earphones ) ) {
add_msg( m_info, _( "You can't crack a safe with earbuds on!" ) );
return;
} else if( query_yn( _( "Attempt to crack the safe?" ) ) ) {
add_msg( m_info, _( "You start cracking the safe." ) );
// 150 minutes +/- 20 minutes per mechanics point away from 3 +/- 10 minutes per
// perception point away from 8; capped at 30 minutes minimum. *100 to convert to moves
Expand Down
4 changes: 4 additions & 0 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4106,8 +4106,10 @@ int iuse::mp3( player *p, item *it, bool, const tripoint & )
p->add_msg_if_player( m_info, _( "You put in the earbuds and start listening to music." ) );
if( it->typeId() == "mp3" ) {
it->convert( "mp3_on" ).active = true;
p->mod_moves( -200 );
} else if( it->typeId() == "smart_phone" ) {
it->convert( "smartphone_music" ).active = true;
p->mod_moves( -200 );
}
}
return it->type->charges_to_use();
Expand Down Expand Up @@ -4185,9 +4187,11 @@ int iuse::mp3_on( player *p, item *it, bool t, const tripoint &pos )
if( it->typeId() == "mp3_on" ) {
p->add_msg_if_player( _( "The mp3 player turns off." ) );
it->convert( "mp3" ).active = false;
p->mod_moves( -200 );
} else if( it->typeId() == "smartphone_music" ) {
p->add_msg_if_player( _( "The phone turns off." ) );
it->convert( "smart_phone" ).active = false;
p->mod_moves( -200 );
}
}
return it->type->charges_to_use();
Expand Down

0 comments on commit 3f4c657

Please sign in to comment.