From f39fb1f5174cd0b4dca85a7ad609ec2e1c9f863a Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Sat, 15 Mar 2025 04:40:20 -0400 Subject: [PATCH] Create large package expel delay for disposals. (#28544) --- _maps/map_files/stations/cerestation.dmm | 75 +++++++++---------- code/modules/recycling/disposal.dm | 93 +++++++++++++++++------- 2 files changed, 98 insertions(+), 70 deletions(-) diff --git a/_maps/map_files/stations/cerestation.dmm b/_maps/map_files/stations/cerestation.dmm index 725141bdf9f..d8824266331 100644 --- a/_maps/map_files/stations/cerestation.dmm +++ b/_maps/map_files/stations/cerestation.dmm @@ -105,12 +105,12 @@ /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/northwest) "aaI" = ( -/obj/structure/disposaloutlet{ - dir = 8 - }, /obj/structure/disposalpipe/trunk{ dir = 4 }, +/obj/structure/disposaloutlet/cere{ + dir = 8 + }, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/north) "aaM" = ( @@ -327,10 +327,10 @@ /turf/simulated/mineral/ancient, /area/mine/unexplored/cere/command) "abY" = ( -/obj/structure/disposaloutlet, /obj/structure/disposalpipe/trunk{ dir = 1 }, +/obj/structure/disposaloutlet/cere, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/northwest) "abZ" = ( @@ -1994,15 +1994,6 @@ }, /turf/simulated/floor/plating, /area/station/maintenance/disposal/north) -"apW" = ( -/obj/structure/disposalpipe/trunk{ - dir = 4 - }, -/obj/structure/disposaloutlet{ - dir = 8 - }, -/turf/simulated/floor/plating/airless, -/area/station/maintenance/disposal/northeast) "apY" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/blood/tracks/mapped{ @@ -17648,13 +17639,13 @@ /turf/simulated/floor/grass/jungle, /area/station/hallway/secondary/garden) "ctz" = ( -/obj/structure/disposaloutlet{ - dir = 8 - }, /obj/structure/disposalpipe/trunk{ dir = 4 }, /obj/structure/railing, +/obj/structure/disposaloutlet/cere{ + dir = 8 + }, /turf/simulated/floor/plating/airless, /area/station/turret_protected/aisat/interior/secondary) "ctC" = ( @@ -23472,12 +23463,12 @@ /turf/space, /area/station/engineering/solar/aft) "dhy" = ( -/obj/structure/disposaloutlet{ - dir = 8 - }, /obj/structure/disposalpipe/trunk{ dir = 4 }, +/obj/structure/disposaloutlet/cere{ + dir = 8 + }, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/northeast) "dhE" = ( @@ -28200,12 +28191,12 @@ /turf/simulated/floor/plating, /area/station/maintenance/solar_maintenance/aft) "eil" = ( -/obj/structure/disposaloutlet{ - dir = 4 - }, /obj/structure/disposalpipe/trunk{ dir = 8 }, +/obj/structure/disposaloutlet/cere{ + dir = 4 + }, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/westalt) "eiu" = ( @@ -37302,12 +37293,12 @@ }, /area/station/maintenance/apmaint) "gAG" = ( -/obj/structure/disposaloutlet{ - dir = 4 - }, /obj/structure/disposalpipe/trunk{ dir = 8 }, +/obj/structure/disposaloutlet/cere{ + dir = 4 + }, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/external/southwest) "gAJ" = ( @@ -63722,10 +63713,10 @@ /turf/simulated/mineral/ancient, /area/station/hallway/primary/port/north) "mJo" = ( -/obj/structure/disposaloutlet, /obj/structure/disposalpipe/trunk{ dir = 1 }, +/obj/structure/disposaloutlet/cere, /turf/simulated/floor/plating, /area/station/maintenance/disposal/westalt) "mJt" = ( @@ -76609,12 +76600,12 @@ }, /area/station/hallway/primary/aft/east) "pRl" = ( -/obj/structure/disposaloutlet{ - dir = 8 - }, /obj/structure/disposalpipe/trunk{ dir = 4 }, +/obj/structure/disposaloutlet/cere{ + dir = 8 + }, /turf/simulated/floor/plating, /area/station/maintenance/disposal/west) "pRq" = ( @@ -78872,7 +78863,7 @@ /obj/structure/disposalpipe/trunk{ dir = 1 }, -/obj/structure/disposaloutlet, +/obj/structure/disposaloutlet/cere, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/southwest) "qtV" = ( @@ -79560,10 +79551,10 @@ }, /area/station/ai_monitored/storage/eva) "qBS" = ( -/obj/structure/disposaloutlet{ +/obj/structure/disposalpipe/trunk, +/obj/structure/disposaloutlet/cere{ dir = 1 }, -/obj/structure/disposalpipe/trunk, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/external/southeast) "qBU" = ( @@ -94035,10 +94026,10 @@ /turf/simulated/floor/wood, /area/station/maintenance/gambling_den) "ubl" = ( -/obj/structure/disposaloutlet{ +/obj/structure/disposalpipe/trunk, +/obj/structure/disposaloutlet/cere{ dir = 1 }, -/obj/structure/disposalpipe/trunk, /turf/simulated/floor/plating/airless, /area/station/maintenance/fsmaint) "ubn" = ( @@ -103131,12 +103122,12 @@ /turf/simulated/floor/plating, /area/station/maintenance/fore) "wlt" = ( -/obj/structure/disposaloutlet{ - dir = 4 - }, /obj/structure/disposalpipe/trunk{ dir = 8 }, +/obj/structure/disposaloutlet/cere{ + dir = 4 + }, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/south) "wly" = ( @@ -106130,10 +106121,10 @@ /obj/structure/disposalpipe/trunk{ dir = 8 }, -/obj/structure/disposaloutlet{ +/obj/structure/lattice/catwalk, +/obj/structure/disposaloutlet/cere{ dir = 4 }, -/obj/structure/lattice/catwalk, /turf/space, /area/space/nearstation) "wUw" = ( @@ -110824,10 +110815,10 @@ }, /area/station/hallway/primary/starboard/south) "ycO" = ( -/obj/structure/disposaloutlet{ +/obj/structure/disposalpipe/trunk, +/obj/structure/disposaloutlet/cere{ dir = 1 }, -/obj/structure/disposalpipe/trunk, /turf/simulated/floor/plating/airless, /area/station/maintenance/disposal/east) "ydd" = ( @@ -147844,7 +147835,7 @@ rNK abL rNK aoR -apW +dhy aoR cRv cRv diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 39024cc6571..208907535b2 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -841,7 +841,7 @@ damage_deflection = 10 flags_2 = RAD_PROTECT_CONTENTS_2 | RAD_NO_CONTAMINATE_2 plane = FLOOR_PLANE - layer = DISPOSAL_PIPE_LAYER // slightly lower than wires and other pipes + layer = CLOSED_TURF_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 @@ -1297,6 +1297,11 @@ if(H2 && !H2.active) H.merge(H2) H.forceMove(P) + if(loc) + loc.color = initial(loc.color) + else + color = initial(color) + else // if wasn't a pipe, then set loc to turf H.forceMove(T) return null @@ -1383,7 +1388,7 @@ /obj/structure/disposalpipe/trunk/Destroy() if(istype(linked, /obj/structure/disposaloutlet)) var/obj/structure/disposaloutlet/O = linked - O.expel(animation = 0) + O.expel_all_contents_immediately() else if(istype(linked, /obj/machinery/disposal)) var/obj/machinery/disposal/D = linked if(D.trunk == src) @@ -1456,7 +1461,6 @@ AM.forceMove(DO) qdel(H) H.vent_gas(loc) - DO.expel() else if(istype(linked, /obj/machinery/disposal)) var/obj/machinery/disposal/D = linked H.forceMove(D) @@ -1509,49 +1513,79 @@ var/mode = FALSE // Is the maintenance panel open? Different than normal disposal's mode /// The last time a sound was played var/last_sound + var/delay_large_object_expel_enabled = FALSE + COOLDOWN_DECLARE(large_object_expel_cooldown) + var/list/delayed_objects = list( + /obj/structure/closet, + /obj/structure/big_delivery, + ) /obj/structure/disposaloutlet/Initialize(mapload) . = ..() addtimer(CALLBACK(src, PROC_REF(setup)), 0) // Wait of 0, but this wont actually do anything until the MC is firing - /obj/structure/disposaloutlet/proc/setup() target = get_ranged_target_turf(src, dir, 10) var/obj/structure/disposalpipe/trunk/T = locate() in get_turf(src) if(T) T.nicely_link_to_other_stuff(src) + START_PROCESSING(SSobj, src) + +/obj/structure/disposaloutlet/multitool_act(mob/living/user, obj/item/I) + to_chat(user, "You [delay_large_object_expel_enabled ? "disable" : "enable"] the delay between large objects leaving the disposal outlet.") + delay_large_object_expel_enabled = !delay_large_object_expel_enabled + +/obj/structure/disposaloutlet/process() + var/list/expelled_contents = list() + for(var/atom/movable/AM in contents) + if(delay_large_object_expel_enabled && is_type_in_list(AM, delayed_objects)) + if(COOLDOWN_FINISHED(src, large_object_expel_cooldown)) + COOLDOWN_START(src, large_object_expel_cooldown, 5 SECONDS) + expelled_contents += AM + else + expelled_contents += AM + + if(length(expelled_contents)) + play_animation() + for(var/atom/movable/AM in expelled_contents) + expel_atom(AM) /obj/structure/disposaloutlet/Destroy() if(linkedtrunk) linkedtrunk.remove_trunk_links() - expel(FALSE) + expel_all_contents_immediately() return ..() - -// expel the contents of the outlet -/obj/structure/disposaloutlet/proc/expel(animation = TRUE) - if(animation) - flick("outlet-open", src) - 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, FALSE, FALSE) - sleep(20) //wait until correct animation frame - if(play_sound) - playsound(src, 'sound/machines/hiss.ogg', 50, FALSE, FALSE) +/obj/structure/disposaloutlet/proc/expel_all_contents_immediately() for(var/atom/movable/AM in contents) - AM.forceMove(loc) - AM.pipe_eject(dir) - if(QDELETED(AM)) + expel_atom(AM) + +/obj/structure/disposaloutlet/proc/expel_atom(atom/movable/AM) + if(!(AM in contents)) + return + + AM.forceMove(loc) + AM.pipe_eject(dir) + if(QDELETED(AM)) + return + if(isliving(AM)) + var/mob/living/mob_to_immobilize = AM + if(isdrone(mob_to_immobilize) || istype(mob_to_immobilize, /mob/living/silicon/robot/syndicate/saboteur)) //Drones keep smashing windows from being fired out of chutes. Bad for the station. ~Z return - if(isliving(AM)) - var/mob/living/mob_to_immobilize = AM - if(isdrone(mob_to_immobilize) || istype(mob_to_immobilize, /mob/living/silicon/robot/syndicate/saboteur)) //Drones keep smashing windows from being fired out of chutes. Bad for the station. ~Z - return - mob_to_immobilize.Immobilize(1 SECONDS) - AM.throw_at(target, 3, 1) + mob_to_immobilize.Immobilize(1 SECONDS) + AM.throw_at(target, 3, 1) + +/obj/structure/disposaloutlet/proc/play_animation() + flick("outlet-open", src) + 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, FALSE, FALSE) + sleep(20) //wait until correct animation frame + if(play_sound) + playsound(src, 'sound/machines/hiss.ogg', 50, FALSE, FALSE) /obj/structure/disposaloutlet/screwdriver_act(mob/living/user, obj/item/I) add_fingerprint(user) @@ -1601,6 +1635,9 @@ C.density = TRUE qdel(src) +/obj/structure/disposaloutlet/cere + delay_large_object_expel_enabled = TRUE + // called when movable is expelled from a disposal pipe or outlet // by default does nothing, override for special behaviour