Skip to content

Commit

Permalink
Make Aftershock atomic smartphone a valid music-playing device. (#37584)
Browse files Browse the repository at this point in the history
* Update iuse.cpp

Make afs_atomic_smartphone a valid music-playing device.

* Add wratheon smartphone to the list.
  • Loading branch information
eilaattwood authored Feb 3, 2020
1 parent db6e71e commit 8a00dcf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
11 changes: 11 additions & 0 deletions data/mods/Aftershock/items/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,20 @@
"type": "transform"
},
"CAMERA",
"MP3",
"ROBOTCONTROL"
]
},
{
"id": "afs_atomic_wraitheon_music",
"copy-from": "afs_wraitheon_smartphone",
"type": "TOOL",
"name": { "str": "Wraitheon executive's smartphone - music", "str_pl": "Wraitheon executive's smartphones - music" },
"description": "This phone is playing music, steadily raising your morale. You can't hear anything else while you're listening.",
"revert_to": "afs_atomic_smartphone",
"use_action": "MP3_ON",
"flags": [ "WATCH", "TRADER_AVOID", "ALARMCLOCK", "NO_UNLOAD", "NO_RELOAD" ]
},
{
"id": "afs_atomic_wraitheon_flashlight",
"copy-from": "afs_atomic_smartphone_flashlight",
Expand Down
19 changes: 16 additions & 3 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4099,9 +4099,12 @@ int iuse::shocktonfa_on( player *p, item *it, bool t, const tripoint &pos )

int iuse::mp3( player *p, item *it, bool, const tripoint & )
{
// TODO: avoid item id hardcoding to make this function usable for pure json-defined devices.
if( !it->units_sufficient( *p ) ) {
p->add_msg_if_player( m_info, _( "The device's batteries are dead." ) );
} else if( p->has_active_item( "mp3_on" ) || p->has_active_item( "smartphone_music" ) ) {
} else if( p->has_active_item( "mp3_on" ) || p->has_active_item( "smartphone_music" ) ||
p->has_active_item( "afs_atomic_smartphone_music" ) ||
p->has_active_item( "afs_atomic_wraitheon_music" ) ) {
p->add_msg_if_player( m_info, _( "You are already listening to music!" ) );
} else {
p->add_msg_if_player( m_info, _( "You put in the earbuds and start listening to music." ) );
Expand All @@ -4110,8 +4113,12 @@ int iuse::mp3( player *p, item *it, bool, const tripoint & )
p->mod_moves( -200 );
} else if( it->typeId() == "smart_phone" ) {
it->convert( "smartphone_music" ).active = true;
p->mod_moves( -200 );
} else if( it->typeId() == "afs_atomic_smartphone" ) {
it->convert( "afs_atomic_smartphone_music" ).active = true;
} else if( it->typeId() == "afs_wraitheon_smartphone" ) {
it->convert( "afs_atomic_wraitheon_music" ).active = true;
}
p->mod_moves( -200 );
}
return it->type->charges_to_use();
}
Expand Down Expand Up @@ -4192,8 +4199,14 @@ int iuse::mp3_on( player *p, item *it, bool t, const tripoint &pos )
} 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 );
} else if( it->typeId() == "afs_atomic_smartphone_music" ) {
p->add_msg_if_player( _( "The phone turns off." ) );
it->convert( "afs_atomic_smartphone" ).active = false;
} else if( it->typeId() == "afs_atomic_wraitheon_music" ) {
p->add_msg_if_player( _( "The phone turns off." ) );
it->convert( "afs_wraitheon_smartphone" ).active = false;
}
p->mod_moves( -200 );
}
return it->type->charges_to_use();
}
Expand Down

0 comments on commit 8a00dcf

Please sign in to comment.