Adds Sleep Music to Surgery/Cryo/Sleeper

Plays quiet music when you have;
- An anesthetic mask on your face.
- Been put into a cryopod
- Been put into a sleeper

TBD: Maybe make sleeping do it, but iirc even dying does sleep.

There is a pref toggle for these under Preferences: "Sleeping Music"

Example [here](https://streamable.com/pls63y) of surgery being done. Volume is higher than normal, was adjusted down to 40%.
This commit is contained in:
Rykka Stormheart
2023-03-04 15:56:56 -08:00
parent 6cd9b042ed
commit 2982a7ca85
9 changed files with 91 additions and 2 deletions

View File

@@ -21,3 +21,14 @@
// volume_chan = VOLUME_CHANNEL_INJ_DEATH // Commented out until pain/etc PR is in
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/mob/cozyloop
mid_sounds = list('modular_chomp/sound/misc/cozy.ogg'=1)
mid_length = 21 SECONDS
volume = 40
pref_check = /datum/client_preference/sleep_music
direct = TRUE // We send this sound directly to the mob, bc they only hear it when they're asleep.
exclusive = TRUE // This should only occur once, because we only want one music loop running while we snooze.
// volume_chan = VOLUME_CHANNEL_INJ_DEATH // Commented out until pain/etc PR is in
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -169,7 +169,7 @@
/obj/machinery/sleeper/attack_hand(var/mob/user)
if(!controls_inside)
return FALSE
if(user == occupant)
tgui_interact(user)
@@ -481,10 +481,12 @@
M.loc = src
update_use_power(USE_POWER_ACTIVE)
occupant = M
occupant.cozyloop.start() // CHOMPStation Add: Cozy Music
update_icon()
/obj/machinery/sleeper/proc/go_out()
if(!occupant || occupant.loc != src)
occupant.cozyloop.stop() // CHOMPStation Add: Cozy Music
occupant = null // JUST IN CASE
return
if(occupant.client)
@@ -492,6 +494,7 @@
occupant.client.perspective = MOB_PERSPECTIVE
occupant.Stasis(0)
occupant.loc = src.loc
occupant.cozyloop.stop() // CHOMPStation Add: Cozy Music
occupant = null
for(var/atom/movable/A in src) // In case an object was dropped inside or something
if(A == beaker || A == circuit)

View File

@@ -273,6 +273,7 @@
if(occupant.bodytemperature < 261 && occupant.bodytemperature >= 70) //Patch by Aranclanos to stop people from taking burn damage after being ejected
occupant.bodytemperature = 261 // Changed to 70 from 140 by Zuhayr due to reoccurance of bug.
unbuckle_mob(occupant, force = TRUE)
occupant.cozyloop.stop() // CHOMPStation Add: Cozy Music
occupant = null
current_heat_capacity = initial(current_heat_capacity)
update_use_power(USE_POWER_IDLE)
@@ -304,6 +305,7 @@
if(M.health > -100 && (M.health < 0 || M.sleeping))
to_chat(M, "<span class='notice'><b>You feel a cold liquid surround you. Your skin starts to freeze up.</b></span>")
occupant = M
occupant.cozyloop.start() // CHOMPStation Add: Cozy Music
buckle_mob(occupant, forced = TRUE, check_loc = FALSE)
vis_contents |= occupant
occupant.pixel_y += 19

View File

@@ -30,6 +30,7 @@
if(breather.internals)
breather.internals.icon_state = "internal0"
breather.remove_from_mob(contained)
breather.cozyloop.stop() // CHOMPStation Add: Cozy Music
visible_message("<span class='notice'>\The [contained] rapidly retracts just before /the [src] is destroyed!</span>")
breather = null
@@ -70,6 +71,7 @@
breather.remove_from_mob(contained)
contained.forceMove(src)
src.visible_message("<b>\The [user]</b> makes \the [contained] rapidly retract back into \the [src]!")
breather.cozyloop.stop() // CHOMPStation Add: Cozy Music
if(breather.internals)
breather.internals.icon_state = "internal0"
breather = null
@@ -160,6 +162,7 @@
tank.forceMove(src)
breather.remove_from_mob(contained)
contained.forceMove(src)
breather.cozyloop.stop() // CHOMPStation Add: Cozy Music
src.visible_message("<span class='notice'>\The [contained] rapidly retracts back into \the [src]!</span>")
breather = null
update_use_power(USE_POWER_IDLE)
@@ -237,6 +240,23 @@
icon_state_open = "anesthetic_tank_open"
mask_type = /obj/item/clothing/mask/breath/anesthetic
// CHOMPStation Add: Cozy Music
/obj/machinery/oxygen_pump/anesthetic/attach_mask(var/mob/living/carbon/C)
if(C && istype(C))
contained.forceMove(get_turf(C))
C.equip_to_slot(contained, slot_wear_mask)
if(tank)
tank.forceMove(C)
breather = C
spawn(1)
if(!breather.internal && tank)
breather.internal = tank
if(breather.internals)
breather.internals.icon_state = "internal1"
update_use_power(USE_POWER_ACTIVE)
breather.cozyloop.start()
// CHOMPStation Add End
/obj/machinery/oxygen_pump/mobile
name = "portable oxygen pump"
icon = 'icons/obj/atmos.dmi'
@@ -273,6 +293,23 @@
icon_state_open = "medpump_n2o_open"
mask_type = /obj/item/clothing/mask/breath/anesthetic
// CHOMPStation Add: Cozy Music
/obj/machinery/oxygen_pump/mobile/anesthetic/attach_mask(var/mob/living/carbon/C)
if(C && istype(C))
contained.forceMove(get_turf(C))
C.equip_to_slot(contained, slot_wear_mask)
if(tank)
tank.forceMove(C)
breather = C
spawn(1)
if(!breather.internal && tank)
breather.internal = tank
if(breather.internals)
breather.internals.icon_state = "internal1"
update_use_power(USE_POWER_ACTIVE)
breather.cozyloop.start()
// CHOMPStation Add End
/obj/machinery/oxygen_pump/mobile/stabilizer
name = "portable patient stabilizer"
desc = "A portable oxygen pump with a retractable mask used for stabilizing patients in the field."

View File

@@ -381,7 +381,7 @@ var/list/_client_preferences_by_type
key = "RECEIVE_TIPS"
enabled_description = "Enabled"
disabled_description = "Disabled"
/datum/client_preference/pain_frequency
description = "Pain Messages Cooldown"
key = "PAIN_FREQUENCY"
@@ -389,6 +389,14 @@ var/list/_client_preferences_by_type
enabled_description = "Extended"
disabled_description = "Default"
// CHOMPAdd
/datum/client_preference/sleep_music
description = "Sleeping Music"
key = "SLEEP_MUSIC"
enabled_description = "Audible"
disabled_description = "Silent"
// CHOMPAdd End
/********************
* Staff Preferences *

View File

@@ -12,3 +12,18 @@
SScharacter_setup.queue_preferences_save(prefs)
feedback_add_details("admin_verb","TAlarmLoops") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_sleep_music()
set name = "Toggle Sleeping Music"
set category = "Preferences"
set desc = "When enabled, you will hear cozy music played during surgery, cryo, and sleeper pod usage."
var/pref_path = /datum/client_preference/sleep_music
toggle_preference(pref_path)
to_chat(src, "You are [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hearing sleeping music while in cryo/surgery/sleeper.")
SScharacter_setup.queue_preferences_save(prefs)
feedback_add_details("admin_verb", "TSleepMusic")

View File

@@ -0,0 +1,12 @@
/mob/living/carbon
var/datum/looping_sound/mob/cozyloop/cozyloop
/mob/living/carbon/Initialize()
. = ..()
cozyloop = new(list(src), FALSE)
/mob/living/carbon/Destroy()
. = ..()
QDEL_NULL(cozyloop)

Binary file not shown.

View File

@@ -4579,6 +4579,7 @@
#include "modular_chomp\code\modules\mob\dead\observer\observer.dm"
#include "modular_chomp\code\modules\mob\living\emote.dm"
#include "modular_chomp\code\modules\mob\living\living.dm"
#include "modular_chomp\code\modules\mob\living\carbon\carbon.dm"
#include "modular_chomp\code\modules\mob\living\carbon\brain\MMI.dm"
#include "modular_chomp\code\modules\mob\living\carbon\human\emote.dm"
#include "modular_chomp\code\modules\mob\living\carbon\human\human.dm"