Vent sound update

Vents now only make noise when they start or stop working, rather than constantly running playsound and stacking sounds for potentially hundreds of vents all over the station.

Still uses the same pref

Further attempts to reduce sound based lag.
This commit is contained in:
VerySoft
2022-02-22 21:36:43 -05:00
parent df80c84645
commit f5a00bbce6
@@ -48,7 +48,10 @@
var/radio_filter_out
var/radio_filter_in
var/datum/looping_sound/air_pump/soundloop
//var/datum/looping_sound/air_pump/soundloop
var/static/start_sound = 'sound/machines/air_pump/airpumpstart.ogg'
var/static/stop_sound = 'sound/machines/air_pump/airpumpshutdown.ogg'
/obj/machinery/atmospherics/unary/vent_pump/on
use_power = USE_POWER_IDLE
@@ -78,7 +81,7 @@
/obj/machinery/atmospherics/unary/vent_pump/Initialize()
. = ..()
soundloop = new(list(src), FALSE)
//soundloop = new(list(src), FALSE)
/obj/machinery/atmospherics/unary/vent_pump/New()
..()
@@ -96,7 +99,7 @@
if(initial_loc)
initial_loc.air_vent_info -= id_tag
initial_loc.air_vent_names -= id_tag
QDEL_NULL(soundloop)
//QDEL_NULL(soundloop)
return ..()
/obj/machinery/atmospherics/unary/vent_pump/high_volume
@@ -155,10 +158,15 @@
if(welded)
vent_icon += "weld"
playsound(src, stop_sound, 25, ignore_walls = FALSE, preference = /datum/client_preference/air_pump_noise)
else if(!use_power || !node || (stat & (NOPOWER|BROKEN)))
vent_icon += "off"
playsound(src, stop_sound, 25, ignore_walls = FALSE, preference = /datum/client_preference/air_pump_noise)
else
vent_icon += "[pump_direction ? "out" : "in"]"
playsound(src, start_sound, 25, ignore_walls = FALSE, preference = /datum/client_preference/air_pump_noise)
add_overlay(icon_manager.get_atmos_icon("device", , , vent_icon))
@@ -182,15 +190,11 @@
/obj/machinery/atmospherics/unary/vent_pump/proc/can_pump()
if(stat & (NOPOWER|BROKEN))
soundloop.stop()
return 0
if(!use_power)
soundloop.stop()
return 0
if(welded)
soundloop.stop()
return 0
soundloop.start()
return 1
/obj/machinery/atmospherics/unary/vent_pump/process()