diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 163ff45a635..fa3244f4b4f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -613,12 +613,22 @@ Turf and target are seperate in case you want to teleport some distance from a t return 1 /proc/is_blocked_turf(turf/T) - var/cant_pass = 0 - if(T.density) cant_pass = 1 - for(var/atom/A in T) - if(A.density)//&&A.anchored - cant_pass = 1 - return cant_pass + if(T.density) + return 1 + for(var/i in T) + var/atom/A = i + if(A.density) + return 1 + return 0 + +/proc/is_anchored_dense_turf(turf/T) //like the older version of the above, fails only if also anchored + if(T.density) + return 1 + for(var/i in T) + var/atom/movable/A = i + if(A.density && A.anchored) + return 1 + return 0 /proc/get_step_towards2(atom/ref , atom/trg) var/base_dir = get_dir(ref, get_step_towards(ref,trg)) diff --git a/code/game/objects/items/weapons/RPD.dm b/code/game/objects/items/weapons/RPD.dm index 320adf21ed8..18a49025893 100644 --- a/code/game/objects/items/weapons/RPD.dm +++ b/code/game/objects/items/weapons/RPD.dm @@ -529,7 +529,7 @@ var/global/list/RPD_recipes=list( if(istype(A,/area/shuttle)||istype(A,/turf/space/transit)) return 0 - + //So that changing the menu settings doesn't affect the pipes already being built. var/queued_p_type = p_type var/queued_p_dir = p_dir @@ -592,7 +592,7 @@ var/global/list/RPD_recipes=list( return 0 if(DISPOSALS_MODE) - if(!(istype(A, /turf))) + if(!isturf(A) || is_anchored_dense_turf(A)) user << "The [src]'s error light flickers!" return 0 user << "You start building pipes..." diff --git a/code/modules/recycling/disposal-construction.dm b/code/modules/recycling/disposal-construction.dm index b1227bb5b80..d01854ccbb9 100644 --- a/code/modules/recycling/disposal-construction.dm +++ b/code/modules/recycling/disposal-construction.dm @@ -24,8 +24,6 @@ ..(loc) if(pipe_type) ptype = pipe_type - if(!is_pipe()) // bins/chutes/outlets are dense - density = 1 dir = direction // update iconstate and dpdir due to dir and type @@ -199,9 +197,7 @@ anchored = 0 if(ispipe) level = 2 - density = 0 - else - density = 1 + density = 0 user << "You detach the [nicetype] from the underfloor." else if(!is_pipe()) // Disposal or outlet @@ -224,9 +220,7 @@ anchored = 1 if(ispipe) level = 1 // We don't want disposal bins to disappear under the floors - density = 0 - else - density = 1 // We don't want disposal bins or outlets to go density 0 + density = 0 user << "You attach the [nicetype] to the underfloor." playsound(loc, 'sound/items/Ratchet.ogg', 100, 1) update() diff --git a/code/modules/recycling/disposal-structures.dm b/code/modules/recycling/disposal-structures.dm index d818c88567c..dc7413383cf 100644 --- a/code/modules/recycling/disposal-structures.dm +++ b/code/modules/recycling/disposal-structures.dm @@ -211,6 +211,9 @@ // /obj/structure/disposalpipe/proc/transfer(obj/structure/disposalholder/H) var/nextdir = nextdir(H.dir) + transfer_to_dir(H, nextdir) + +/obj/structure/disposalpipe/proc/transfer_to_dir(obj/structure/disposalholder/H, nextdir) H.dir = nextdir var/turf/T = H.nextloc() var/obj/structure/disposalpipe/P = H.findpipe(T) @@ -222,13 +225,11 @@ H.merge(H2) H.loc = P - else // if wasn't a pipe, then set loc to turf - H.loc = T + return P + else // if wasn't a pipe, then they're now in our turf + H.loc = get_turf(src) return null - return P - - // update the icon_state to reflect hidden status /obj/structure/disposalpipe/proc/update() var/turf/T = src.loc @@ -533,23 +534,7 @@ /obj/structure/disposalpipe/sortjunction/transfer(obj/structure/disposalholder/H) var/nextdir = nextdir(H.dir, H.destinationTag) - H.dir = nextdir - 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) - - H.loc = P - else // if wasn't a pipe, then set loc to turf - H.loc = T - return null - - return P - + transfer_to_dir(H, nextdir) //a three-way junction that sorts objects destined for the mail office mail table (tomail = 1) /obj/structure/disposalpipe/wrapsortjunction @@ -594,26 +579,7 @@ /obj/structure/disposalpipe/wrapsortjunction/transfer(obj/structure/disposalholder/H) var/nextdir = nextdir(H.dir, H.tomail) - H.dir = nextdir - 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) - - H.loc = P - else // if wasn't a pipe, then set loc to turf - H.loc = T - return null - - return P - - - - + transfer_to_dir(H, nextdir) //a trunk joining to a disposal bin or outlet on the same turf /obj/structure/disposalpipe/trunk @@ -701,7 +667,6 @@ // transfer to linked object (outlet or bin) /obj/structure/disposalpipe/trunk/transfer(obj/structure/disposalholder/H) - if(H.dir == DOWN) // we just entered from a disposer return ..() // so do base transfer proc // otherwise, go to the linked object @@ -715,11 +680,9 @@ D.expel(H) // expel at disposal else if(H) - src.expel(H, src.loc, 0) // expel at turf + src.expel(H, get_turf(src), 0) // expel at turf return null - // nextdir - /obj/structure/disposalpipe/trunk/nextdir(fromdir) if(fromdir == DOWN) return dir