[MIRROR] Upports fridge, tcomm, and shield_gen soundloops (#12710)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2026-04-24 13:31:12 -04:00
committed by GitHub
co-authored by Cameron Lennox
parent 30edee13f5
commit e17e7d9fd7
13 changed files with 84 additions and 115 deletions
+7 -7
View File
@@ -16,7 +16,7 @@
direct (bool) If true plays directly to provided atoms instead of from them
opacity_check (bool) If true, things behind walls/opaque things won't hear the sounds.
pref_check (type) If set to a /datum/client_preference type, will check if the hearer has that preference active before playing it to them.
volume_chan (type) If set to a specific volume channel via the incoming argument, we tell the playsound proc to modulate volume based on that channel //CHOMPedit
volume_chan (type) If set to a specific volume channel via the incoming argument, we tell the playsound proc to modulate volume based on that channel
exclusive (bool) If true, only one of this sound is allowed to play. Relies on if started is true or not. If true, it will not start another loop until it is false.
*/
/datum/looping_sound
@@ -35,7 +35,7 @@
var/opacity_check
var/pref_check
var/exclusive
var/falloff // CHOMPEdit: Add Falloff
var/falloff
var/volume_chan
var/timerid
@@ -59,8 +59,8 @@
return ..()
/datum/looping_sound/proc/start(atom/add_thing, skip_start_sound = FALSE)
if(QDELETED(src)) //Chomp runtime
return //Chomp runtime
if(QDELETED(src))
return
if(add_thing)
output_atoms |= add_thing
if(timerid)
@@ -86,7 +86,7 @@
started = FALSE
/datum/looping_sound/proc/sound_loop(starttime)
if(QDELETED(src) || (max_loops && world.time >= starttime + mid_length * max_loops)) //ChompEDIT - runtime
if(QDELETED(src) || (max_loops && world.time >= starttime + mid_length * max_loops))
stop()
return
if(!chance || prob(chance))
@@ -102,7 +102,7 @@
if(direct)
S.channel = SSsounds.random_available_channel()
S.volume = volume
for(var/i in 1 to atoms_cache?.len) //Chomp - runtime
for(var/i in 1 to atoms_cache?.len)
var/atom/thing = atoms_cache[i]
if(direct)
if(ismob(thing))
@@ -111,7 +111,7 @@
continue
SEND_SOUND(thing, S)
else
playsound(thing, S, volume, vary, extra_range, falloff = falloff, ignore_walls = !opacity_check, preference = pref_check, volume_channel = volume_chan) // CHOMPEdit - Weather volume channel CHOMPEdit again: falloff
playsound(thing, S, volume, vary, extra_range, falloff = falloff, ignore_walls = !opacity_check, preference = pref_check, volume_channel = volume_chan)
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
if(!_mid_sounds)
@@ -116,7 +116,6 @@
end_sound = 'sound/machines/vehicle/engine_end.ogg'
volume = 20
// CHOMPAdd: Fridges!
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/fridge
+13 -14
View File
@@ -18,13 +18,13 @@
circuit = /obj/item/circuitboard/telecomms/exonet_node
var/datum/looping_sound/tcomms/soundloop // CHOMPStation Add: Hummy noises
var/noisy = TRUE // CHOMPStation Add: Hummy noises, this starts on
var/datum/looping_sound/tcomms/soundloop
var/noisy = TRUE
// Proc: New()
// Parameters: None
// Description: Adds components to the machine for deconstruction.
/obj/machinery/exonet_node/Initialize(mapload)
// CHOMPAdd: Exonet Machinery humming
soundloop = new(list(src), FALSE)
if(prob(60)) // 60% chance to change the midloop
if(prob(40))
@@ -36,16 +36,15 @@
else
soundloop.mid_sounds = list('sound/machines/tcomms/tcomms_04.ogg' = 1)
soundloop.mid_length = 30
soundloop.start() // CHOMPStation Edit: This starts on
// CHOMPAdd End
soundloop.start()
. = ..()
default_apply_parts()
if(mapload)
desc = "This machine is one of many, many nodes inside [using_map.starsys_name]'s section of the Exonet, connecting the [using_map.station_short] to the rest of the system, at least \
electronically."
/obj/machinery/exonet_node/Destroy() // CHOMPAdd: Just in case.
QDEL_NULL(soundloop) // CHOMPAdd: Exonet noises
/obj/machinery/exonet_node/Destroy()
QDEL_NULL(soundloop)
return ..()
// Proc: update_icon()
@@ -70,19 +69,19 @@
if(stat & (BROKEN|NOPOWER|EMPED))
on = 0
update_idle_power_usage(0)
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
else
on = 1
update_idle_power_usage(2500)
else
on = 0
update_idle_power_usage(0)
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
if(!noisy && on) // CHOMPStation Add: Hummy noises, safety in case it was already on
soundloop.start() // CHOMPStation Add: Hummy noises
noisy = TRUE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
if(!noisy && on)
soundloop.start()
noisy = TRUE
update_icon()
// Proc: emp_act(severity, recursive)
+9 -11
View File
@@ -12,8 +12,8 @@
var/toggle = 1 // If we /should/ be active or not,
var/list/internal_PDAs = list() // Assoc list of PDAs inside of this, with the department name being the index,
var/datum/looping_sound/tcomms/soundloop // CHOMPStation Add: Hummy noises
var/noisy = TRUE // CHOMPStation Add: Hummy noises
var/datum/looping_sound/tcomms/soundloop
var/noisy = TRUE
/obj/machinery/pda_multicaster/Initialize(mapload)
. = ..()
@@ -22,11 +22,10 @@
"engineering" = new /obj/item/pda/multicaster/engineering(src),
"medical" = new /obj/item/pda/multicaster/medical(src),
"research" = new /obj/item/pda/multicaster/research(src),
"exploration" = new /obj/item/pda/multicaster/exploration(src), //VOREStation Add,
"exploration" = new /obj/item/pda/multicaster/exploration(src),
"cargo" = new /obj/item/pda/multicaster/cargo(src),
"civilian" = new /obj/item/pda/multicaster/civilian(src))
// CHOMPAdd: PDA Multicaster Server humming
soundloop = new(list(src), FALSE)
if(prob(60)) // 60% chance to change the midloop
if(prob(40))
@@ -39,7 +38,6 @@
soundloop.mid_sounds = list('sound/machines/tcomms/tcomms_04.ogg' = 1)
soundloop.mid_length = 30
soundloop.start() // Have to do this here bc it starts on
// CHOMPAdd End
/obj/machinery/pda_multicaster/prebuilt/Initialize(mapload)
. = ..()
@@ -92,20 +90,20 @@
on = 0
update_PDAs(1) // 1 being to turn off.
update_idle_power_usage(0)
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
else
on = 1
update_PDAs(0)
update_idle_power_usage(750)
soundloop.start() // CHOMPStation Add: Hummy noises
noisy = TRUE // CHOMPStation Add: Hummy noises
soundloop.start()
noisy = TRUE
else
on = 0
update_PDAs(1)
update_idle_power_usage(0)
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
update_icon()
/obj/machinery/pda_multicaster/process()
@@ -36,8 +36,8 @@
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/tcomms/soundloop // CHOMPStation Add: Hummy noises
var/noisy = TRUE // CHOMPStation Add: Hummy noises, this starts on
var/datum/looping_sound/tcomms/soundloop
var/noisy = TRUE
/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20)
// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
@@ -141,7 +141,6 @@
else
for(var/obj/machinery/telecomms/T in GLOB.telecomms_list)
add_link(T)
// CHOMPAdd: TComms humming
soundloop = new(list(src), FALSE)
if(prob(60)) // 60% chance to change the midloop
if(prob(40))
@@ -154,14 +153,13 @@
soundloop.mid_sounds = list('sound/machines/tcomms/tcomms_04.ogg' = 1)
soundloop.mid_length = 30
soundloop.start()
// CHOMPAdd End
/obj/machinery/telecomms/Destroy()
GLOB.telecomms_list -= src
for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list)
comm.links -= src
links = list()
QDEL_NULL(soundloop) // CHOMPAdd: Tcomms noises
QDEL_NULL(soundloop)
. = ..()
// Used in auto linking
@@ -184,17 +182,17 @@
if(toggled)
if(stat & (BROKEN|NOPOWER|EMPED) || integrity <= 0) // if powered, on. if not powered, off. if too damaged, off
on = 0
soundloop.stop() // CHOMPAdd: Tcomms noises
on = FALSE
soundloop.stop()
noisy = FALSE
else
on = 1
on = TRUE
else
on = 0
soundloop.stop() // CHOMPAdd: Tcomms noises
on = FALSE
soundloop.stop()
noisy = FALSE
if(!noisy) // CHOMPAdd: Tcomms noises
soundloop.start() // CHOMPAdd: Tcomms noises
if(!noisy)
soundloop.start()
noisy = TRUE
/obj/machinery/telecomms/process()
@@ -216,7 +214,7 @@
if(prob(100/severity))
if(!(stat & EMPED))
stat |= EMPED
playsound(src, 'sound/machines/tcomms/tcomms_pulse.ogg', 70, 1, 30) // CHOMPAdd: Tcomms noises
playsound(src, 'sound/machines/tcomms/tcomms_pulse.ogg', 70, 1, 30)
var/duration = (300 * 10)/severity
spawn(rand(duration - 20, duration + 20)) // Takes a long time for the machines to reboot.
stat &= ~EMPED
@@ -269,3 +269,8 @@
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "sound_instruments"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/toggle/fridge_hum
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "SOUND_FRIDGEHUM"
savefile_identifier = PREFERENCE_PLAYER
+1 -14
View File
@@ -22,32 +22,19 @@ GLOBAL_LIST_EMPTY(event_viruses) // so that event viruses are kept around for ad
viruses += D
/datum/event/viral_infection/announce()
<<<<<<< HEAD
/*var/level
=======
var/level
var/virus_msg
>>>>>>> 60202429a7 (Customizable Announcer (#19387))
if (severity == EVENT_LEVEL_MUNDANE)
return
else if (severity == EVENT_LEVEL_MODERATE)
level = pick("one", "two", "three", "four")
virus_msg = ANNOUNCER_MSG_BIOHAZARD_LOW
else
<<<<<<< HEAD
level = "five"*/
// Chomp removal
if (severity == EVENT_LEVEL_MAJOR || prob(60))
command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Viral Outbreak", new_sound = 'sound/AI/outbreak7.ogg')
// Chomp edit: Changed "Biohazard Alert" to "Viral Outbreak" and also changed level level 5 to level 7. Lower = More urgent.
=======
level = "five"
virus_msg = ANNOUNCER_MSG_BIOHAZARD_FIVE
if (severity == EVENT_LEVEL_MAJOR || prob(60))
command_announcement.Announce("Confirmed outbreak of level [level] biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = virus_msg)
>>>>>>> 60202429a7 (Customizable Announcer (#19387))
command_announcement.Announce("Confirmed outbreak of level [level] biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Viral Outbreak", new_sound = virus_msg) // Chomp edit: Changed "Biohazard Alert" to "Viral Outbreak" and also changed level level 5 to level 7. Lower = More urgent.
/datum/event/viral_infection/start()
if(!viruses.len) return
+2 -7
View File
@@ -8,14 +8,9 @@
severity = rand(2, 4)
/datum/event/viral_outbreak/announce()
<<<<<<< HEAD
command_alert("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Viral Outbreak")
world << sound('sound/AI/outbreak7.ogg')
// Chomp edit: Changed "Biohazard Alert" to "Viral Outbreak" and yes I know this file isn't used anymore but I'm going to be consistent in case it does get used.
=======
command_alert("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert")
command_alert("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Viral Outbreak") // Chomp edit: Changed "Biohazard Alert" to "Viral Outbreak" and yes I know this file isn't used anymore but I'm going to be consistent in case it does get used.
play_simple_announcement(world, ANNOUNCER_MSG_BIOHAZARD_SEVEN)
>>>>>>> 60202429a7 (Customizable Announcer (#19387))
/datum/event/viral_outbreak/start()
var/list/candidates = list() //list of candidate keys
@@ -24,8 +24,8 @@
var/persistent = null // Path of persistence datum used to track contents
circuit = /obj/item/circuitboard/smartfridge //This one is meant to be uncraftable, however.
var/datum/looping_sound/fridge/soundloop // CHOMPEdit: Fridges hum!
var/playing_sound = FALSE // CHOMPEdit: Fridges hum!
var/datum/looping_sound/fridge/soundloop
var/playing_sound = FALSE
/obj/machinery/smartfridge/secure
is_secure = 1
@@ -39,7 +39,7 @@
else
set_wires(new /datum/wires/smartfridge(src))
soundloop = new(list(src), FALSE) // CHOMPEdit: Fridge hum!
soundloop = new(list(src), FALSE)
update_icon()
default_apply_parts()
@@ -50,7 +50,7 @@
wires = null
if(persistent)
SSpersistence.forget_value(src, persistent)
QDEL_NULL(soundloop) // CHOMPEdit: Fridge hum!
QDEL_NULL(soundloop)
return ..()
/obj/machinery/smartfridge/proc/accept_check(obj/item/O)
@@ -58,10 +58,10 @@
/obj/machinery/smartfridge/process()
if(stat & (BROKEN|NOPOWER))
soundloop.stop() // CHOMPEdit: Fridges don't hum while they lack power.
playing_sound = FALSE // CHOMPEdit: Fridges don't hum while they lack power.
soundloop.stop()
playing_sound = FALSE
return
if(!playing_sound && !stat) // CHOMPEdit: Fridges hum while they have power.
if(!playing_sound && !stat)
soundloop.start()
playing_sound = TRUE
if(src.seconds_electrified > 0)
@@ -74,18 +74,12 @@
..()
if(old_stat != stat)
update_icon()
// CHOMPEdit Start: Fridge hum
if(stat & (NOPOWER | BROKEN))
soundloop.stop()
playing_sound = FALSE
else
soundloop.start()
playing_sound = TRUE
// CHOMPEdit End
/obj/machinery/smartfridge/update_icon()
cut_overlays()
if(panel_open)
add_overlay("[icon_base]-panel")
if(stat & (BROKEN))
@@ -263,9 +263,9 @@
/obj/item/tool/crowbar,
/obj/item/tool/screwdriver,
/obj/item/multitool,
/obj/item/integrated_electronics/wirer, //CHOMP Edit,
/obj/item/integrated_electronics/debugger, //CHOMP Edit,
/obj/item/integrated_electronics/detailer, //CHOMP Edit,
/obj/item/integrated_electronics/wirer,
/obj/item/integrated_electronics/debugger,
/obj/item/integrated_electronics/detailer,
)
//Emp'ing this one bag causes a recursion loop of over 700 emp_act's,
@@ -292,9 +292,9 @@
new /obj/item/multitool(src)
new /obj/item/tool/screwdriver(src)
new /obj/item/tool/crowbar(src)
new /obj/item/integrated_electronics/wirer(src) //CHOMPEdit
new /obj/item/integrated_electronics/debugger(src) //CHOMPEdit
new /obj/item/integrated_electronics/detailer(src) //CHOMPEdit
new /obj/item/integrated_electronics/wirer(src)
new /obj/item/integrated_electronics/debugger(src)
new /obj/item/integrated_electronics/detailer(src)
make_exact_fit()
. = ..()
@@ -319,7 +319,7 @@
new /obj/item/electronic_assembly/drone(src)
new /obj/item/integrated_electronics/wirer(src)
new /obj/item/integrated_electronics/debugger(src)
new /obj/item/integrated_electronics/detailer(src) //CHOMPEdit
new /obj/item/integrated_electronics/detailer(src)
new /obj/item/tool/crowbar(src)
make_exact_fit()
. = ..()
@@ -19,8 +19,8 @@
var/dos_capacity = 500 // Amount of DoS "packets" in buffer required to crash the relay
var/dos_dissipate = 1 // Amount of DoS "packets" dissipated over time.
var/datum/looping_sound/tcomms/soundloop // CHOMPStation Add: Hummy noises
var/noisy = TRUE // CHOMPStation Add: Hummy noises
var/datum/looping_sound/tcomms/soundloop
var/noisy = TRUE
// TODO: Implement more logic here. For now it's only a placeholder.
@@ -37,12 +37,12 @@
if(operable())
icon_state = initial(icon_state)
if(!noisy)
soundloop.start() // CHOMPStation Add: Hummy noises
noisy = TRUE // CHOMPStation Add: Hummy noises
soundloop.start()
noisy = TRUE
else
icon_state = "[initial(icon_state)]_off"
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
/obj/machinery/ntnet_relay/process()
if(operable())
@@ -114,7 +114,6 @@
GLOB.ntnet_global.relays.Add(src)
NTNet = GLOB.ntnet_global
GLOB.ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
// CHOMPAdd: PDA Multicaster Server humming
soundloop = new(list(src), FALSE)
if(prob(60)) // 60% chance to change the midloop
if(prob(40))
@@ -127,7 +126,6 @@
soundloop.mid_sounds = list('sound/machines/tcomms/tcomms_04.ogg' = 1)
soundloop.mid_length = 30
soundloop.start() // Have to do this here bc it starts on
// CHOMPAdd End
/obj/machinery/ntnet_relay/Destroy()
if(GLOB.ntnet_global)
+9 -11
View File
@@ -69,11 +69,10 @@
//Messages having theese tokens will be rejected by server. Case sensitive
var/spamfilter_limit = MESSAGE_SERVER_DEFAULT_SPAM_LIMIT //Maximal amount of tokens
var/datum/looping_sound/tcomms/soundloop // CHOMPStation Add: Hummy noises
var/noisy = FALSE // CHOMPStation Add: Hummy noises
var/datum/looping_sound/tcomms/soundloop
var/noisy = FALSE
/obj/machinery/message_server/Initialize(mapload)
// CHOMPAdd: PDA Messaging Server humming
soundloop = new(list(src), FALSE)
if(prob(60)) // 60% chance to change the midloop
if(prob(40))
@@ -85,7 +84,6 @@
else
soundloop.mid_sounds = list('sound/machines/tcomms/tcomms_04.ogg' = 1)
soundloop.mid_length = 30
// CHOMPAdd End
. = ..()
GLOB.message_servers += src
decryptkey = GenerateKey()
@@ -93,7 +91,7 @@
/obj/machinery/message_server/Destroy()
GLOB.message_servers -= src
QDEL_NULL(soundloop) // CHOMPStation Add: Hummy noises
QDEL_NULL(soundloop)
return ..()
/obj/machinery/message_server/examine(mob/user, distance, infix, suffix)
@@ -113,12 +111,12 @@
// decryptkey = generateKey()
if(active && (stat & (BROKEN|NOPOWER)))
active = 0
soundloop.stop() // CHOMPStation Add: Hummy noises
noisy = FALSE // CHOMPStation Add: Hummy noises
soundloop.stop()
noisy = FALSE
return
if(!noisy && active) // CHOMPStation Add: Hummy noises
soundloop.start() // CHOMPStation Add: Hummy noises
noisy = TRUE // CHOMPStation Add: Hummy noises
if(!noisy && active)
soundloop.start()
noisy = TRUE
update_icon()
return
@@ -388,7 +386,7 @@ GLOBAL_DATUM(blackbox, /obj/machinery/blackbox_recorder)
query_insert.Execute()
qdel(query_insert)
// Sanitize inputs to avoid SQL injection attacks //CHOMPEdit NOTE: This is not secure. Basic filters like this are pretty easy to bypass. Use the format for arguments used in the above.
// Sanitize inputs to avoid SQL injection attacks. This is not secure. Basic filters like this are pretty easy to bypass. Use the format for arguments used in the above.
/proc/sql_sanitize_text(var/text)
text = replacetext(text, "'", "''")
text = replacetext(text, ";", "")
+7 -9
View File
@@ -25,7 +25,7 @@
use_power = USE_POWER_OFF //doesn't use APC power
interact_offline = TRUE // don't check stat & NOPOWER|BROKEN for our UI. We check BROKEN ourselves.
var/id //for button usage
var/datum/looping_sound/shield_generator/shield_hum // CHOMPAdd
var/datum/looping_sound/shield_generator/shield_hum
/obj/machinery/shield_gen/advanced
name = "advanced bubble shield generator"
@@ -42,13 +42,13 @@
if(get_dir(cap, src) == cap.dir)
capacitors |= cap
cap.owned_gen = src
shield_hum = new(list(src), FALSE) // CHOMPAdd
shield_hum = new(list(src), FALSE)
. = ..()
AddElement(/datum/element/climbable)
/obj/machinery/shield_gen/Destroy()
QDEL_LIST_NULL(field)
QDEL_NULL(shield_hum) // CHOMPAdd
QDEL_NULL(shield_hum)
return ..()
/obj/machinery/shield_gen/emag_act(var/remaining_charges, var/mob/user)
@@ -246,7 +246,7 @@
to_chat(M, "[icon2html(src, M.client)] You hear heavy droning start up.")
for(var/obj/effect/energy_field/E in field) // Update the icons here to ensure all the shields have been made already.
E.update_icon()
shield_hum.start() // CHOMPAdd
shield_hum.start()
else
for(var/obj/effect/energy_field/D in field)
field.Remove(D)
@@ -255,8 +255,8 @@
for(var/mob/M in view(5,src))
to_chat(M, "[icon2html(src, M.client)] You hear heavy droning fade out.")
shield_hum.stop() // CHOMPAdd
// CHOMPAdd Start - Fills gaps when meteors happen
shield_hum.stop()
/obj/machinery/shield_gen/proc/fill_diffused()
if(active)
var/list/covered_turfs = get_shielded_turfs()
@@ -268,14 +268,12 @@
if(locate(/obj/effect/energy_field, O) || locate(/obj/machinery/pointdefense, orange(2, O)))
continue
E = new(O, src)
field.Add(E)
// CHOMPAdd End
/obj/machinery/shield_gen/update_icon()
if(stat & BROKEN)
icon_state = "broke"
set_light(0)
shield_hum.stop() // CHOMPAdd
shield_hum.stop()
else
if (src.active)
icon_state = "generator1"