mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-16 01:23:41 +01:00
Headphones, fix unreachable dropoff threshold, etc.
This commit is contained in:
@@ -27,12 +27,6 @@
|
||||
user.visible_message("<span class='suicide'>[user] begins to play 'Gloomy Sunday'! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/instrument/attack_self(mob/user)
|
||||
if(!user.IsAdvancedToolUser())
|
||||
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return TRUE
|
||||
interact(user)
|
||||
|
||||
/obj/item/instrument/attack_self(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/obj/item/clothing/ears/headphones
|
||||
name = "headphones"
|
||||
desc = "Unce unce unce unce."
|
||||
icon_state = "headphones0"
|
||||
item_state = "headphones0"
|
||||
actions_types = list(/datum/action/item_action/change_headphones_song)
|
||||
var/datum/song/headphones/song
|
||||
|
||||
/obj/item/clothing/ears/headphones/Initialize(mapload)
|
||||
. = ..()
|
||||
song = new(src, "piano") // Piano is the default instrument but all instruments are allowed
|
||||
song.instrument_range = 0
|
||||
song.allowed_instrument_ids = SSinstruments.synthesizer_instrument_ids
|
||||
// To update the icon
|
||||
RegisterSignal(src, COMSIG_SONG_START, .proc/start_playing)
|
||||
RegisterSignal(src, COMSIG_SONG_END, .proc/stop_playing)
|
||||
|
||||
/obj/item/clothing/ears/headphones/Destroy()
|
||||
QDEL_NULL(song)
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/ears/headphones/attack_self(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/item/clothing/ears/headphones/tgui_data(mob/user)
|
||||
return song.tgui_data(user)
|
||||
|
||||
/obj/item/clothing/ears/headphones/tgui_interact(mob/user)
|
||||
if(should_stop_playing(user) || user.incapacitated())
|
||||
return
|
||||
song.tgui_interact(user)
|
||||
|
||||
/obj/item/clothing/ears/headphones/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
return song.tgui_act(action, params)
|
||||
|
||||
/obj/item/clothing/ears/headphones/update_icon()
|
||||
var/mob/living/carbon/human/user = loc
|
||||
if(istype(user))
|
||||
user.update_action_buttons_icon()
|
||||
user.update_inv_ears()
|
||||
..()
|
||||
|
||||
/obj/item/clothing/ears/headphones/item_action_slot_check(slot)
|
||||
if(slot == slot_l_ear || slot == slot_r_ear)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Called by a component signal when our song starts playing.
|
||||
*/
|
||||
/obj/item/clothing/ears/headphones/proc/start_playing()
|
||||
icon_state = item_state = "headphones1"
|
||||
update_icon()
|
||||
|
||||
/**
|
||||
* Called by a component signal when our song stops playing.
|
||||
*/
|
||||
/obj/item/clothing/ears/headphones/proc/stop_playing()
|
||||
icon_state = item_state = "headphones0"
|
||||
update_icon()
|
||||
|
||||
/**
|
||||
* Whether the headphone's song should stop playing
|
||||
*
|
||||
* Arguments:
|
||||
* * user - The user
|
||||
*/
|
||||
/obj/item/clothing/ears/headphones/proc/should_stop_playing(mob/living/carbon/human/user)
|
||||
return !(src in user) || !istype(user) || !((src == user.l_ear) || (src == user.r_ear))
|
||||
|
||||
// special subtype so it uses the correct item type
|
||||
/datum/song/headphones
|
||||
|
||||
/datum/song/headphones/should_stop_playing(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return TRUE
|
||||
var/obj/item/clothing/ears/headphones/I = parent
|
||||
return I.should_stop_playing(user)
|
||||
@@ -39,7 +39,7 @@
|
||||
icon_state = "guitar"
|
||||
item_state = "guitar"
|
||||
attack_verb = list("played metal on", "serenaded", "crashed", "smashed")
|
||||
hitsound = 'sound/weapons/stringsmash.ogg'
|
||||
hitsound = 'sound/weapons/guitarslam.ogg'
|
||||
allowed_instrument_ids = "guitar"
|
||||
|
||||
/obj/item/instrument/eguitar
|
||||
|
||||
Reference in New Issue
Block a user