mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
Fixes RPD/disposals exploits
Also removes a bit of copy-paste and speeds up a helper slightly. Fixes #13473 Fixes #14654
This commit is contained in:
@@ -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 << "<span class='notice'>You detach the [nicetype] from the underfloor.</span>"
|
||||
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 << "<span class='notice'>You attach the [nicetype] to the underfloor.</span>"
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
update()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user