[WIP] Floyd's wild sound adventure (Adds sound_loop datums to a bunch of machinery) (#32336)

* noisy

* Adds sounds to modular computers

* Adds range modifier var to sound loops

* finetunes computer sound range

* maybe fixes stuff

* changes some of the sound lengths

* borgs and some small changes

* sanity

* gravgen makes noise too
 (reverted from commit ea523084c2)
This commit is contained in:
ShizCalev
2017-11-13 14:20:34 -05:00
parent 4daec51473
commit c3981ff578
27 changed files with 4 additions and 69 deletions

View File

@@ -9,12 +9,11 @@
end_sound (soundfile) The sound played after the main loop has concluded 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 chance (num) Chance per loop to play a mid_sound
volume (num) Sound output volume volume (num) Sound output volume
muted (bool) Private. Used to stop the sound loop. muted (bool) Private. Used to stop the sound loop.
max_loops (num) The max amount of loops to run for. 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 /datum/looping_sound
var/list/atom/output_atoms var/list/atom/output_atoms
@@ -23,7 +22,6 @@
var/start_sound var/start_sound
var/start_length var/start_length
var/end_sound var/end_sound
var/range_modifier
var/chance var/chance
var/volume = 100 var/volume = 100
var/muted = TRUE var/muted = TRUE
@@ -80,7 +78,7 @@
if(direct) if(direct)
SEND_SOUND(thing, S) SEND_SOUND(thing, S)
else else
playsound(thing, S, volume, null, range_modifier) playsound(thing, S, volume)
/datum/looping_sound/proc/get_sound(looped, _mid_sounds) /datum/looping_sound/proc/get_sound(looped, _mid_sounds)
if(!_mid_sounds) if(!_mid_sounds)
@@ -99,4 +97,4 @@
/datum/looping_sound/proc/on_stop(looped) /datum/looping_sound/proc/on_stop(looped)
if(end_sound) if(end_sound)
play(end_sound) play(end_sound)

View File

@@ -23,29 +23,7 @@
end_sound = 'sound/machines/generator/generator_end.ogg' end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 40 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/deep_fryer /datum/looping_sound/deep_fryer
@@ -65,9 +43,3 @@
mid_length = 10 mid_length = 10
end_sound = 'sound/machines/microwave/microwave-end.ogg' end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 90 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

View File

@@ -15,12 +15,9 @@
var/icon_keyboard = "generic_key" var/icon_keyboard = "generic_key"
var/icon_screen = "generic" var/icon_screen = "generic"
var/clockwork = FALSE var/clockwork = FALSE
var/datum/looping_sound/computer/soundloop
/obj/machinery/computer/Initialize(mapload, obj/item/circuitboard/C) /obj/machinery/computer/Initialize(mapload, obj/item/circuitboard/C)
. = ..() . = ..()
soundloop = new(list(src))
power_change() power_change()
if(!QDELETED(C)) if(!QDELETED(C))
qdel(circuit) qdel(circuit)
@@ -29,7 +26,6 @@
/obj/machinery/computer/Destroy() /obj/machinery/computer/Destroy()
QDEL_NULL(circuit) QDEL_NULL(circuit)
QDEL_NULL(soundloop)
return ..() return ..()
/obj/machinery/computer/process() /obj/machinery/computer/process()
@@ -67,12 +63,9 @@
/obj/machinery/computer/power_change() /obj/machinery/computer/power_change()
..() ..()
if(stat & NOPOWER) if(stat & NOPOWER)
soundloop.stop()
set_light(0) set_light(0)
else else
set_light(brightness_on) set_light(brightness_on)
if(soundloop)
soundloop.start()
update_icon() update_icon()
return return

View File

@@ -32,7 +32,6 @@ 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/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/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/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) /obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20)
@@ -146,7 +145,6 @@ GLOBAL_LIST_EMPTY(telecomms_list)
/obj/machinery/telecomms/Initialize(mapload) /obj/machinery/telecomms/Initialize(mapload)
. = ..() . = ..()
soundloop = new(list(src), on)
if(mapload && autolinkers.len) if(mapload && autolinkers.len)
// Links nearby machines // Links nearby machines
if(!long_range_link) if(!long_range_link)
@@ -162,7 +160,6 @@ GLOBAL_LIST_EMPTY(telecomms_list)
for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list) for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list)
comm.links -= src comm.links -= src
links = list() links = list()
QDEL_NULL(soundloop)
return ..() return ..()
// Used in auto linking // Used in auto linking
@@ -192,13 +189,10 @@ GLOBAL_LIST_EMPTY(telecomms_list)
if(toggled) if(toggled)
if(stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off if(stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off
on = FALSE on = FALSE
soundloop.stop()
else else
on = TRUE on = TRUE
soundloop.start()
else else
on = FALSE on = FALSE
soundloop.stop()
/obj/machinery/telecomms/process() /obj/machinery/telecomms/process()
update_power() update_power()

View File

@@ -26,8 +26,6 @@
builtInCamera.toggle_cam(src,0) builtInCamera.toggle_cam(src,0)
update_headlamp(1) //So borg lights are disabled when killed. update_headlamp(1) //So borg lights are disabled when killed.
soundloop.stop()
uneq_all() // particularly to ensure sight modes are cleared uneq_all() // particularly to ensure sight modes are cleared
update_icons() update_icons()

View File

@@ -25,11 +25,8 @@
uneq_all() 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. 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 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 else
uneq_all() uneq_all()
if(soundloop)
soundloop.stop()
low_power_mode = 1 low_power_mode = 1
update_headlamp() update_headlamp()
diag_hud_set_borgcell() diag_hud_set_borgcell()

View File

@@ -79,8 +79,6 @@
var/list/upgrades = list() var/list/upgrades = list()
var/datum/looping_sound/borg/soundloop
var/obj/item/hat var/obj/item/hat
var/hat_offset = -3 var/hat_offset = -3
var/list/equippable_hats = list(/obj/item/clothing/head/caphat, var/list/equippable_hats = list(/obj/item/clothing/head/caphat,
@@ -108,7 +106,6 @@
spark_system.attach(src) spark_system.attach(src)
wires = new /datum/wires/robot(src) wires = new /datum/wires/robot(src)
soundloop = new(list(src))
robot_modules_background = new() robot_modules_background = new()
robot_modules_background.icon_state = "block" robot_modules_background.icon_state = "block"

View File

@@ -13,7 +13,6 @@
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
var/last_world_time = "00:00" var/last_world_time = "00:00"
var/list/last_header_icons 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_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) var/base_idle_power_usage = 5 // Power usage when the computer is idle and screen is off (currently only applies to laptops)
@@ -51,7 +50,6 @@
/obj/item/device/modular_computer/Initialize() /obj/item/device/modular_computer/Initialize()
. = ..() . = ..()
START_PROCESSING(SSobj, src) START_PROCESSING(SSobj, src)
soundloop = new(list(src), enabled)
if(!physical) if(!physical)
physical = src physical = src
comp_light_color = "#FFFFFF" comp_light_color = "#FFFFFF"
@@ -61,7 +59,6 @@
/obj/item/device/modular_computer/Destroy() /obj/item/device/modular_computer/Destroy()
kill_program(forced = TRUE) kill_program(forced = TRUE)
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
QDEL_NULL(soundloop)
for(var/H in all_components) for(var/H in all_components)
var/obj/item/computer_hardware/CH = all_components[H] var/obj/item/computer_hardware/CH = all_components[H]
if(CH.holder == src) if(CH.holder == src)
@@ -236,7 +233,6 @@
else else
to_chat(user, "<span class='notice'>You press the power button and start up \the [src].</span>") to_chat(user, "<span class='notice'>You press the power button and start up \the [src].</span>")
enabled = 1 enabled = 1
soundloop.start()
update_icon() update_icon()
ui_interact(user) ui_interact(user)
else // Unpowered else // Unpowered
@@ -370,7 +366,6 @@
idle_threads.Remove(P) idle_threads.Remove(P)
if(loud) if(loud)
physical.visible_message("<span class='notice'>\The [src] shuts down.</span>") physical.visible_message("<span class='notice'>\The [src] shuts down.</span>")
soundloop.stop()
enabled = 0 enabled = 0
update_icon() update_icon()

View File

@@ -125,16 +125,9 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
var/charge_count = 100 var/charge_count = 100
var/current_overlay = null var/current_overlay = null
var/broken_state = 0 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. /obj/machinery/gravity_generator/main/Destroy() // If we somehow get deleted, remove all of our other parts.
investigate_log("was destroyed!", INVESTIGATE_GRAVITY) investigate_log("was destroyed!", INVESTIGATE_GRAVITY)
QDEL_NULL(soundloop)
on = FALSE on = FALSE
update_list() update_list()
for(var/obj/machinery/gravity_generator/part/O in parts) for(var/obj/machinery/gravity_generator/part/O in parts)
@@ -311,13 +304,11 @@ 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(on) // If we turned on and the game is live.
if(gravity_in_level() == 0) if(gravity_in_level() == 0)
alert = 1 alert = 1
soundloop.start()
investigate_log("was brought online and is now producing gravity for this level.", INVESTIGATE_GRAVITY) 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)]") message_admins("The gravity generator was brought online [A][ADMIN_COORDJMP(src)]")
else else
if(gravity_in_level() == 1) if(gravity_in_level() == 1)
alert = 1 alert = 1
soundloop.stop()
investigate_log("was brought offline and there is now no gravity for this level.", INVESTIGATE_GRAVITY) 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)]") message_admins("The gravity generator was brought offline with no backup generator. [A][ADMIN_COORDJMP(src)]")

Binary file not shown.

Binary file not shown.

Binary file not shown.