mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-16 17:43:35 +01:00
Create large package expel delay for disposals. (#28544)
This commit is contained in:
committed by
GitHub
parent
ca6f08bd84
commit
f39fb1f517
@@ -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, "<span class='notice'>You [delay_large_object_expel_enabled ? "disable" : "enable"] the delay between large objects leaving the disposal outlet.</span>")
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user