diff --git a/code/ATMOSPHERICS/pipes/simple/pipe_simple.dm b/code/ATMOSPHERICS/pipes/simple/pipe_simple.dm index c3d1762b993..8ffaf98aa79 100644 --- a/code/ATMOSPHERICS/pipes/simple/pipe_simple.dm +++ b/code/ATMOSPHERICS/pipes/simple/pipe_simple.dm @@ -43,31 +43,32 @@ if(SOUTHWEST) initialize_directions = SOUTH|WEST -/obj/machinery/atmospherics/pipe/simple/initialize() +/obj/machinery/atmospherics/pipe/simple/initialize(initPipe = 1) ..() - normalize_dir() - var/N = 2 - for(var/D in cardinal) - if(D & initialize_directions) - N-- - for(var/obj/machinery/atmospherics/target in get_step(src, D)) - if(target.initialize_directions & get_dir(target,src)) - var/c = check_connect_types(target,src) - if(!c) - continue - if(!node1 && N == 1) - target.connected_to = c - connected_to = c - node1 = target - break - if(!node2 && N == 0) - target.connected_to = c - connected_to = c - node2 = target - break - var/turf/T = loc // hide if turf is not intact - hide(T.intact) - update_icon() + if(initPipe) + normalize_dir() + var/N = 2 + for(var/D in cardinal) + if(D & initialize_directions) + N-- + for(var/obj/machinery/atmospherics/target in get_step(src, D)) + if(target.initialize_directions & get_dir(target,src)) + var/c = check_connect_types(target,src) + if(!c) + continue + if(!node1 && N == 1) + target.connected_to = c + connected_to = c + node1 = target + break + if(!node2 && N == 0) + target.connected_to = c + connected_to = c + node2 = target + break + var/turf/T = loc // hide if turf is not intact + hide(T.intact) + update_icon() /obj/machinery/atmospherics/pipe/simple/check_pressure(pressure) var/datum/gas_mixture/environment = loc.return_air() diff --git a/code/ATMOSPHERICS/pipes/simple/pipe_simple_he.dm b/code/ATMOSPHERICS/pipes/simple/pipe_simple_he.dm index d61126b1414..ce6974e9da4 100644 --- a/code/ATMOSPHERICS/pipes/simple/pipe_simple_he.dm +++ b/code/ATMOSPHERICS/pipes/simple/pipe_simple_he.dm @@ -59,21 +59,23 @@ initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe color = "#404040" -/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize() - normalize_dir() - var/N = 2 - for(var/D in cardinal) - if(D & initialize_directions_he) - N-- - for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src, D)) - if(target.initialize_directions_he & get_dir(target,src)) - if(!node1 && N == 1) - node1 = target - break - if(!node2 && N == 0) - node2 = target - break - update_icon() +/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize(initPipe = 1) + ..(0) + if(initPipe) + normalize_dir() + var/N = 2 + for(var/D in cardinal) + if(D & initialize_directions_he) + N-- + for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src, D)) + if(target.initialize_directions_he & get_dir(target,src)) + if(!node1 && N == 1) + node1 = target + break + if(!node2 && N == 0) + node2 = target + break + update_icon() /obj/machinery/atmospherics/pipe/simple/heat_exchanging/hidden level=1 @@ -107,6 +109,7 @@ initialize_directions_he = WEST /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize() + ..(0) for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions)) if(target.initialize_directions & get_dir(target,src)) node1 = target @@ -116,10 +119,6 @@ node2 = target break - if(!node1 && !node2) - qdel(src) - return - update_icon() return diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 9815035311e..11361034fbb 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -262,9 +262,15 @@ if(istype(triP) && triP.flipped) icon_state = "m_[icon_state]" -//called when a turf is attacked with a pipe item -// place the pipe on the turf, setting pipe level to 1 (underfloor) if the turf is not intact - +// called by turf to know if should treat as bent or not on placement +/obj/item/pipe/proc/is_bent_pipe() + return pipe_type in list( \ + PIPE_SIMPLE_BENT, \ + PIPE_HE_BENT, \ + PIPE_INSULATED_BENT, \ + PIPE_SUPPLY_BENT, \ + PIPE_SCRUBBERS_BENT) + // rotate the pipe item clockwise /obj/item/pipe/verb/rotate() @@ -305,7 +311,7 @@ /obj/item/pipe/Move() ..() - if ((pipe_type in list (PIPE_SIMPLE_BENT, PIPE_SUPPLY_BENT, PIPE_SCRUBBERS_BENT, PIPE_HE_BENT, PIPE_INSULATED_BENT)) \ + if (is_bent_pipe() \ && (src.dir in cardinal)) src.dir = src.dir|turn(src.dir, 90) else if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE, PIPE_DVALVE)) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 9b2e9b7064d..c24482a0da4 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -578,16 +578,14 @@ var/list/wood_icons = list("wood","wood-broken") user << "You need more welding fuel to complete this task." if(istype(C,/obj/item/pipe)) - var/obj/item/pipe/V = C - if(V.pipe_type != -1) // ANY PIPE - var/obj/item/pipe/P = C - + var/obj/item/pipe/P = C + if(P.pipe_type != -1) // ANY PIPE user.visible_message( \ "[user] starts sliding [P] along \the [src].", \ "You slide [P] along \the [src].", \ "You hear the scrape of metal against something.") user.drop_item() - if (P.pipe_type in list (1,3,12)) // bent pipe rotation fix see construction.dm + if (P.is_bent_pipe()) // bent pipe rotation fix see construction.dm P.dir = 5 if (user.dir == 1) P.dir = 6 @@ -595,8 +593,6 @@ var/list/wood_icons = list("wood","wood-broken") P.dir = 9 if (user.dir == 4) P.dir = 10 - if (user.dir == 5) - P.dir = 8 else P.dir = user.dir P.x = src.x