Looping sounds, competently. (#14709)

This commit is contained in:
Wowzewow (Wezzy)
2022-10-13 06:30:14 +08:00
committed by GitHub
parent 1628e5d2d6
commit 318df630a5
116 changed files with 349 additions and 34 deletions

View File

@@ -19,13 +19,18 @@
var/list/atom/output_atoms var/list/atom/output_atoms
var/mid_sounds var/mid_sounds
var/mid_length var/mid_length
var/start_volume
var/start_sound var/start_sound
var/start_length var/start_length
var/end_volume
var/end_sound var/end_sound
var/chance var/chance
var/volume = 100 var/volume = 100
var/vary = FALSE
var/max_loops var/max_loops
var/direct var/direct
var/extra_range
var/falloff
var/timerid var/timerid
@@ -70,7 +75,7 @@
if(!timerid) if(!timerid)
timerid = addtimer(CALLBACK(src, .proc/sound_loop, world.time), mid_length, TIMER_STOPPABLE | TIMER_LOOP) timerid = addtimer(CALLBACK(src, .proc/sound_loop, world.time), mid_length, TIMER_STOPPABLE | TIMER_LOOP)
/datum/looping_sound/proc/play(soundfile) /datum/looping_sound/proc/play(soundfile, volume_override)
var/list/atoms_cache = output_atoms var/list/atoms_cache = output_atoms
var/sound/S = sound(soundfile) var/sound/S = sound(soundfile)
// if(direct) // if(direct)
@@ -81,7 +86,7 @@
// if(direct) // if(direct)
// SEND_SOUND(thing, S) // SEND_SOUND(thing, S)
// else // else
playsound(thing, S, volume) playsound(thing, S, volume_override || volume, vary, extra_range, falloff, required_preferences = ASFX_AMBIENCE) // you can turn it off, i guess.
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds) /datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
. = _mid_sounds || mid_sounds . = _mid_sounds || mid_sounds
@@ -91,10 +96,10 @@
/datum/looping_sound/proc/on_start() /datum/looping_sound/proc/on_start()
var/start_wait = 0 var/start_wait = 0
if(start_sound) if(start_sound)
play(start_sound) play(start_sound, start_volume)
start_wait = start_length start_wait = start_length
addtimer(CALLBACK(src, .proc/sound_loop), start_wait) addtimer(CALLBACK(src, .proc/sound_loop), start_wait)
/datum/looping_sound/proc/on_stop() /datum/looping_sound/proc/on_stop()
if(end_sound) if(end_sound)
play(end_sound) play(end_sound, end_volume)

View File

@@ -1,24 +1,27 @@
/datum/looping_sound/showering /datum/looping_sound/showering
start_sound = 'sound/machines/shower/shower_start.ogg' start_sound = 'sound/machines/shower/shower_start.ogg'
start_length = 2 start_length = 2
mid_sounds = list('sound/machines/shower/shower_mid1.ogg'=1,'sound/machines/shower/shower_mid2.ogg'=1,'sound/machines/shower/shower_mid3.ogg'=1) mid_sounds = list('sound/machines/shower/shower_mid1.ogg' = 1,'sound/machines/shower/shower_mid2.ogg' = 1,'sound/machines/shower/shower_mid3.ogg' = 1)
mid_length = 10 mid_length = 10
end_sound = 'sound/machines/shower/shower_end.ogg' end_sound = 'sound/machines/shower/shower_end.ogg'
volume = 10 volume = 20
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/supermatter /datum/looping_sound/supermatter
mid_sounds = list('sound/machines/sm/supermatter1.ogg'=1,'sound/machines/sm/supermatter2.ogg'=1,'sound/machines/sm/supermatter3.ogg'=1) mid_sounds = list('sound/machines/sm/loops/calm.ogg' = 1)
mid_length = 10 mid_length = 60
volume = 0.5 volume = 40
extra_range = 10
falloff = 4
vary = TRUE
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/generator /datum/looping_sound/generator
start_sound = 'sound/machines/generator/generator_start.ogg' start_sound = 'sound/machines/generator/generator_start.ogg'
start_length = 4 start_length = 4
mid_sounds = list('sound/machines/generator/generator_mid1.ogg'=1, 'sound/machines/generator/generator_mid2.ogg'=1, 'sound/machines/generator/generator_mid3.ogg'=1) mid_sounds = list('sound/machines/generator/generator_mid1.ogg' = 1, 'sound/machines/generator/generator_mid2.ogg' = 1, 'sound/machines/generator/generator_mid3.ogg' = 1)
mid_length = 4 mid_length = 4
end_sound = 'sound/machines/generator/generator_end.ogg' end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 20 volume = 20
@@ -32,14 +35,84 @@
mid_sounds = list('sound/machines/fryer/deep_fryer_1.ogg' = 1, 'sound/machines/fryer/deep_fryer_2.ogg' = 1) mid_sounds = list('sound/machines/fryer/deep_fryer_1.ogg' = 1, 'sound/machines/fryer/deep_fryer_2.ogg' = 1)
mid_length = 2 mid_length = 2
end_sound = 'sound/machines/fryer/deep_fryer_emerge.ogg' end_sound = 'sound/machines/fryer/deep_fryer_emerge.ogg'
volume = 2 volume = 15
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/grill
mid_sounds = list('sound/machines/grill/grillsizzle.ogg' = 1)
mid_length = 18
volume = 50
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/oven
start_sound = 'sound/machines/oven/oven_loop_start.ogg' //my immersions
start_length = 12
mid_sounds = list('sound/machines/oven/oven_loop_mid.ogg' = 1)
mid_length = 13
end_sound = 'sound/machines/oven/oven_loop_end.ogg'
volume = 100
falloff = 4
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/microwave /datum/looping_sound/microwave
start_sound = 'sound/machines/microwave/microwave-start.ogg' start_sound = 'sound/machines/microwave/microwave-start.ogg'
start_length = 10 start_length = 10
mid_sounds = list('sound/machines/microwave/microwave-mid1.ogg'=10, 'sound/machines/microwave/microwave-mid2.ogg'=1) mid_sounds = list('sound/machines/microwave/microwave-mid1.ogg'= 1, 'sound/machines/microwave/microwave-mid2.ogg'= 1)
mid_length = 10 mid_length = 10
end_sound = 'sound/machines/microwave/microwave-end.ogg' end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 30 volume = 30
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/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 = 1.8 SECONDS
extra_range = -4.5
volume = 10
// mid_length = 1.8 SECONDS
// extra_range = -11
// falloff_distance = 1
// falloff_exponent = 5 (falloff system from /tg/)(not smart enough to port it)
// volume = 50
// ignore_walls = FALSE
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/computer
start_sound = 'sound/machines/computer/computer_start.ogg'
start_length = 7.2 SECONDS
start_volume = 10
mid_sounds = list('sound/machines/computer/computer_mid1.ogg' = 1, 'sound/machines/computer/computer_mid2.ogg' = 1)
mid_length = 1.8 SECONDS
end_sound = 'sound/machines/computer/computer_end.ogg'
end_volume = 10
volume = 3
extra_range = -5.5
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/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 = 1.8 SECONDS
extra_range = 10
volume = 70
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/firealarm
mid_sounds = list('sound/machines/firealarm/FireAlarm1.ogg' = 1,'sound/machines/firealarm/FireAlarm2.ogg' = 1,'sound/machines/firealarm/FireAlarm3.ogg' = 1,'sound/machines/firealarm/FireAlarm4.ogg' = 1)
mid_length = 2.4 SECONDS
volume = 75
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -18,6 +18,8 @@
var/wiresexposed = 0 var/wiresexposed = 0
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
var/seclevel var/seclevel
///looping sound datum for our fire alarm siren.
var/datum/looping_sound/firealarm/soundloop
/obj/machinery/firealarm/examine(mob/user) /obj/machinery/firealarm/examine(mob/user)
. = ..() . = ..()
@@ -226,6 +228,7 @@
var/area/area = get_area(src) var/area/area = get_area(src)
for(var/obj/machinery/firealarm/FA in area) for(var/obj/machinery/firealarm/FA in area)
fire_alarm.clearAlarm(loc, FA) fire_alarm.clearAlarm(loc, FA)
soundloop.stop(src)
update_icon() update_icon()
return return
@@ -235,7 +238,7 @@
var/area/area = get_area(src) var/area/area = get_area(src)
for(var/obj/machinery/firealarm/FA in area) for(var/obj/machinery/firealarm/FA in area)
fire_alarm.triggerAlarm(loc, FA, duration) fire_alarm.triggerAlarm(loc, FA, duration)
playsound(get_turf(FA), 'sound/ambience/firealarm.ogg', 75, FALSE) soundloop.start(src)
update_icon() update_icon()
return return
@@ -260,6 +263,11 @@
if(isContactLevel(z)) if(isContactLevel(z))
set_security_level(security_level ? get_security_level() : "green") set_security_level(security_level ? get_security_level() : "green")
soundloop = new(src, FALSE)
/obj/machinery/firealarm/Destroy()
QDEL_NULL(soundloop)
. = ..()
// Convenience subtypes for mappers. // Convenience subtypes for mappers.
/obj/machinery/firealarm/north /obj/machinery/firealarm/north

View File

@@ -40,6 +40,8 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
var/overmap_range = 2 //OVERMAP: Number of sectors out we can communicate var/overmap_range = 2 //OVERMAP: Number of sectors out we can communicate
///Looping sounds for any servers
// 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)
// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending // relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
@@ -109,13 +111,13 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
//OVERMAP: Since telecomms is subspace, limit how far it goes. This prevents double-broadcasts across the entire overmap, and gives the ability to intrude on comms range of other ships //OVERMAP: Since telecomms is subspace, limit how far it goes. This prevents double-broadcasts across the entire overmap, and gives the ability to intrude on comms range of other ships
/obj/machinery/telecomms/proc/check_receive_sector(datum/signal/signal) /obj/machinery/telecomms/proc/check_receive_sector(datum/signal/signal)
if(isAdminLevel(z) || isAdminLevel(signal.data["level"])) //Messages to and from centcomm levels are not sector-restricted. if(isAdminLevel(z) || isAdminLevel(signal.data["level"])) //Messages to and from centcomm levels are not sector-restricted.
return TRUE return TRUE
if(current_map.use_overmap) if(current_map.use_overmap)
if(!linked) //If we're using overmap and not associated with a sector, doesn't work. if(!linked) //If we're using overmap and not associated with a sector, doesn't work.
return FALSE return FALSE
var/obj/effect/overmap/visitable/S = signal.data["sector"] var/obj/effect/overmap/visitable/S = signal.data["sector"]
if(istype(S)) //If our signal isn't sending a sector, it's something associated with telecomms_process_active(), which has their own limits. if(istype(S)) //If our signal isn't sending a sector, it's something associated with telecomms_process_active(), which has their own limits.
if(S != linked) //If we're not the same ship, check range if(S != linked) //If we're not the same ship, check range
if(get_dist(S, linked) > overmap_range && !(S in view(overmap_range, linked))) if(get_dist(S, linked) > overmap_range && !(S in view(overmap_range, linked)))
return FALSE return FALSE
@@ -127,7 +129,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
/obj/machinery/telecomms/Initialize() /obj/machinery/telecomms/Initialize()
. = ..() . = ..()
// soundloop = new(list(src), on)
if(autolinkers.len) if(autolinkers.len)
// Links nearby machines // Links nearby machines
if(!long_range_link) if(!long_range_link)
@@ -151,6 +153,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
attempt_hook_up(my_sector) attempt_hook_up(my_sector)
/obj/machinery/telecomms/Destroy() /obj/machinery/telecomms/Destroy()
// QDEL_NULL(soundloop)
telecomms_list -= src telecomms_list -= src
for(var/obj/machinery/telecomms/comm in telecomms_list) for(var/obj/machinery/telecomms/comm in telecomms_list)
comm.links -= src comm.links -= src
@@ -175,14 +178,16 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
icon_state = state icon_state = state
/obj/machinery/telecomms/proc/update_power() /obj/machinery/telecomms/proc/update_power()
if(toggled) if(toggled)
if(stat & (BROKEN|NOPOWER|EMPED) || integrity <= 0) // if powered, on. if not powered, off. if too damaged, off if(stat & (BROKEN|NOPOWER|EMPED) || integrity <= 0) // if powered, on. if not powered, off. if too damaged, off
on = 0 on = FALSE
// soundloop.stop(src)
else else
on = 1 on = TRUE
// soundloop.start(src)
else else
on = 0 on = FALSE
// soundloop.stop(src)
/obj/machinery/telecomms/process() /obj/machinery/telecomms/process()
update_power() update_power()

View File

@@ -6,15 +6,18 @@
w_class = ITEMSIZE_HUGE w_class = ITEMSIZE_HUGE
force = 12 force = 12
var/time_multiplier = 1 var/time_multiplier = 1
var/datum/looping_sound/thermal_drill/soundloop
/obj/item/thermal_drill/Initialize() /obj/item/thermal_drill/Initialize()
. = ..() . = ..()
soundloop = new(list(src), FALSE)
/obj/item/thermal_drill/Destroy() /obj/item/thermal_drill/Destroy()
QDEL_NULL(soundloop)
return ..() return ..()
/obj/item/thermal_drill/diamond_drill /obj/item/thermal_drill/diamond_drill
name = "diamond tipped thermal safe drill" name = "diamond tipped thermal safe drill"
desc = "A diamond tipped thermal drill with magnetic clamps for the purpose of quickly drilling hardened objects. Guaranteed 100% jam proof." desc = "A diamond tipped thermal drill with magnetic clamps for the purpose of quickly drilling hardened objects. Guaranteed 100% jam proof."
icon_state = "diamond_drill" icon_state = "diamond_drill"
time_multiplier = 2 time_multiplier = 2

View File

@@ -54,6 +54,7 @@ FLOOR SAFES
/obj/structure/safe/Destroy() /obj/structure/safe/Destroy()
if(drill) if(drill)
drill.soundloop.stop()
drill.forceMove(loc) drill.forceMove(loc)
drill = null drill = null
return ..() return ..()
@@ -118,6 +119,7 @@ FLOOR SAFES
if(broken) if(broken)
return return
last_drill_time = world.time last_drill_time = world.time
drill.soundloop.start()
START_PROCESSING(SSprocessing, src) START_PROCESSING(SSprocessing, src)
update_icon() update_icon()
if("Turn Off") if("Turn Off")
@@ -126,6 +128,7 @@ FLOOR SAFES
if(do_after(user, 2 SECONDS)) if(do_after(user, 2 SECONDS))
if(!drill || !isprocessing) if(!drill || !isprocessing)
return return
drill.soundloop.stop()
STOP_PROCESSING(SSprocessing, src) STOP_PROCESSING(SSprocessing, src)
update_icon() update_icon()
if("Remove Drill") if("Remove Drill")
@@ -288,7 +291,7 @@ FLOOR SAFES
new /obj/random/highvalue(src) new /obj/random/highvalue(src)
new /obj/random/highvalue(src) new /obj/random/highvalue(src)
/obj/structure/safe/cash /obj/structure/safe/cash
name = "credit safe" name = "credit safe"
/obj/structure/safe/cash/Initialize() /obj/structure/safe/cash/Initialize()

View File

@@ -142,12 +142,15 @@
var/mobpresent = 0 //true if there is a mob on the shower's loc, this is to ease process() var/mobpresent = 0 //true if there is a mob on the shower's loc, this is to ease process()
var/is_washing = 0 var/is_washing = 0
var/list/temperature_settings = list("normal" = 310, "boiling" = T0C+100, "freezing" = T0C) var/list/temperature_settings = list("normal" = 310, "boiling" = T0C+100, "freezing" = T0C)
var/datum/looping_sound/showering/soundloop
/obj/machinery/shower/Initialize() /obj/machinery/shower/Initialize()
. = ..() . = ..()
create_reagents(2) create_reagents(2)
soundloop = new(list(src), FALSE)
/obj/machinery/shower/Destroy() /obj/machinery/shower/Destroy()
QDEL_NULL(soundloop)
return ..() return ..()
//add heat controls? when emagged, you can freeze to death in it? //add heat controls? when emagged, you can freeze to death in it?
@@ -187,6 +190,7 @@
qdel(mymist) qdel(mymist)
if(on) if(on)
soundloop.start(src)
add_overlay(image('icons/obj/watercloset.dmi', src, "water", MOB_LAYER + 1, dir)) add_overlay(image('icons/obj/watercloset.dmi', src, "water", MOB_LAYER + 1, dir))
if(temperature_settings[watertemp] < T20C) if(temperature_settings[watertemp] < T20C)
return //no mist for cold water return //no mist for cold water
@@ -199,6 +203,7 @@
ismist = 1 ismist = 1
mymist = new /obj/effect/mist(loc) mymist = new /obj/effect/mist(loc)
else else
soundloop.stop(src)
if(ismist) if(ismist)
ismist = 1 ismist = 1
mymist = new /obj/effect/mist(loc) mymist = new /obj/effect/mist(loc)

View File

@@ -851,3 +851,75 @@
'sound/items/tools/shovel2.ogg', 'sound/items/tools/shovel2.ogg',
'sound/items/tools/shovel3.ogg' 'sound/items/tools/shovel3.ogg'
) )
/decl/sound_category/supermatter_calm
sounds = list('sound/machines/sm/accent/normal/1.ogg',
'sound/machines/sm/accent/normal/2.ogg',
'sound/machines/sm/accent/normal/3.ogg',
'sound/machines/sm/accent/normal/4.ogg',
'sound/machines/sm/accent/normal/5.ogg',
'sound/machines/sm/accent/normal/6.ogg',
'sound/machines/sm/accent/normal/7.ogg',
'sound/machines/sm/accent/normal/8.ogg',
'sound/machines/sm/accent/normal/9.ogg',
'sound/machines/sm/accent/normal/10.ogg',
'sound/machines/sm/accent/normal/11.ogg',
'sound/machines/sm/accent/normal/12.ogg',
'sound/machines/sm/accent/normal/13.ogg',
'sound/machines/sm/accent/normal/14.ogg',
'sound/machines/sm/accent/normal/15.ogg',
'sound/machines/sm/accent/normal/16.ogg',
'sound/machines/sm/accent/normal/17.ogg',
'sound/machines/sm/accent/normal/18.ogg',
'sound/machines/sm/accent/normal/19.ogg',
'sound/machines/sm/accent/normal/20.ogg',
'sound/machines/sm/accent/normal/21.ogg',
'sound/machines/sm/accent/normal/22.ogg',
'sound/machines/sm/accent/normal/23.ogg',
'sound/machines/sm/accent/normal/24.ogg',
'sound/machines/sm/accent/normal/25.ogg',
'sound/machines/sm/accent/normal/26.ogg',
'sound/machines/sm/accent/normal/27.ogg',
'sound/machines/sm/accent/normal/28.ogg',
'sound/machines/sm/accent/normal/29.ogg',
'sound/machines/sm/accent/normal/30.ogg',
'sound/machines/sm/accent/normal/31.ogg',
'sound/machines/sm/accent/normal/32.ogg',
'sound/machines/sm/accent/normal/33.ogg'
)
/decl/sound_category/supermatter_delam
sounds = list('sound/machines/sm/accent/delam/1.ogg',
'sound/machines/sm/accent/delam/2.ogg',
'sound/machines/sm/accent/delam/3.ogg',
'sound/machines/sm/accent/delam/4.ogg',
'sound/machines/sm/accent/delam/5.ogg',
'sound/machines/sm/accent/delam/6.ogg',
'sound/machines/sm/accent/delam/7.ogg',
'sound/machines/sm/accent/delam/8.ogg',
'sound/machines/sm/accent/delam/9.ogg',
'sound/machines/sm/accent/delam/10.ogg',
'sound/machines/sm/accent/delam/11.ogg',
'sound/machines/sm/accent/delam/12.ogg',
'sound/machines/sm/accent/delam/13.ogg',
'sound/machines/sm/accent/delam/14.ogg',
'sound/machines/sm/accent/delam/15.ogg',
'sound/machines/sm/accent/delam/16.ogg',
'sound/machines/sm/accent/delam/17.ogg',
'sound/machines/sm/accent/delam/18.ogg',
'sound/machines/sm/accent/delam/19.ogg',
'sound/machines/sm/accent/delam/20.ogg',
'sound/machines/sm/accent/delam/21.ogg',
'sound/machines/sm/accent/delam/22.ogg',
'sound/machines/sm/accent/delam/23.ogg',
'sound/machines/sm/accent/delam/24.ogg',
'sound/machines/sm/accent/delam/25.ogg',
'sound/machines/sm/accent/delam/26.ogg',
'sound/machines/sm/accent/delam/27.ogg',
'sound/machines/sm/accent/delam/28.ogg',
'sound/machines/sm/accent/delam/29.ogg',
'sound/machines/sm/accent/delam/30.ogg',
'sound/machines/sm/accent/delam/31.ogg',
'sound/machines/sm/accent/delam/32.ogg',
'sound/machines/sm/accent/delam/33.ogg'
)

View File

@@ -113,6 +113,7 @@
if(wasoff != (stat & POWEROFF)) if(wasoff != (stat & POWEROFF))
activation_message(user) activation_message(user)
playsound(src, 'sound/machines/click.ogg', 40, 1) playsound(src, 'sound/machines/click.ogg', 40, 1)
cooking = use_power
update_icon() update_icon()
/obj/machinery/appliance/cooker/proc/activation_message(var/mob/user) /obj/machinery/appliance/cooker/proc/activation_message(var/mob/user)

View File

@@ -24,6 +24,7 @@
var/datum/reagents/oil var/datum/reagents/oil
var/optimal_oil = 9000//90 litres of cooking oil var/optimal_oil = 9000//90 litres of cooking oil
var/datum/looping_sound/deep_fryer/fry_loop
/obj/machinery/appliance/cooker/fryer/examine(var/mob/user) /obj/machinery/appliance/cooker/fryer/examine(var/mob/user)
. = ..() . = ..()
@@ -40,6 +41,12 @@
//Sometimes the fryer will start with much less than full oil, significantly impacting efficiency until filled //Sometimes the fryer will start with much less than full oil, significantly impacting efficiency until filled
variance = rand()*0.5 variance = rand()*0.5
oil.add_reagent(/decl/reagent/nutriment/triglyceride/oil/corn, optimal_oil*(1 - variance)) oil.add_reagent(/decl/reagent/nutriment/triglyceride/oil/corn, optimal_oil*(1 - variance))
fry_loop = new(list(src), FALSE)
/obj/machinery/appliance/cooker/fryer/Destroy()
QDEL_NULL(fry_loop)
QDEL_NULL(oil)
return ..()
/obj/machinery/appliance/cooker/fryer/heat_up() /obj/machinery/appliance/cooker/fryer/heat_up()
if (..()) if (..())
@@ -212,3 +219,11 @@
return TRUE return TRUE
//If neither of the above returned, then call parent as normal //If neither of the above returned, then call parent as normal
..() ..()
/obj/machinery/appliance/cooker/fryer/add_content(obj/item/I, mob/user)
. = ..()
fry_loop.start(src)
/obj/machinery/appliance/cooker/fryer/eject(datum/cooking_item/CI, mob/user)
. = ..()
fry_loop.stop(src)

View File

@@ -32,6 +32,16 @@
/obj/item/reagent_containers/cooking_container/grill_grate /obj/item/reagent_containers/cooking_container/grill_grate
) )
var/datum/looping_sound/grill/grill_loop
/obj/machinery/appliance/cooker/grill/Initialize()
. = ..()
grill_loop = new(list(src), FALSE)
/obj/machinery/appliance/cooker/grill/Destroy()
QDEL_NULL(grill_loop)
. = ..()
/obj/machinery/appliance/cooker/grill/RefreshParts() /obj/machinery/appliance/cooker/grill/RefreshParts()
..() ..()
cooking_coeff = 0.3 // we will always cook nice and slow cooking_coeff = 0.3 // we will always cook nice and slow
@@ -61,7 +71,9 @@
icon_state = on_icon icon_state = on_icon
else else
icon_state = off_icon icon_state = off_icon
grill_loop.stop()
if(length(cooking_objs)) if(length(cooking_objs))
grill_loop.start()
var/datum/cooking_item/CI = cooking_objs[1] var/datum/cooking_item/CI = cooking_objs[1]
var/obj/item/reagent_containers/cooking_container/grill_grate/G = CI.container var/obj/item/reagent_containers/cooking_container/grill_grate/G = CI.container
if(G) if(G)
@@ -72,4 +84,4 @@
add_overlay(image('icons/obj/cooking_machines.dmi', "meat[counter]")) add_overlay(image('icons/obj/cooking_machines.dmi', "meat[counter]"))
else if(istype(thing, /obj/item/reagent_containers/food/snacks/xenomeat)) else if(istype(thing, /obj/item/reagent_containers/food/snacks/xenomeat))
add_overlay(image('icons/obj/cooking_machines.dmi', "xenomeat[counter]")) add_overlay(image('icons/obj/cooking_machines.dmi', "xenomeat[counter]"))
counter++ counter++

View File

@@ -18,6 +18,8 @@
max_contents = 5 max_contents = 5
stat = POWEROFF //Starts turned off stat = POWEROFF //Starts turned off
var/open = FALSE // Start closed so people don't heat up ovens with the door open var/open = FALSE // Start closed so people don't heat up ovens with the door open
///Looping sound for the oven
var/datum/looping_sound/oven/oven_loop
starts_with = list( starts_with = list(
/obj/item/reagent_containers/cooking_container/oven, /obj/item/reagent_containers/cooking_container/oven,
@@ -39,6 +41,13 @@
"Donut" = /obj/item/reagent_containers/food/snacks/variable/donut "Donut" = /obj/item/reagent_containers/food/snacks/variable/donut
) )
/obj/machinery/appliance/cooker/oven/Initialize()
. = ..()
oven_loop = new(src)
/obj/machinery/appliance/cooker/oven/Destroy()
QDEL_NULL(oven_loop)
. = ..()
/obj/machinery/appliance/cooker/oven/update_icon() /obj/machinery/appliance/cooker/oven/update_icon()
if (!open) if (!open)
@@ -67,9 +76,21 @@
open = !open open = !open
loss = (heating_power / resistance) * (0.5 + open) loss = (heating_power / resistance) * (0.5 + open)
//When the oven door is opened, oven slowly loses heat //When the oven door is opened, oven slowly loses heat
if(open)
playsound(src, 'sound/machines/hatch_open.ogg', 20, 1) playsound(src, 'sound/machines/oven/oven_close.ogg', 75, TRUE)
else
playsound(src, 'sound/machines/oven/oven_open.ogg', 75, TRUE)
update_icon() update_icon()
update_baking_audio()
/obj/machinery/appliance/cooker/oven/proc/update_baking_audio()
if(!oven_loop)
return
var/obj/item/reagent_containers/cooking_container/C
if(!open && C?.contents.len)
oven_loop.start()
else
oven_loop.stop()
/obj/machinery/appliance/cooker/oven/proc/manip(var/obj/item/I) /obj/machinery/appliance/cooker/oven/proc/manip(var/obj/item/I)
// check if someone's trying to manipulate the machine // check if someone's trying to manipulate the machine

View File

@@ -46,7 +46,7 @@
working = hard_drive && processor_unit && damage < broken_damage && computer_use_power() working = hard_drive && processor_unit && damage < broken_damage && computer_use_power()
check_update_ui_need() check_update_ui_need()
if(!is_portable && working && enabled && world.time > ambience_last_played_time + 30 SECONDS && prob(3)) if(looping_sound && working && enabled && world.time > ambience_last_played_time + 30 SECONDS && prob(3))
playsound(get_turf(src), /decl/sound_category/computerbeep_sound, 30, 1, 10, required_preferences = ASFX_AMBIENCE) playsound(get_turf(src), /decl/sound_category/computerbeep_sound, 30, 1, 10, required_preferences = ASFX_AMBIENCE)
ambience_last_played_time = world.time ambience_last_played_time = world.time
@@ -93,6 +93,8 @@
install_default_programs() install_default_programs()
handle_verbs() handle_verbs()
update_icon() update_icon()
if(looping_sound)
soundloop = new(src, enabled)
initial_name = name initial_name = name
/obj/item/modular_computer/Destroy() /obj/item/modular_computer/Destroy()
@@ -105,6 +107,7 @@
listening_objects -= src listening_objects -= src
STOP_PROCESSING(SSprocessing, src) STOP_PROCESSING(SSprocessing, src)
QDEL_NULL(listener) QDEL_NULL(listener)
QDEL_NULL(soundloop)
return ..() return ..()
/obj/item/modular_computer/CouldUseTopic(var/mob/user) /obj/item/modular_computer/CouldUseTopic(var/mob/user)
@@ -231,10 +234,14 @@
visible_message(SPAN_NOTICE("\The [src] shuts down.")) visible_message(SPAN_NOTICE("\The [src] shuts down."))
SSvueui.close_uis(src) SSvueui.close_uis(src)
enabled = FALSE enabled = FALSE
if(looping_sound)
soundloop.stop(src)
update_icon() update_icon()
/obj/item/modular_computer/proc/enable_computer(var/mob/user, var/ar_forced=FALSE) /obj/item/modular_computer/proc/enable_computer(var/mob/user, var/ar_forced=FALSE)
enabled = TRUE enabled = TRUE
if(looping_sound)
soundloop.start(src)
update_icon() update_icon()
// Autorun feature // Autorun feature

View File

@@ -15,6 +15,8 @@
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 // Looping sound for when the computer is on
var/looping_sound = TRUE // Whether or not this modular computer uses the looping sound. Also handles ambience beeps.
var/computer_emagged = FALSE // Whether the computer is emagged. var/computer_emagged = FALSE // Whether the computer is emagged.
var/apc_powered = FALSE // Set automatically. Whether the computer used APC power last tick. var/apc_powered = FALSE // Set automatically. Whether the computer used APC power last tick.
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.
@@ -30,7 +32,6 @@
var/doorcode = "smindicate" var/doorcode = "smindicate"
var/hidden = FALSE var/hidden = FALSE
var/initial_name var/initial_name
var/is_portable = FALSE // Used to prevent the ambient beeps from playing.
// Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..) // Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..)
// must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently // must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently

View File

@@ -13,7 +13,7 @@
hardware_flag = PROGRAM_TABLET hardware_flag = PROGRAM_TABLET
max_hardware_size = 1 max_hardware_size = 1
w_class = ITEMSIZE_SMALL w_class = ITEMSIZE_SMALL
is_portable = TRUE looping_sound = FALSE
/obj/item/modular_computer/handheld/Initialize() /obj/item/modular_computer/handheld/Initialize()
. = ..() . = ..()
@@ -21,4 +21,4 @@
/obj/item/modular_computer/handheld/proc/set_icon() /obj/item/modular_computer/handheld/proc/set_icon()
icon_state_unpowered = icon_state icon_state_unpowered = icon_state
icon_state_broken = icon_state icon_state_broken = icon_state

View File

@@ -13,6 +13,7 @@
w_class = ITEMSIZE_NORMAL w_class = ITEMSIZE_NORMAL
enrolled = 2 enrolled = 2
var/mob/living/silicon/computer_host // Thing that contains this computer. Used for silicon computers var/mob/living/silicon/computer_host // Thing that contains this computer. Used for silicon computers
looping_sound = FALSE
/obj/item/modular_computer/silicon/ui_host() /obj/item/modular_computer/silicon/ui_host()
. = computer_host . = computer_host
@@ -43,7 +44,7 @@
/obj/item/modular_computer/silicon/Click(location, control, params) /obj/item/modular_computer/silicon/Click(location, control, params)
return attack_self(usr) return attack_self(usr)
/obj/item/modular_computer/silicon/install_default_hardware() /obj/item/modular_computer/silicon/install_default_hardware()
. = ..() . = ..()
processor_unit = new /obj/item/computer_hardware/processor_unit(src) processor_unit = new /obj/item/computer_hardware/processor_unit(src)
@@ -65,4 +66,4 @@
/obj/item/modular_computer/silicon/robot/drone/install_default_programs() /obj/item/modular_computer/silicon/robot/drone/install_default_programs()
hard_drive.store_file(new /datum/computer_file/program/filemanager(src)) hard_drive.store_file(new /datum/computer_file/program/filemanager(src))
hard_drive.store_file(new /datum/computer_file/program/ntnetdownload(src)) hard_drive.store_file(new /datum/computer_file/program/ntnetdownload(src))
hard_drive.remove_file(hard_drive.find_file_by_name("clientmanager")) hard_drive.remove_file(hard_drive.find_file_by_name("clientmanager"))

View File

@@ -27,6 +27,8 @@
light_color = LIGHT_COLOR_CYAN light_color = LIGHT_COLOR_CYAN
light_power = 1 light_power = 1
light_range = 8 light_range = 8
var/datum/looping_sound/gravgen/soundloop
/obj/machinery/gravity_generator/ex_act(severity) /obj/machinery/gravity_generator/ex_act(severity)
if(severity == 1) // Very sturdy. if(severity == 1) // Very sturdy.
set_broken() set_broken()
@@ -128,6 +130,7 @@
log_debug("Gravity Generator Destroyed") log_debug("Gravity Generator Destroyed")
investigate_log("was destroyed!", "gravity") investigate_log("was destroyed!", "gravity")
on = 0 on = 0
QDEL_NULL(soundloop)
update_list(TRUE) update_list(TRUE)
for(var/obj/machinery/gravity_generator/part/O in parts) for(var/obj/machinery/gravity_generator/part/O in parts)
O.main_part = null O.main_part = null
@@ -347,12 +350,14 @@
if(!area.has_gravity()) if(!area.has_gravity())
alert = 1 alert = 1
gravity_is_on = 1 gravity_is_on = 1
soundloop.start(src)
investigate_log("was brought online and is now producing gravity for this level.", "gravity") investigate_log("was brought online and is now producing gravity for this level.", "gravity")
message_admins("The gravity generator was brought online. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)") message_admins("The gravity generator was brought online. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)")
else else
if(area.has_gravity()) if(area.has_gravity())
alert = 1 alert = 1
gravity_is_on = 0 gravity_is_on = 0
soundloop.stop(src)
investigate_log("was brought offline and there is now no gravity for this level.", "gravity") investigate_log("was brought offline and there is now no gravity for this level.", "gravity")
message_admins("The gravity generator was brought offline with no backup generator. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)") message_admins("The gravity generator was brought offline with no backup generator. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)")
@@ -443,6 +448,7 @@
/obj/machinery/gravity_generator/main/Initialize() /obj/machinery/gravity_generator/main/Initialize()
. = ..() . = ..()
soundloop = new(src, start_immediately = FALSE)
addtimer(CALLBACK(src, .proc/updateareas), 10) addtimer(CALLBACK(src, .proc/updateareas), 10)
return return

View File

@@ -13,9 +13,15 @@
var/open = FALSE var/open = FALSE
var/power_output = 1 var/power_output = 1
var/portgen_lightcolour = "#000000" var/portgen_lightcolour = "#000000"
var/datum/looping_sound/generator/soundloop
/obj/machinery/power/portgen/Initialize() /obj/machinery/power/portgen/Initialize()
. = ..() . = ..()
soundloop = new(list(src), active)
/obj/machinery/power/portgen/Destroy()
QDEL_NULL(soundloop)
return ..()
/obj/machinery/power/portgen/proc/IsBroken() /obj/machinery/power/portgen/proc/IsBroken()
return (stat & (BROKEN|EMPED)) return (stat & (BROKEN|EMPED))
@@ -42,6 +48,7 @@
else else
set_light(0) set_light(0)
active = FALSE active = FALSE
soundloop.stop(src)
icon_state = initial(icon_state) icon_state = initial(icon_state)
handleInactive() handleInactive()
@@ -364,10 +371,12 @@
if(!active && HasFuel() && !IsBroken()) if(!active && HasFuel() && !IsBroken())
active = TRUE active = TRUE
update_icon() update_icon()
soundloop.start(src)
if(href_list["action"] == "disable") if(href_list["action"] == "disable")
if (active) if (active)
active = FALSE active = FALSE
update_icon() update_icon()
soundloop.stop(src)
if(href_list["action"] == "eject") if(href_list["action"] == "eject")
if(!active) if(!active)
DropFuel() DropFuel()

View File

@@ -30,6 +30,9 @@
#define WARNING_DELAY 20 //seconds between warnings. #define WARNING_DELAY 20 //seconds between warnings.
///to prevent accent sounds from layering
#define SUPERMATTER_ACCENT_SOUND_MIN_COOLDOWN 2 SECONDS
#define LIGHT_POWER_CALC (max(power / 50, 1)) #define LIGHT_POWER_CALC (max(power / 50, 1))
/obj/machinery/power/supermatter /obj/machinery/power/supermatter
@@ -108,12 +111,19 @@
var/debug = 0 var/debug = 0
var/last_message_time = -100 //for message var/last_message_time = -100 //for message
var/datum/looping_sound/supermatter/soundloop
/// cooldown tracker for accent sounds,
var/last_accent_sound = 0
/obj/machinery/power/supermatter/Initialize() /obj/machinery/power/supermatter/Initialize()
. = ..() . = ..()
radio = new /obj/item/device/radio{channels=list("Engineering")}(src) radio = new /obj/item/device/radio{channels=list("Engineering")}(src)
soundloop = new(list(src), TRUE)
/obj/machinery/power/supermatter/Destroy() /obj/machinery/power/supermatter/Destroy()
QDEL_NULL(radio) QDEL_NULL(radio)
QDEL_NULL(soundloop)
. = ..() . = ..()
/obj/machinery/power/supermatter/proc/explode() /obj/machinery/power/supermatter/proc/explode()
@@ -196,7 +206,6 @@
return ..() return ..()
/obj/machinery/power/supermatter/process() /obj/machinery/power/supermatter/process()
var/turf/L = loc var/turf/L = loc
if(isnull(L)) // We have a null turf...something is wrong, stop processing this entity. if(isnull(L)) // We have a null turf...something is wrong, stop processing this entity.
@@ -221,10 +230,28 @@
if(grav_pulling) if(grav_pulling)
supermatter_pull() supermatter_pull()
if(power)
soundloop.volume = Clamp((50 + (power / 50)), 50, 100)
if(damage >= 300)
soundloop.mid_sounds = list('sound/machines/sm/loops/delamming.ogg' = 1)
else
soundloop.mid_sounds = list('sound/machines/sm/loops/calm.ogg' = 1)
if(last_accent_sound < world.time && prob(20))
var/aggression = min(((damage / 800) * (power / 2500)), 1.0) * 100
if(damage >= 300)
playsound(src, /decl/sound_category/supermatter_delam, max(50, aggression), FALSE, 10)
else
playsound(src, /decl/sound_category/supermatter_calm, max(50, aggression), FALSE, 10)
var/next_sound = round((100 - aggression) * 5)
last_accent_sound = world.time + max(SUPERMATTER_ACCENT_SOUND_MIN_COOLDOWN, next_sound)
//Ok, get the air from the turf //Ok, get the air from the turf
var/datum/gas_mixture/removed = null
var/datum/gas_mixture/env = null var/datum/gas_mixture/env = null
var/datum/gas_mixture/removed = null
//ensure that damage doesn't increase too quickly due to super high temperatures resulting from no coolant, for example. We dont want the SM exploding before anyone can react. //ensure that damage doesn't increase too quickly due to super high temperatures resulting from no coolant, for example. We dont want the SM exploding before anyone can react.
//We want the cap to scale linearly with power (and explosion_point). Let's aim for a cap of 5 at power = 300 (based on testing, equals roughly 5% per SM alert announcement). //We want the cap to scale linearly with power (and explosion_point). Let's aim for a cap of 5 at power = 300 (based on testing, equals roughly 5% per SM alert announcement).
var/damage_inc_limit = (power/300)*(explosion_point/1000)*DAMAGE_RATE_LIMIT var/damage_inc_limit = (power/300)*(explosion_point/1000)*DAMAGE_RATE_LIMIT
@@ -458,4 +485,4 @@
return return
#undef LIGHT_POWER_CALC #undef LIGHT_POWER_CALC
#undef SPACED_DAMAGE_FACTOR #undef SPACED_DAMAGE_FACTOR

View File

@@ -0,0 +1,41 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: Wowzewow (Wezzy)
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Re-adds looping sounds, fixed this time."

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More