diff --git a/code/modules/atmospherics/machinery/pipes/mapping.dm b/code/modules/atmospherics/machinery/pipes/mapping.dm index 51d9c707185..c23f8cacd94 100644 --- a/code/modules/atmospherics/machinery/pipes/mapping.dm +++ b/code/modules/atmospherics/machinery/pipes/mapping.dm @@ -17,6 +17,14 @@ piping_layer = 4; \ icon_state = Iconbase + "-4"; \ } \ + ##Fulltype/visible/layer1 { \ + piping_layer = 1; \ + icon_state = Iconbase + "-1"; \ + } \ + ##Fulltype/visible/layer5 { \ + piping_layer = 5; \ + icon_state = Iconbase + "-5"; \ + } \ ##Fulltype/hidden { \ hide = TRUE; \ } \ @@ -27,6 +35,14 @@ ##Fulltype/hidden/layer4 { \ piping_layer = 4; \ icon_state = Iconbase + "-4"; \ + } \ + ##Fulltype/hidden/layer1 { \ + piping_layer = 1; \ + icon_state = Iconbase + "-1"; \ + } \ + ##Fulltype/hidden/layer5 { \ + piping_layer = 5; \ + icon_state = Iconbase + "-5"; \ } #define HELPER_PARTIAL_NAMED(Fulltype, Iconbase, Name, Color) \ @@ -38,12 +54,14 @@ #define HELPER(Type, Color) \ HELPER_PARTIAL(/obj/machinery/atmospherics/pipe/simple/##Type, "pipe11", Color) \ HELPER_PARTIAL(/obj/machinery/atmospherics/pipe/manifold/##Type, "manifold", Color) \ - HELPER_PARTIAL(/obj/machinery/atmospherics/pipe/manifold4w/##Type, "manifold4w", Color) + HELPER_PARTIAL(/obj/machinery/atmospherics/pipe/manifold4w/##Type, "manifold4w", Color) \ + HELPER_PARTIAL(/obj/effect/mapping_helpers/simple_pipes/##Type,"pipe",Color) #define HELPER_NAMED(Type, Name, Color) \ HELPER_PARTIAL_NAMED(/obj/machinery/atmospherics/pipe/simple/##Type, "pipe11", Name, Color) \ HELPER_PARTIAL_NAMED(/obj/machinery/atmospherics/pipe/manifold/##Type, "manifold", Name, Color) \ - HELPER_PARTIAL_NAMED(/obj/machinery/atmospherics/pipe/manifold4w/##Type, "manifold4w", Name, Color) + HELPER_PARTIAL_NAMED(/obj/machinery/atmospherics/pipe/manifold4w/##Type, "manifold4w", Name, Color) \ + HELPER_PARTIAL_NAMED(/obj/effect/mapping_helpers/simple_pipes/##Type,"pipe", Name, Color) HELPER(general, null) HELPER(yellow, rgb(255, 198, 0)) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index cf3a2e8ba51..d7f0fad69e3 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -381,6 +381,77 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) log_mapping("[src] at [x],[y] could not find an airlock on current turf, cannot place paper note.") qdel(src) +/obj/effect/mapping_helpers/simple_pipes + name = "Simple Pipes" + late = TRUE + icon_state = "pipe-3" + var/piping_layer = 3 + var/pipe_color = "" + var/connection_num = 0 + var/hide = FALSE + +/obj/effect/mapping_helpers/simple_pipes/LateInitialize() + var/list/connections = list( dir2text(NORTH) = FALSE, dir2text(SOUTH) = FALSE , dir2text(EAST) = FALSE , dir2text(WEST) = FALSE) + var/list/valid_connectors = typecacheof(/obj/machinery/atmospherics) + for(var/direction in connections) + var/turf/T = get_step(src, text2dir(direction)) + for(var/machine_type_owo in T.contents) + if(istype(machine_type_owo,type)) + var/obj/effect/mapping_helpers/simple_pipes/found = machine_type_owo + if(found.piping_layer != piping_layer) + continue + connections[direction] = TRUE + connection_num++ + break + if(!is_type_in_typecache(machine_type_owo,valid_connectors)) + continue + var/obj/machinery/atmospherics/machine = machine_type_owo + + if(machine.piping_layer != piping_layer) + continue + + if(angle2dir(dir2angle(text2dir(direction))+180) & machine.initialize_directions) + connections[direction] = TRUE + connection_num++ + break + + switch(connection_num) + if(1) + for(var/direction in connections) + if(connections[direction] != TRUE) + continue + spawn_pipe(direction,/obj/machinery/atmospherics/pipe/simple) + if(2) + for(var/direction in connections) + if(connections[direction] != TRUE) + continue + //Detects straight pipes connected from east to west , north to south etc. + if(connections[dir2text(angle2dir(dir2angle(text2dir(direction))+180))] == TRUE) + spawn_pipe(direction,/obj/machinery/atmospherics/pipe/simple) + break + + for(var/direction2 in connections - direction) + if(connections[direction2] != TRUE) + continue + spawn_pipe(dir2text(text2dir(direction)+text2dir(direction2)),/obj/machinery/atmospherics/pipe/simple) + if(3) + for(var/direction in connections) + if(connections[direction] == FALSE) + spawn_pipe(direction,/obj/machinery/atmospherics/pipe/manifold) + if(4) + spawn_pipe(dir2text(NORTH),/obj/machinery/atmospherics/pipe/manifold4w) + + qdel(src) + +//spawn pipe +/obj/effect/mapping_helpers/simple_pipes/proc/spawn_pipe(direction,type ) + var/obj/machinery/atmospherics/pipe/pipe = new type(get_turf(src),TRUE,text2dir(direction)) + pipe.hide = hide + pipe.piping_layer = piping_layer + pipe.update_layer() + pipe.paint(pipe_color) + + //This helper applies traits to things on the map directly. /obj/effect/mapping_helpers/trait_injector name = "Trait Injector" @@ -419,3 +490,4 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) if(!matches_found) stack_trace("Trait mapper found no targets at ([x], [y], [z]). First Match Only: [first_match_only ? "true" : "false"] target type: [target_type] | target name: [target_name] | trait name: [trait_name]") qdel(src) + diff --git a/icons/effects/mapping_helpers.dmi b/icons/effects/mapping_helpers.dmi index a1afaf1c724..ca424ac84a3 100644 Binary files a/icons/effects/mapping_helpers.dmi and b/icons/effects/mapping_helpers.dmi differ