[s] Fixes RPDs qdel'ing girders and causing runtimes (#32567)

* fixes qdeling girders and lattices with RPDs and other weird edge cases

* thanks mom the shitcode's cleaner now

* 👍
This commit is contained in:
deathride58
2017-11-10 23:55:08 +00:00
committed by CitadelStationBot
parent 70e9eeb8fd
commit 59f654f8b9
+10 -5
View File
@@ -546,13 +546,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
A = get_turf(user)
//make sure what we're clicking is valid for the current mode
var/is_paintable = (p_class == PAINT_MODE && istype(A, /obj/machinery/atmospherics/pipe))
var/is_consumable = (p_class == EATING_MODE && (istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct)))
var/can_make_pipe = ((atmos_piping_mode || p_class == DISPOSALS_MODE) && (isturf(A)) || istype(A, /obj/structure/lattice) || istype(A, /obj/structure/girder))
if(!is_paintable && !is_consumable && !can_make_pipe)
return ..()
//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
@@ -561,6 +556,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
. = FALSE
switch(p_class) //if we've gotten this var, the target is valid
if(PAINT_MODE) //Paint pipes
if(!istype(A, /obj/machinery/atmospherics/pipe))
return ..()
var/obj/machinery/atmospherics/pipe/P = A
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
P.paint(paint_colors[paint_color])
@@ -568,6 +565,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
return
if(EATING_MODE) //Eating pipes
if(!(istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct)))
return ..()
to_chat(user, "<span class='notice'>You start destroying a pipe...</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2, target = A))
@@ -575,6 +574,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
qdel(A)
if(ATMOS_MODE) //Making pipes
if(!can_make_pipe)
return ..()
to_chat(user, "<span class='notice'>You start building a pipe...</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2, target = A))
@@ -599,6 +600,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
P.setPipingLayer(piping_layer)
if(METER_MODE) //Making pipe meters
if(!can_make_pipe)
return ..()
to_chat(user, "<span class='notice'>You start building a meter...</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 2, target = A))
@@ -610,6 +613,8 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
PM.setAttachLayer(piping_layer)
if(DISPOSALS_MODE) //Making disposals pipes
if(!can_make_pipe)
return ..()
if(isclosedturf(A))
to_chat(user, "<span class='warning'>\the [src]'s error light flickers; there's something in the way!</span>")
return