[MIRROR] Fixing GBJ cases where the disposal holder is forcemoved outside a pipe. (#1602)

* Fixing GBJ cases where the disposal holder is forcemoved outside a pipe. (#54643)

Title. Also turned movable/pipe_eject() into a comsig, since it was used only for gibs.

* Fixing GBJ cases where the disposal holder is forcemoved outside a pipe.

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-11-07 06:06:41 +01:00
committed by GitHub
parent 7813465ef3
commit 94fe50294d
12 changed files with 87 additions and 66 deletions
+2 -14
View File
@@ -170,10 +170,7 @@
// eject the contents of the disposal unit
/obj/machinery/disposal/proc/eject()
var/turf/T = get_turf(src)
for(var/atom/movable/AM in src)
AM.forceMove(T)
AM.pipe_eject(0)
pipe_eject(src, FALSE, FALSE)
update_icon()
/obj/machinery/disposal/proc/flush()
@@ -206,18 +203,9 @@
/obj/machinery/disposal/proc/expel(obj/structure/disposalholder/H)
H.active = FALSE
var/turf/T = get_turf(src)
var/turf/target
playsound(src, 'sound/machines/hiss.ogg', 50, FALSE, FALSE)
for(var/A in H)
var/atom/movable/AM = A
target = get_offset_target_turf(loc, rand(5)-rand(5), rand(5)-rand(5))
AM.forceMove(T)
AM.pipe_eject(0)
AM.throw_at(target, 5, 1)
pipe_eject(H)
H.vent_gas(loc)
qdel(H)
+12 -23
View File
@@ -1,23 +1,12 @@
// called when movable is expelled from a disposal pipe or outlet
// by default does nothing, override for special behaviour
/atom/movable/proc/pipe_eject(direction)
return
/obj/effect/decal/cleanable/blood/gibs/pipe_eject(direction)
var/list/dirs
if(direction)
dirs = list(direction, turn(direction, -45), turn(direction, 45))
else
dirs = GLOB.alldirs.Copy()
streak(dirs)
/obj/effect/decal/cleanable/robot_debris/gib/pipe_eject(direction)
var/list/dirs
if(direction)
dirs = list(direction, turn(direction, -45), turn(direction, 45))
else
dirs = GLOB.alldirs.Copy()
streak(dirs)
/**
* General proc used to expel a holder's contents through src (for bins holder is also the src).
*/
/obj/proc/pipe_eject(obj/holder, direction, throw_em = TRUE, turf/target, throw_range = 5, throw_speed = 1)
var/turf/src_T = get_turf(src)
for(var/A in holder)
var/atom/movable/AM = A
AM.forceMove(src_T)
SEND_SIGNAL(AM, COMSIG_MOVABLE_PIPE_EJECTING, direction)
if(throw_em && !QDELETED(AM))
var/turf/T = target || get_offset_target_turf(loc, rand(5)-rand(5), rand(5)-rand(5))
AM.throw_at(T, throw_range, throw_speed)
+14 -1
View File
@@ -80,12 +80,25 @@
set_glide_size(DELAY_TO_GLIDE_SIZE(ticks * world.tick_lag))
curr = curr.transfer(src)
if(!curr && active)
last.expel(src, loc, dir)
last.expel(src, get_turf(src), dir)
ticks = stoplag()
if(!(count--))
active = FALSE
//failsafe in the case the holder is somehow forcemoved somewhere that's not a disposal pipe. Otherwise the above loop breaks.
/obj/structure/disposalholder/Moved(atom/oldLoc, dir)
. = ..()
var/static/list/pipes_typecache = typecacheof(/obj/structure/disposalpipe)
if(!pipes_typecache[loc.type])
var/turf/T = get_turf(loc)
if(T)
vent_gas(T)
for(var/A in contents)
var/atom/movable/AM = A
AM.forceMove(drop_location())
qdel(src)
// find the turf which should contain the next pipe
/obj/structure/disposalholder/proc/nextloc()
return get_step(src, dir)
+1 -1
View File
@@ -23,7 +23,7 @@
if(multiz_dir == MULTIZ_PIPE_DOWN)
T = SSmapping.get_turf_below(get_turf(src))
if(!T)
expel(H)
expel(H, get_turf(src), pick(GLOB.cardinals))
return //Nothing located.
var/obj/structure/disposalpipe/trunk/multiz/pipe = locate(/obj/structure/disposalpipe/trunk/multiz) in T
if(pipe)
+2 -8
View File
@@ -57,15 +57,9 @@
if(!H)
return
var/turf/T = get_turf(src)
pipe_eject(H, dir, TRUE, target, eject_range, throw_range)
for(var/A in H)
var/atom/movable/AM = A
AM.forceMove(T)
AM.pipe_eject(dir)
AM.throw_at(target, eject_range, eject_speed)
H.vent_gas(T)
H.vent_gas(loc)
qdel(H)
/obj/structure/disposaloutlet/welder_act(mob/living/user, obj/item/I)
+11 -16
View File
@@ -69,21 +69,21 @@
var/turf/T = H.nextloc()
var/obj/structure/disposalpipe/P = H.findpipe(T)
if(P)
// find other holder in next loc, if inactive merge it with current
var/obj/structure/disposalholder/H2 = locate() in P
if(H2 && !H2.active)
H.merge(H2)
if(!P) // if there wasn't a pipe, then they'll be expelled.
return
// find other holder in next loc, if inactive merge it with current
var/obj/structure/disposalholder/H2 = locate() in P
if(H2 && !H2.active)
H.merge(H2)
H.forceMove(P)
return P
else // if wasn't a pipe, then they're now in our turf
H.forceMove(get_turf(src))
return null
H.forceMove(P)
return P
// expel the held objects into a turf
// called when there is a break in the pipe
/obj/structure/disposalpipe/proc/expel(obj/structure/disposalholder/H, turf/T, direction)
if(!T)
T = get_turf(src)
var/turf/target
var/eject_range = 5
var/turf/open/floor/floorturf
@@ -106,12 +106,7 @@
target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5))
playsound(src, 'sound/machines/hiss.ogg', 50, FALSE, FALSE)
for(var/A in H)
var/atom/movable/AM = A
AM.forceMove(get_turf(src))
AM.pipe_eject(direction)
if(target)
AM.throw_at(target, eject_range, 1)
pipe_eject(H, direction, TRUE, target, eject_range)
H.vent_gas(T)
qdel(H)
@@ -19,8 +19,6 @@
/obj/structure/disposalpipe/sorting/proc/check_sorting(obj/structure/disposalholder/H)
return FALSE
// Mail sorting junction, uses package tags to sort objects.
/obj/structure/disposalpipe/sorting/mail
flip_type = /obj/structure/disposalpipe/sorting/mail/flip