Skip to content

Commit a0ed233

Browse files
Smart watches can actually play music (#83021)
* initial commit * fix itypes order
1 parent 3b6ac9b commit a0ed233

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

data/json/items/tool_armor.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,18 @@
540540
"armor": [ { "coverage": 100, "covers": [ "hand_l", "hand_r" ], "specifically_covers": [ "hand_wrist_l", "hand_wrist_r" ] } ],
541541
"tool_ammo": "battery"
542542
},
543+
{
544+
"id": "smart_watch_music",
545+
"copy-from": "smart_watch",
546+
"type": "ITEM",
547+
"subtypes": [ "TOOL" ],
548+
"name": { "str": "smart watch - music", "str_pl": "smart watches - music" },
549+
"description": "This smart watch is playing music, steadily raising your morale. You can't hear anything else while you're listening.",
550+
"revert_to": "smart_watch",
551+
"use_action": [ "MP3_DEACTIVATE", "CALORIES_INTAKE_TRACKER", "FITNESS_CHECK", "PORTABLE_GAME" ],
552+
"tick_action": [ "MP3_ON" ],
553+
"extend": { "flags": [ "TRADER_AVOID" ] }
554+
},
543555
{
544556
"type": "ITEM",
545557
"subtypes": [ "TOOL", "ARMOR" ],
@@ -577,6 +589,18 @@
577589
}
578590
]
579591
},
592+
{
593+
"id": "smart_watch_adv_music",
594+
"copy-from": "smart_watch_adv",
595+
"type": "ITEM",
596+
"subtypes": [ "TOOL" ],
597+
"name": { "str": "advanced smart watch - music", "str_pl": "advanced smart watches - music" },
598+
"description": "This advanced smart watch is playing music, steadily raising your morale. You can't hear anything else while you're listening.",
599+
"revert_to": "smart_watch",
600+
"use_action": [ "MP3_DEACTIVATE", "CALORIES_INTAKE_TRACKER", "FITNESS_CHECK", "PORTABLE_GAME" ],
601+
"tick_action": [ "MP3_ON" ],
602+
"extend": { "flags": [ "TRADER_AVOID" ] }
603+
},
580604
{
581605
"type": "ITEM",
582606
"subtypes": [ "TOOL", "ARMOR" ],

data/mods/TEST_DATA/known_bad_uncrafts.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5418,6 +5418,8 @@
54185418
"smart_phone_locked_flashlight",
54195419
"smart_watch",
54205420
"smart_watch_adv",
5421+
"smart_watch_music",
5422+
"smart_watch_adv_music",
54215423
"smartphone_music",
54225424
"smg_40_mag",
54235425
"smg_45_mag",

src/iuse.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ static const itype_id itype_rebreather_xl_on( "rebreather_xl_on" );
315315
static const itype_id itype_shocktonfa_off( "shocktonfa_off" );
316316
static const itype_id itype_shocktonfa_on( "shocktonfa_on" );
317317
static const itype_id itype_smart_phone( "smart_phone" );
318+
static const itype_id itype_smart_watch( "smart_watch" );
319+
static const itype_id itype_smart_watch_adv( "smart_watch_adv" );
320+
static const itype_id itype_smart_watch_adv_music( "smart_watch_adv_music" );
321+
static const itype_id itype_smart_watch_music( "smart_watch_music" );
318322
static const itype_id itype_smartphone_music( "smartphone_music" );
319323
static const itype_id itype_soap( "soap" );
320324
static const itype_id itype_soldering_iron( "soldering_iron" );
@@ -3842,7 +3846,9 @@ std::optional<int> iuse::mp3( Character *p, item *it, const tripoint_bub_ms & )
38423846
p->add_msg_if_player( m_info, _( "The device's batteries are dead." ) );
38433847
} else if( p->has_active_item( itype_mp3_on ) || p->has_active_item( itype_smartphone_music ) ||
38443848
p->has_active_item( itype_afs_atomic_smartphone_music ) ||
3845-
p->has_active_item( itype_afs_atomic_wraitheon_music ) ) {
3849+
p->has_active_item( itype_afs_atomic_wraitheon_music ) ||
3850+
p->has_active_item( itype_smart_watch_music ) ||
3851+
p->has_active_item( itype_smart_watch_adv_music ) ) {
38463852
p->add_msg_if_player( m_info, _( "You are already listening to music!" ) );
38473853
} else {
38483854
p->add_msg_if_player( m_info, _( "You put in the earbuds and start listening to music." ) );
@@ -3854,6 +3860,10 @@ std::optional<int> iuse::mp3( Character *p, item *it, const tripoint_bub_ms & )
38543860
it->convert( itype_afs_atomic_smartphone_music, p ).active = true;
38553861
} else if( it->typeId() == itype_afs_wraitheon_smartphone ) {
38563862
it->convert( itype_afs_atomic_wraitheon_music, p ).active = true;
3863+
} else if( it->typeId() == itype_smart_watch ) {
3864+
it->convert( itype_smart_watch_music, p ).active = true;
3865+
} else if( it->typeId() == itype_smart_watch_adv ) {
3866+
it->convert( itype_smart_watch_adv_music, p ).active = true;
38573867
}
38583868
p->mod_moves( -200 );
38593869
}
@@ -3962,6 +3972,12 @@ std::optional<int> iuse::mp3_deactivate( Character *p, item *it, const tripoint_
39623972
} else if( it->typeId() == itype_afs_atomic_wraitheon_music ) {
39633973
p->add_msg_if_player( _( "The phone turns off." ) );
39643974
it->convert( itype_afs_wraitheon_smartphone, p ).active = false;
3975+
} else if( it->typeId() == itype_smart_watch_music ) {
3976+
p->add_msg_if_player( _( "The phone turns off." ) );
3977+
it->convert( itype_smart_watch, p ).active = false;
3978+
} else if( it->typeId() == itype_smart_watch_adv_music ) {
3979+
p->add_msg_if_player( _( "The phone turns off." ) );
3980+
it->convert( itype_smart_watch_adv, p ).active = false;
39653981
}
39663982
p->mod_moves( -200 );
39673983
music::deactivate_music_id( music::music_id::mp3 );

0 commit comments

Comments
 (0)