Merge pull request #4876 from Citadel-Station-13/upstream-merge-34429
[MIRROR] Fix RPD embedding fixtures inside lattices and girders
This commit is contained in:
@@ -272,26 +272,24 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
|
||||
if(!user.IsAdvancedToolUser() || istype(A, /turf/open/space/transit))
|
||||
return ..()
|
||||
|
||||
var/atmos_piping_mode = mode == ATMOS_MODE || mode == METER_MODE
|
||||
var/temp_piping_layer
|
||||
if(atmos_piping_mode)
|
||||
if(istype(A, /obj/machinery/atmospherics))
|
||||
var/obj/machinery/atmospherics/AM = A
|
||||
temp_piping_layer = AM.piping_layer
|
||||
A = get_turf(user)
|
||||
|
||||
var/static/list/make_pipe_whitelist
|
||||
if(!make_pipe_whitelist)
|
||||
make_pipe_whitelist = list(/obj/structure/lattice, /obj/structure/girder, /obj/item/pipe)
|
||||
|
||||
//make sure what we're clicking is valid for the current mode
|
||||
var/can_make_pipe = (atmos_piping_mode || mode == DISPOSALS_MODE) && (isturf(A) || is_type_in_list(A, make_pipe_whitelist))
|
||||
|
||||
//So that changing the menu settings doesn't affect the pipes already being built.
|
||||
var/temp_piping_layer = piping_layer
|
||||
var/queued_p_type = recipe.id
|
||||
var/queued_p_dir = p_dir
|
||||
var/queued_p_flipped = p_flipped
|
||||
|
||||
// clicking on an existing component puts the new one on the same layer
|
||||
if ((mode == ATMOS_MODE || mode == METER_MODE) && istype(A, /obj/machinery/atmospherics))
|
||||
var/obj/machinery/atmospherics/AM = A
|
||||
temp_piping_layer = AM.piping_layer
|
||||
A = get_turf(user)
|
||||
|
||||
//make sure what we're clicking is valid for the current mode
|
||||
var/static/list/make_pipe_whitelist
|
||||
if(!make_pipe_whitelist)
|
||||
make_pipe_whitelist = typecacheof(list(/obj/structure/lattice, /obj/structure/girder, /obj/item/pipe))
|
||||
var/can_make_pipe = (isturf(A) || is_type_in_typecache(A, make_pipe_whitelist))
|
||||
|
||||
. = FALSE
|
||||
switch(mode) //if we've gotten this var, the target is valid
|
||||
if(PAINT_MODE) //Paint pipes
|
||||
@@ -323,7 +321,7 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
|
||||
var/obj/machinery/atmospherics/path = queued_p_type
|
||||
var/pipe_item_type = initial(path.construction_type) || /obj/item/pipe
|
||||
|
||||
var/obj/item/pipe/P = new pipe_item_type(A, queued_p_type, queued_p_dir)
|
||||
var/obj/item/pipe/P = new pipe_item_type(get_turf(A), queued_p_type, queued_p_dir)
|
||||
|
||||
if(queued_p_flipped && istype(P, /obj/item/pipe/trinary/flippable))
|
||||
var/obj/item/pipe/trinary/flippable/F = P
|
||||
@@ -331,10 +329,7 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
|
||||
|
||||
P.update()
|
||||
P.add_fingerprint(usr)
|
||||
if(!isnull(temp_piping_layer))
|
||||
P.setPipingLayer(temp_piping_layer)
|
||||
else
|
||||
P.setPipingLayer(piping_layer)
|
||||
P.setPipingLayer(temp_piping_layer)
|
||||
P.add_atom_colour(GLOB.pipe_paint_colors[paint_color], FIXED_COLOUR_PRIORITY)
|
||||
|
||||
if(METER_MODE) //Making pipe meters
|
||||
@@ -345,14 +340,12 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
|
||||
if(do_after(user, 2, target = A))
|
||||
activate()
|
||||
var/obj/item/pipe_meter/PM = new /obj/item/pipe_meter(get_turf(A))
|
||||
if(!isnull(temp_piping_layer))
|
||||
PM.setAttachLayer(temp_piping_layer)
|
||||
else
|
||||
PM.setAttachLayer(piping_layer)
|
||||
PM.setAttachLayer(temp_piping_layer)
|
||||
|
||||
if(DISPOSALS_MODE) //Making disposals pipes
|
||||
if(!can_make_pipe)
|
||||
return ..()
|
||||
A = get_turf(A)
|
||||
if(isclosedturf(A))
|
||||
to_chat(user, "<span class='warning'>[src]'s error light flickers; there's something in the way!</span>")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user