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

Prevent safecracking attempt while wearing earbuds #37528

Merged
merged 3 commits into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 );
}
codemime marked this conversation as resolved.
Show resolved Hide resolved
}
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