diff --git a/code/__DEFINES/droning_defines.dm b/code/__DEFINES/droning_defines.dm new file mode 100644 index 00000000000..0be50a61d96 --- /dev/null +++ b/code/__DEFINES/droning_defines.dm @@ -0,0 +1,14 @@ +#define DRONING_DEFAULT list('sound/ambience/shipambience.ogg') + +#define DRONING_AMBIENCE list('sound/droning/ambience1.ogg') + +#define DRONING_NORMAL list('sound/droning/normal_droning1.ogg', \ + 'sound/droning/normal_droning2.ogg') + +#define DRONING_ENGINEERING list('sound/droning/engi_droning1.ogg') + +#define DRONING_MAINTENANCE list('sound/droning/maint_droning1.ogg') + +#define DRONING_SECURITY list('sound/droning/sec_droning1.ogg') + +#define DRONING_MEDICAL list('sound/droning/med_droning1.ogg') diff --git a/code/controllers/subsystem/droning.dm b/code/controllers/subsystem/droning.dm new file mode 100644 index 00000000000..675662d94e5 --- /dev/null +++ b/code/controllers/subsystem/droning.dm @@ -0,0 +1,36 @@ +//Used to manage sending droning sounds to various clients +SUBSYSTEM_DEF(droning) + name = "Droning" + flags = SS_NO_INIT|SS_NO_FIRE + +/datum/controller/subsystem/droning/proc/area_entered(area/area_entered, client/entering) + if(!area_entered || !entering) + return + var/list/last_droning = list() + last_droning |= entering.last_droning_sound + var/list/new_droning = list() + new_droning |= area_entered.droning_sound + //Same ambience, don't bother + if(last_droning ~= new_droning) + return + play_area_sound(area_entered, entering) + +/datum/controller/subsystem/droning/proc/play_area_sound(area/area_player, client/listener) + if(!area_player || !listener) + return + if(LAZYLEN(area_player.droning_sound) && (listener.prefs.toggles & SOUND_SHIP_AMBIENCE)) + //kill the previous droning sound + kill_droning(listener) + var/sound/droning = sound(pick(area_player.droning_sound), area_player.droning_repeat, area_player.droning_wait, area_player.droning_channel, area_player.droning_volume) + SEND_SOUND(listener, droning) + listener.droning_sound = droning + listener.last_droning_sound = area_player.droning_sound + +/datum/controller/subsystem/droning/proc/kill_droning(client/victim) + if(!victim?.droning_sound) + return + var/sound/sound_killer = sound() + sound_killer.channel = victim.droning_sound.channel + SEND_SOUND(victim, sound_killer) + victim.droning_sound = null + victim.last_droning_sound = null diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 6e2a39f9650..593dc5a5ab3 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -121,6 +121,15 @@ /// The airlock controller in this area. Used by mapped custom controllers to yell at mappers. var/obj/machinery/airlock_controller/airlock_controller + /// DRONING SYSTEM VARIABLES + var/droning_sound = DRONING_DEFAULT + var/droning_vary = 0 + var/droning_repeat = TRUE + var/droning_wait = 0 + var/droning_volume = 25 + var/droning_channel = CHANNEL_BUZZ + var/droning_frequency = 0 + /** * A list of teleport locations * @@ -416,6 +425,12 @@ GLOBAL_LIST_EMPTY(teleportlocs) if(!isliving(arrived)) return + var/mob/living/living_arrived = arrived + if(living_arrived.client && !living_arrived.combat_mode) + //Ambience if combat mode is off + SSdroning.area_entered(src, living_arrived.client) + return + var/mob/living/L = arrived if(!L.ckey) return diff --git a/code/game/area/areas/station.dm b/code/game/area/areas/station.dm index 646cb65265f..f389564173a 100644 --- a/code/game/area/areas/station.dm +++ b/code/game/area/areas/station.dm @@ -5,6 +5,8 @@ icon = 'icons/area/areas_station.dmi' icon_state = "station" allow_door_remotes = TRUE + droning_sound = DRONING_NORMAL + droning_volume = 15 //Maintenance @@ -13,10 +15,12 @@ ambience_index = AMBIENCE_MAINT area_flags = BLOBS_ALLOWED | UNIQUE_AREA | CULT_PERMITTED | PERSISTENT_ENGRAVINGS airlock_wires = /datum/wires/bulkhead/maint - sound_environment = SOUND_AREA_TUNNEL_ENCLOSED + sound_environment = SOUND_AREA_LARGE_ENCLOSED forced_ambience = TRUE ambient_buzz = 'sound/ambience/source_corridor2.ogg' ambient_buzz_vol = 20 + droning_sound = DRONING_MAINTENANCE + droning_volume = 15 //Maintenance - Departmental @@ -306,6 +310,7 @@ /area/station/hallway icon_state = "hall" sound_environment = SOUND_AREA_STANDARD_STATION + droning_sound = DRONING_NORMAL /area/station/hallway/primary name = "\improper Primary Hallway" @@ -833,6 +838,8 @@ ambience_index = AMBIENCE_ENGI airlock_wires = /datum/wires/bulkhead/engineering sound_environment = SOUND_AREA_LARGE_ENCLOSED + droning_sound = DRONING_ENGINEERING + droning_volume = 15 /area/station/engineering/engine_smes name = "\improper Engineering SMES" @@ -1100,6 +1107,8 @@ sound_environment = SOUND_AREA_STANDARD_STATION min_ambience_cooldown = 90 SECONDS max_ambience_cooldown = 180 SECONDS + droning_sound = DRONING_MEDICAL + droning_volume = 15 /area/station/medical/abandoned name = "\improper Abandoned Medbay" @@ -1220,6 +1229,8 @@ ambience_index = AMBIENCE_DANGER airlock_wires = /datum/wires/bulkhead/security sound_environment = SOUND_AREA_STANDARD_STATION + droning_sound = DRONING_SECURITY + droning_volume = 15 /area/station/security/office name = "\improper Security Office" diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm index 8d3e4e6ef40..5d037b3b520 100644 --- a/code/modules/client/client_defines.dm +++ b/code/modules/client/client_defines.dm @@ -267,3 +267,8 @@ /// Holder variables for viewport scaling. var/last_view_x_dim = 7 var/last_view_y_dim = 7 + + /// Used by the area music system to avoid repeating tracks + var/last_droning_sound + /// Current ambient track + var/sound/droning_sound diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index a9b98b1ebdf..3d1f4f77e30 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -540,6 +540,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if (!stealth_admin) deadchat_broadcast(" has disconnected.", "[mob][mob.get_realname_string()]", follow_target = mob, turf_target = get_turf(mob), message_type = DEADCHAT_LOGIN_LOGOUT, admin_only=!announce_join) mob.become_uncliented() + QDEL_NULL(droning_sound) + last_droning_sound = null GLOB.clients -= src GLOB.directory -= ckey diff --git a/sound/droning/ambience1.ogg b/sound/droning/ambience1.ogg new file mode 100644 index 00000000000..f6061fa2bf5 Binary files /dev/null and b/sound/droning/ambience1.ogg differ diff --git a/sound/droning/engi_droning1.ogg b/sound/droning/engi_droning1.ogg new file mode 100644 index 00000000000..eb17efecf88 Binary files /dev/null and b/sound/droning/engi_droning1.ogg differ diff --git a/sound/droning/maint_droning1.ogg b/sound/droning/maint_droning1.ogg new file mode 100644 index 00000000000..15607477230 Binary files /dev/null and b/sound/droning/maint_droning1.ogg differ diff --git a/sound/droning/med_droning1.ogg b/sound/droning/med_droning1.ogg new file mode 100644 index 00000000000..d2e496e424a Binary files /dev/null and b/sound/droning/med_droning1.ogg differ diff --git a/sound/droning/normal_droning1.ogg b/sound/droning/normal_droning1.ogg new file mode 100644 index 00000000000..221f165cf14 Binary files /dev/null and b/sound/droning/normal_droning1.ogg differ diff --git a/sound/droning/normal_droning2.ogg b/sound/droning/normal_droning2.ogg new file mode 100644 index 00000000000..779795cabab Binary files /dev/null and b/sound/droning/normal_droning2.ogg differ diff --git a/sound/droning/sec_droning1.ogg b/sound/droning/sec_droning1.ogg new file mode 100644 index 00000000000..b81a8796e29 Binary files /dev/null and b/sound/droning/sec_droning1.ogg differ diff --git a/tgstation.dme b/tgstation.dme index 81d1f02c2fa..1c50cdc4637 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -70,6 +70,7 @@ #include "code\__DEFINES\DNA.dm" #include "code\__DEFINES\do_afters.dm" #include "code\__DEFINES\drone.dm" +#include "code\__DEFINES\droning_defines.dm" #include "code\__DEFINES\dye_keys.dm" #include "code\__DEFINES\dynamic.dm" #include "code\__DEFINES\economy.dm" @@ -533,6 +534,7 @@ #include "code\controllers\subsystem\dcs.dm" #include "code\controllers\subsystem\discord.dm" #include "code\controllers\subsystem\disease.dm" +#include "code\controllers\subsystem\droning.dm" #include "code\controllers\subsystem\early_assets.dm" #include "code\controllers\subsystem\economy.dm" #include "code\controllers\subsystem\eigenstate.dm"