mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Significantly reduce volume of disposals machinery when processing a ton of items (#21700)
* Reduce volume of recycler when consuming a ton of items * Quiets up the rest of disposals machinery * Defines, not magic numbers * Apply suggestions from code review Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> --------- Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
// Can hold items and human size things, no other draggables
|
||||
// Toilets are a type of disposal bin for small objects only and work on magic. By magic, I mean torque rotation
|
||||
#define SEND_PRESSURE 0.05*ONE_ATMOSPHERE
|
||||
/// How frequently disposals can make sounds, to prevent huge sound stacking
|
||||
#define DISPOSAL_SOUND_COOLDOWN (0.1 SECONDS)
|
||||
|
||||
/obj/machinery/disposal
|
||||
name = "disposal unit"
|
||||
@@ -464,7 +466,7 @@
|
||||
H.tomail = 1
|
||||
|
||||
sleep(10)
|
||||
if(last_sound < world.time + 1)
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0)
|
||||
last_sound = world.time
|
||||
sleep(5) // wait for animation to finish
|
||||
@@ -499,7 +501,10 @@
|
||||
/obj/machinery/disposal/proc/expel(obj/structure/disposalholder/H)
|
||||
|
||||
var/turf/target
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, FALSE)
|
||||
last_sound = world.time
|
||||
|
||||
if(H) // Somehow, someone managed to flush a window which broke mid-transit and caused the disposal to go in an infinite loop trying to expel null, hopefully this fixes it
|
||||
for(var/atom/movable/AM in H)
|
||||
target = get_offset_target_turf(src.loc, rand(5)-rand(5), rand(5)-rand(5))
|
||||
@@ -733,6 +738,8 @@
|
||||
plane = FLOOR_PLANE
|
||||
layer = DISPOSAL_PIPE_LAYER // slightly lower than wires and other pipes
|
||||
base_icon_state // initial icon state on map
|
||||
/// The last time a sound was played from this
|
||||
var/last_sound
|
||||
|
||||
// new pipe, set the icon_state as on map
|
||||
/obj/structure/disposalpipe/Initialize(mapload)
|
||||
@@ -841,7 +848,10 @@
|
||||
else // otherwise limit to 10 tiles
|
||||
target = get_ranged_target_turf(T, direction, 10)
|
||||
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, FALSE)
|
||||
last_sound = world.time
|
||||
|
||||
if(H)
|
||||
for(var/atom/movable/AM in H)
|
||||
AM.forceMove(T)
|
||||
@@ -856,7 +866,9 @@
|
||||
|
||||
else // no specified direction, so throw in random direction
|
||||
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, FALSE)
|
||||
last_sound = world.time
|
||||
if(H)
|
||||
for(var/atom/movable/AM in H)
|
||||
target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5))
|
||||
@@ -1378,6 +1390,8 @@
|
||||
var/turf/target // this will be where the output objects are 'thrown' to.
|
||||
var/obj/structure/disposalpipe/trunk/linkedtrunk
|
||||
var/mode = FALSE // Is the maintenance panel open? Different than normal disposal's mode
|
||||
/// The last time a sound was played
|
||||
var/last_sound
|
||||
|
||||
/obj/structure/disposaloutlet/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -1401,9 +1415,15 @@
|
||||
/obj/structure/disposaloutlet/proc/expel(animation = TRUE)
|
||||
if(animation)
|
||||
flick("outlet-open", src)
|
||||
playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, 0)
|
||||
var/play_sound = FALSE
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
play_sound = TRUE
|
||||
last_sound = world.time
|
||||
if(play_sound)
|
||||
playsound(src, 'sound/machines/warning-buzzer.ogg', 50, 0, FALSE)
|
||||
sleep(20) //wait until correct animation frame
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
|
||||
if(play_sound)
|
||||
playsound(src, 'sound/machines/hiss.ogg', 50, 0, FALSE)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.forceMove(loc)
|
||||
AM.pipe_eject(dir)
|
||||
|
||||
@@ -317,7 +317,9 @@
|
||||
H.destinationTag = 1
|
||||
|
||||
sleep(10)
|
||||
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0)
|
||||
if(last_sound + DISPOSAL_SOUND_COOLDOWN < world.time)
|
||||
playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, FALSE)
|
||||
last_sound = world.time
|
||||
sleep(5) // wait for animation to finish
|
||||
|
||||
H.init(src) // copy the contents of disposer to holder
|
||||
|
||||
Reference in New Issue
Block a user