diff --git a/code/datums/looping_sounds/looping_sound.dm b/code/datums/looping_sounds/looping_sound.dm
index aed7c3ace89..3076cc83237 100644
--- a/code/datums/looping_sounds/looping_sound.dm
+++ b/code/datums/looping_sounds/looping_sound.dm
@@ -9,11 +9,12 @@
end_sound (soundfile) The sound played after the main loop has concluded
+ range_modifier (num) Modifier in max range of sounds played by the sound loop.
chance (num) Chance per loop to play a mid_sound
volume (num) Sound output volume
muted (bool) Private. Used to stop the sound loop.
max_loops (num) The max amount of loops to run for.
- direct (bool) If true plays directly to provided atoms instead of from them
+ direct (bool) If true plays directly to provided atoms instead of from them
*/
/datum/looping_sound
var/list/atom/output_atoms
@@ -22,6 +23,7 @@
var/start_sound
var/start_length
var/end_sound
+ var/range_modifier
var/chance
var/volume = 100
var/muted = TRUE
@@ -78,7 +80,7 @@
if(direct)
SEND_SOUND(thing, S)
else
- playsound(thing, S, volume)
+ playsound(thing, S, volume, null, range_modifier)
/datum/looping_sound/proc/get_sound(looped, _mid_sounds)
if(!_mid_sounds)
@@ -97,4 +99,4 @@
/datum/looping_sound/proc/on_stop(looped)
if(end_sound)
- play(end_sound)
\ No newline at end of file
+ play(end_sound)
diff --git a/code/datums/looping_sounds/machinery_sounds.dm b/code/datums/looping_sounds/machinery_sounds.dm
index fb5710debdc..c516b1cbcd1 100644
--- a/code/datums/looping_sounds/machinery_sounds.dm
+++ b/code/datums/looping_sounds/machinery_sounds.dm
@@ -23,7 +23,29 @@
end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 40
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/datum/looping_sound/server
+ mid_sounds = list('sound/machines/tcomms/tcomms_mid1.ogg'=1,'sound/machines/tcomms/tcomms_mid2.ogg'=1,'sound/machines/tcomms/tcomms_mid3.ogg'=1,'sound/machines/tcomms/tcomms_mid4.ogg'=1,\
+ 'sound/machines/tcomms/tcomms_mid5.ogg'=1,'sound/machines/tcomms/tcomms_mid6.ogg'=1,'sound/machines/tcomms/tcomms_mid7.ogg'=1)
+ mid_length = 17
+ range_modifier = -4.5
+ volume = 50
+
+/datum/looping_sound/computer
+ start_sound = 'sound/machines/computer/computer_start.ogg'
+ start_length = 72
+ mid_sounds = list('sound/machines/computer/computer_mid1.ogg'=1, 'sound/machines/computer/computer_mid2.ogg'=1)
+ mid_length = 6.1
+ end_sound = 'sound/machines/computer/computer_end.ogg'
+ volume = 10
+ range_modifier = -5.5
+
+/datum/looping_sound/borg
+ mid_sounds = list('sound/machines/borg/borg_mid1.ogg'=1, 'sound/machines/borg/borg_mid2.ogg'=1, 'sound/machines/borg/borg_mid3.ogg'=1)
+ mid_length = 19.5
+ end_sound = 'sound/machines/computer/computer_end.ogg'
+ volume = 80
+ range_modifier = -5.5
/datum/looping_sound/microwave
start_sound = 'sound/machines/microwave/microwave-start.ogg'
@@ -32,3 +54,9 @@
mid_length = 10
end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 90
+
+/datum/looping_sound/gravgen
+ mid_sounds = list('sound/machines/gravgen/gravgen_mid1.ogg'=1,'sound/machines/gravgen/gravgen_mid2.ogg'=1,'sound/machines/gravgen/gravgen_mid3.ogg'=1,'sound/machines/gravgen/gravgen_mid4.ogg'=1,)
+ mid_length = 17
+ range_modifier = -4.5
+ volume = 70
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 77bb50e8c4a..926c4ff2a57 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -15,9 +15,12 @@
var/icon_keyboard = "generic_key"
var/icon_screen = "generic"
var/clockwork = FALSE
+ var/datum/looping_sound/computer/soundloop
/obj/machinery/computer/Initialize(mapload, obj/item/circuitboard/C)
. = ..()
+
+ soundloop = new(list(src))
power_change()
if(!QDELETED(C))
qdel(circuit)
@@ -26,6 +29,7 @@
/obj/machinery/computer/Destroy()
QDEL_NULL(circuit)
+ QDEL_NULL(soundloop)
return ..()
/obj/machinery/computer/process()
@@ -63,9 +67,12 @@
/obj/machinery/computer/power_change()
..()
if(stat & NOPOWER)
+ soundloop.stop()
set_light(0)
else
set_light(brightness_on)
+ if(soundloop)
+ soundloop.start()
update_icon()
return
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index 62f53f73ad2..8fdee35555c 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -32,6 +32,7 @@ GLOBAL_LIST_EMPTY(telecomms_list)
var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub)
var/hide = 0 // Is it a hidden machine?
var/listening_level = 0 // 0 = auto set in New() - this is the z level that the machine is listening to.
+ var/datum/looping_sound/server/soundloop
/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20)
@@ -145,6 +146,7 @@ GLOBAL_LIST_EMPTY(telecomms_list)
/obj/machinery/telecomms/Initialize(mapload)
. = ..()
+ soundloop = new(list(src), on)
if(mapload && autolinkers.len)
// Links nearby machines
if(!long_range_link)
@@ -160,6 +162,7 @@ GLOBAL_LIST_EMPTY(telecomms_list)
for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list)
comm.links -= src
links = list()
+ QDEL_NULL(soundloop)
return ..()
// Used in auto linking
@@ -189,10 +192,13 @@ GLOBAL_LIST_EMPTY(telecomms_list)
if(toggled)
if(stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off
on = FALSE
+ soundloop.stop()
else
on = TRUE
+ soundloop.start()
else
on = FALSE
+ soundloop.stop()
/obj/machinery/telecomms/process()
update_power()
diff --git a/code/modules/mob/living/silicon/robot/death.dm b/code/modules/mob/living/silicon/robot/death.dm
index 7eb241e01fe..d7fed1b3678 100644
--- a/code/modules/mob/living/silicon/robot/death.dm
+++ b/code/modules/mob/living/silicon/robot/death.dm
@@ -26,6 +26,8 @@
builtInCamera.toggle_cam(src,0)
update_headlamp(1) //So borg lights are disabled when killed.
+ soundloop.stop()
+
uneq_all() // particularly to ensure sight modes are cleared
update_icons()
diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm
index aab1f204f68..b89f9d6c2b6 100644
--- a/code/modules/mob/living/silicon/robot/life.dm
+++ b/code/modules/mob/living/silicon/robot/life.dm
@@ -25,8 +25,11 @@
uneq_all()
var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
+ soundloop.start()
else
uneq_all()
+ if(soundloop)
+ soundloop.stop()
low_power_mode = 1
update_headlamp()
diag_hud_set_borgcell()
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index df872e25e7a..06317fa95a6 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -79,6 +79,8 @@
var/list/upgrades = list()
+ var/datum/looping_sound/borg/soundloop
+
var/obj/item/hat
var/hat_offset = -3
var/list/equippable_hats = list(/obj/item/clothing/head/caphat,
@@ -106,6 +108,7 @@
spark_system.attach(src)
wires = new /datum/wires/robot(src)
+ soundloop = new(list(src))
robot_modules_background = new()
robot_modules_background.icon_state = "block"
diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm
index 95e78391bbe..6789357e6d5 100644
--- a/code/modules/modular_computers/computers/item/computer.dm
+++ b/code/modules/modular_computers/computers/item/computer.dm
@@ -13,6 +13,7 @@
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
var/last_world_time = "00:00"
var/list/last_header_icons
+ var/datum/looping_sound/computer/soundloop
var/base_active_power_usage = 50 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
var/base_idle_power_usage = 5 // Power usage when the computer is idle and screen is off (currently only applies to laptops)
@@ -50,6 +51,7 @@
/obj/item/device/modular_computer/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
+ soundloop = new(list(src), enabled)
if(!physical)
physical = src
comp_light_color = "#FFFFFF"
@@ -59,6 +61,7 @@
/obj/item/device/modular_computer/Destroy()
kill_program(forced = TRUE)
STOP_PROCESSING(SSobj, src)
+ QDEL_NULL(soundloop)
for(var/H in all_components)
var/obj/item/computer_hardware/CH = all_components[H]
if(CH.holder == src)
@@ -233,6 +236,7 @@
else
to_chat(user, "You press the power button and start up \the [src].")
enabled = 1
+ soundloop.start()
update_icon()
ui_interact(user)
else // Unpowered
@@ -366,6 +370,7 @@
idle_threads.Remove(P)
if(loud)
physical.visible_message("\The [src] shuts down.")
+ soundloop.stop()
enabled = 0
update_icon()
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index e19f152a75c..2b9d1db9cfa 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -125,9 +125,16 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
var/charge_count = 100
var/current_overlay = null
var/broken_state = 0
+ var/datum/looping_sound/gravgen/soundloop
+
+/obj/machinery/gravity_generator/main/Initialize()
+ . = ..()
+ soundloop = new(list(src))
+ soundloop.start()
/obj/machinery/gravity_generator/main/Destroy() // If we somehow get deleted, remove all of our other parts.
investigate_log("was destroyed!", INVESTIGATE_GRAVITY)
+ QDEL_NULL(soundloop)
on = FALSE
update_list()
for(var/obj/machinery/gravity_generator/part/O in parts)
@@ -304,11 +311,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
if(on) // If we turned on and the game is live.
if(gravity_in_level() == 0)
alert = 1
+ soundloop.start()
investigate_log("was brought online and is now producing gravity for this level.", INVESTIGATE_GRAVITY)
message_admins("The gravity generator was brought online [A][ADMIN_COORDJMP(src)]")
else
if(gravity_in_level() == 1)
alert = 1
+ soundloop.stop()
investigate_log("was brought offline and there is now no gravity for this level.", INVESTIGATE_GRAVITY)
message_admins("The gravity generator was brought offline with no backup generator. [A][ADMIN_COORDJMP(src)]")
diff --git a/sound/machines/borg/borg_mid1.ogg b/sound/machines/borg/borg_mid1.ogg
new file mode 100644
index 00000000000..e0683a87e55
Binary files /dev/null and b/sound/machines/borg/borg_mid1.ogg differ
diff --git a/sound/machines/borg/borg_mid2.ogg b/sound/machines/borg/borg_mid2.ogg
new file mode 100644
index 00000000000..3ed2118927b
Binary files /dev/null and b/sound/machines/borg/borg_mid2.ogg differ
diff --git a/sound/machines/borg/borg_mid3.ogg b/sound/machines/borg/borg_mid3.ogg
new file mode 100644
index 00000000000..155c01c088e
Binary files /dev/null and b/sound/machines/borg/borg_mid3.ogg differ
diff --git a/sound/machines/computer/computer_end.ogg b/sound/machines/computer/computer_end.ogg
new file mode 100644
index 00000000000..cd3f770e0bd
Binary files /dev/null and b/sound/machines/computer/computer_end.ogg differ
diff --git a/sound/machines/computer/computer_mid1.ogg b/sound/machines/computer/computer_mid1.ogg
new file mode 100644
index 00000000000..d183bf5b7af
Binary files /dev/null and b/sound/machines/computer/computer_mid1.ogg differ
diff --git a/sound/machines/computer/computer_mid2.ogg b/sound/machines/computer/computer_mid2.ogg
new file mode 100644
index 00000000000..15e53ded809
Binary files /dev/null and b/sound/machines/computer/computer_mid2.ogg differ
diff --git a/sound/machines/computer/computer_start.ogg b/sound/machines/computer/computer_start.ogg
new file mode 100644
index 00000000000..80fa526bbb8
Binary files /dev/null and b/sound/machines/computer/computer_start.ogg differ
diff --git a/sound/machines/gravgen/gravgen_mid1.ogg b/sound/machines/gravgen/gravgen_mid1.ogg
new file mode 100644
index 00000000000..de2744194bd
Binary files /dev/null and b/sound/machines/gravgen/gravgen_mid1.ogg differ
diff --git a/sound/machines/gravgen/gravgen_mid2.ogg b/sound/machines/gravgen/gravgen_mid2.ogg
new file mode 100644
index 00000000000..7b09d566e91
Binary files /dev/null and b/sound/machines/gravgen/gravgen_mid2.ogg differ
diff --git a/sound/machines/gravgen/gravgen_mid3.ogg b/sound/machines/gravgen/gravgen_mid3.ogg
new file mode 100644
index 00000000000..6e133b5fcfe
Binary files /dev/null and b/sound/machines/gravgen/gravgen_mid3.ogg differ
diff --git a/sound/machines/gravgen/gravgen_mid4.ogg b/sound/machines/gravgen/gravgen_mid4.ogg
new file mode 100644
index 00000000000..4f08f5e6d22
Binary files /dev/null and b/sound/machines/gravgen/gravgen_mid4.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid1.ogg b/sound/machines/tcomms/tcomms_mid1.ogg
new file mode 100644
index 00000000000..a954227cbcb
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid1.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid2.ogg b/sound/machines/tcomms/tcomms_mid2.ogg
new file mode 100644
index 00000000000..c5b4514c9b3
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid2.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid3.ogg b/sound/machines/tcomms/tcomms_mid3.ogg
new file mode 100644
index 00000000000..f14cd0764b9
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid3.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid4.ogg b/sound/machines/tcomms/tcomms_mid4.ogg
new file mode 100644
index 00000000000..65abda08fea
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid4.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid5.ogg b/sound/machines/tcomms/tcomms_mid5.ogg
new file mode 100644
index 00000000000..2f8c9347870
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid5.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid6.ogg b/sound/machines/tcomms/tcomms_mid6.ogg
new file mode 100644
index 00000000000..18459acb270
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid6.ogg differ
diff --git a/sound/machines/tcomms/tcomms_mid7.ogg b/sound/machines/tcomms/tcomms_mid7.ogg
new file mode 100644
index 00000000000..3917a28fba0
Binary files /dev/null and b/sound/machines/tcomms/tcomms_mid7.ogg differ