mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
[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:
@@ -145,7 +145,7 @@
|
||||
/turf/open/floor/mineral/titanium/blue,
|
||||
/area/ruin/space/has_grav/powered/mechtransport)
|
||||
"K" = (
|
||||
/obj/effect/decal/cleanable/robot_debris/gib,
|
||||
/obj/effect/decal/cleanable/robot_debris,
|
||||
/turf/open/floor/plating/airless,
|
||||
/area/ruin/space/has_grav/powered/mechtransport)
|
||||
"L" = (
|
||||
|
||||
@@ -285,6 +285,8 @@
|
||||
|
||||
///called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source)
|
||||
#define COMSIG_MOVABLE_DISPOSING "movable_disposing"
|
||||
// called when movable is expelled from a disposal pipe, bin or outlet on obj/pipe_eject: (direction)
|
||||
#define COMSIG_MOVABLE_PIPE_EJECTING "movable_pipe_ejecting"
|
||||
///called when the movable sucessfully has it's anchored var changed, from base atom/movable/set_anchored(): (value)
|
||||
#define COMSIG_MOVABLE_SET_ANCHORED "movable_set_anchored"
|
||||
///from base of atom/movable/setGrabState(): (newstate)
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
random_icon_states = list("xgib1", "xgib2", "xgib3", "xgib4", "xgib5", "xgib6")
|
||||
mergeable_decal = FALSE
|
||||
|
||||
/obj/effect/decal/cleanable/xenoblood/xgibs/Initialize()
|
||||
. = ..()
|
||||
RegisterSignal(src, COMSIG_MOVABLE_PIPE_EJECTING, .proc/on_pipe_eject)
|
||||
|
||||
/obj/effect/decal/cleanable/xenoblood/xgibs/proc/streak(list/directions, mapload=FALSE)
|
||||
set waitfor = FALSE
|
||||
var/direction = pick(directions)
|
||||
@@ -37,6 +41,17 @@
|
||||
if(!step_to(src, get_step(src, direction), 0))
|
||||
break
|
||||
|
||||
/obj/effect/decal/cleanable/xenoblood/xgibs/proc/on_pipe_eject(atom/source, direction)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
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/xenoblood/xgibs/ex_act()
|
||||
return
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
/obj/effect/decal/cleanable/blood/gibs/Initialize(mapload, list/datum/disease/diseases)
|
||||
. = ..()
|
||||
reagents.add_reagent(/datum/reagent/liquidgibs, 5)
|
||||
RegisterSignal(src, COMSIG_MOVABLE_PIPE_EJECTING, .proc/on_pipe_eject)
|
||||
if(already_rotting)
|
||||
start_rotting(rename=FALSE)
|
||||
else
|
||||
@@ -78,6 +79,17 @@
|
||||
playsound(loc, 'sound/effects/gib_step.ogg', HAS_TRAIT(L, TRAIT_LIGHT_STEP) ? 20 : 50, TRUE)
|
||||
. = ..()
|
||||
|
||||
/obj/effect/decal/cleanable/blood/gibs/proc/on_pipe_eject(atom/source, direction)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
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/blood/gibs/proc/streak(list/directions, mapload=FALSE)
|
||||
set waitfor = FALSE
|
||||
var/list/diseases = list()
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
mergeable_decal = FALSE
|
||||
beauty = -50
|
||||
|
||||
/obj/effect/decal/cleanable/robot_debris/Initialize()
|
||||
. = ..()
|
||||
RegisterSignal(src, COMSIG_MOVABLE_PIPE_EJECTING, .proc/on_pipe_eject)
|
||||
|
||||
/obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions, mapload=FALSE)
|
||||
set waitfor = FALSE
|
||||
var/direction = pick(directions)
|
||||
@@ -28,6 +32,17 @@
|
||||
if (!step_to(src, get_step(src, direction), 0))
|
||||
break
|
||||
|
||||
/obj/effect/decal/cleanable/robot_debris/proc/on_pipe_eject(atom/source, direction)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
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/ex_act()
|
||||
return
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user