Rewrite pipe construction

- Moved pipe construction defines into __defines/construction.dm
- Unified pipe *unwrenching* by creating a standard proc along with the `construction_type` var.
- Eliminated the pipe fitting name & icon_state lookup tables by adding `pipe_state` var on atmos machinery and referencing that.
    - Each pipe which can be made from a fitting object should override `pipe_state` with the icon state to be used on the pipe fitting object.
- Eliminated the giant switch statement of doom in pipe construction by delegating that work to `on_construction` proc.
    - To make this work, every pipe must implement `get_neighbor_nodes_for_init` which returns a list of nodes which should be re-initialized on that pipe's construction.
- Combined the SCRUBBERS, SUPPLY and REGULAR pipe fitting classes together by storing the `piping_layer` variable and using the `setPipingLayer` procs
- Standardized the code for searching for node neighbors into the `can_be_node` proc.
    - This proc is also improved in that is a mutual check, `check_connectable` is called on BOTH objects, so they have to mutually agree to connect as nodes. Eliminates lots of special edge case logic.
    - Updated all the `amos_init` procs to use `can_be_node`.  In the most common cases, even that boilerplate code is consolidated into the `STANDARD_ATMOS_CHOOSE_NODE` macro.
- Implemented `pipe_flags` which lets pipes declare (or override) certain requirements.
- Adds a "pipe_recipe" datum to help out things that construct pipes.  By taking it out of the dispenser, we open the road for multiple dispenser types.  No, no RPD yet.  Soon.
    - Enhances the pipe dispenser to operate on pipe recipe datums instead of hard coded lists of pipes it can construct.   These datums are also (partially) initialized from the pipe machine types themselves, reducing having to define stuff in multiple places.
    - Switched pipe dispenser UI to use browse().   Not a NanoUI, but makes it a bit prettier with low effort.
    - Changed pipe dispenser to use a button selector to switch between Regular/Scrubbers/Supply instead of having separate list items.
- Added icon states to HE pipes to support the "connected on neither side" state.
This commit is contained in:
Leshana
2018-03-04 14:40:16 -05:00
parent 70ac478aea
commit 776b221828
44 changed files with 716 additions and 1518 deletions

View File

@@ -15,11 +15,6 @@
#define PIPE_COLOR_BLACK "#444444" #define PIPE_COLOR_BLACK "#444444"
#define PIPE_COLOR_PURPLE "#5c1ec0" #define PIPE_COLOR_PURPLE "#5c1ec0"
#define CONNECT_TYPE_REGULAR 1
#define CONNECT_TYPE_SUPPLY 2
#define CONNECT_TYPE_SCRUBBER 4
#define CONNECT_TYPE_HE 8
var/global/list/pipe_colors = list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "black" = PIPE_COLOR_BLACK, "purple" = PIPE_COLOR_PURPLE) var/global/list/pipe_colors = list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "black" = PIPE_COLOR_BLACK, "purple" = PIPE_COLOR_PURPLE)
/proc/pipe_color_lookup(var/color) /proc/pipe_color_lookup(var/color)

View File

@@ -19,8 +19,12 @@ Pipelines + Other Objects -> Pipe network
layer = 2.4 //under wires with their 2.44 layer = 2.4 //under wires with their 2.44
var/pipe_flags = PIPING_DEFAULT_LAYER_ONLY // Allow other layers by exception basis.
var/connect_types = CONNECT_TYPE_REGULAR var/connect_types = CONNECT_TYPE_REGULAR
var/piping_layer = PIPING_LAYER_DEFAULT // This will replace icon_connect_type at some point ~Leshana
var/icon_connect_type = "" //"-supply" or "-scrubbers" var/icon_connect_type = "" //"-supply" or "-scrubbers"
var/construction_type = null // Type path of the pipe item when this is deconstructed.
var/pipe_state // icon_state as a pipe item
var/initialize_directions = 0 var/initialize_directions = 0
var/pipe_color var/pipe_color
@@ -46,6 +50,10 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/atmospherics/proc/init_dir() /obj/machinery/atmospherics/proc/init_dir()
return return
// Get ALL initialize_directions - Some types (HE pipes etc) combine two vars together for this.
/obj/machinery/atmospherics/proc/get_init_dirs()
return initialize_directions
// Get the direction each node is facing to connect. // Get the direction each node is facing to connect.
// It now returns as a list so it can be fetched nicely, each entry corresponds to node of same number. // It now returns as a list so it can be fetched nicely, each entry corresponds to node of same number.
/obj/machinery/atmospherics/proc/get_node_connect_dirs() /obj/machinery/atmospherics/proc/get_node_connect_dirs()
@@ -59,6 +67,14 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/atmospherics/proc/atmos_init() /obj/machinery/atmospherics/proc/atmos_init()
return return
/** Check if target is an acceptable target to connect as a node from this machine. */
/obj/machinery/atmospherics/proc/can_be_node(obj/machinery/atmospherics/target, node_num)
return (target.initialize_directions & get_dir(target,src)) && check_connectable(target) && target.check_connectable(src)
/** Check if this machine is willing to connect with the target machine. */
/obj/machinery/atmospherics/proc/check_connectable(obj/machinery/atmospherics/target)
return (src.connect_types & target.connect_types)
/obj/machinery/atmospherics/attackby(atom/A, mob/user as mob) /obj/machinery/atmospherics/attackby(atom/A, mob/user as mob)
if(istype(A, /obj/item/device/pipe_painter)) if(istype(A, /obj/item/device/pipe_painter))
return return
@@ -82,12 +98,6 @@ Pipelines + Other Objects -> Pipe network
else else
return 0 return 0
obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/atmos1, obj/machinery/atmospherics/atmos2)
return (atmos1.connect_types & atmos2.connect_types)
/obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/atmospherics/atmos1, obj/item/pipe/pipe2)
return (atmos1.connect_types & pipe2.connect_types)
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0) /obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
if(!istype(icon_manager)) if(!istype(icon_manager))
if(!safety) //to prevent infinite loops if(!safety) //to prevent infinite loops
@@ -146,4 +156,60 @@ obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/a
var/datum/gas_mixture/env_air = loc.return_air() var/datum/gas_mixture/env_air = loc.return_air()
if((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE) if((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
return 0 return 0
return 1 return 1
// Deconstruct into a pipe item.
/obj/machinery/atmospherics/proc/deconstruct()
if(QDELETED(src))
return
if(construction_type)
var/obj/item/pipe/I = new construction_type(loc, null, null, src)
I.setPipingLayer(piping_layer)
transfer_fingerprints_to(I)
qdel(src)
// Return a list of nodes which we should call atmos_init() and build_network() during on_construction()
/obj/machinery/atmospherics/proc/get_neighbor_nodes_for_init()
return null
// Called on construction (i.e from pipe item) but not on initialization
/obj/machinery/atmospherics/proc/on_construction(obj_color, set_layer)
pipe_color = obj_color
setPipingLayer(set_layer)
// TODO - M.connect_types = src.connect_types - Or otherwise copy from item? Or figure it out from piping layer?
var/turf/T = get_turf(src)
level = !T.is_plating() ? 2 : 1
atmos_init()
if(QDELETED(src))
return // TODO - Eventually should get rid of the need for this.
build_network()
var/list/nodes = get_neighbor_nodes_for_init()
for(var/obj/machinery/atmospherics/A in nodes)
A.atmos_init()
A.build_network()
// TODO - Should we do src.build_network() before or after the nodes?
// We've historically done before, but /tg does after. TODO research if there is a difference.
// This sets our piping layer. Hopefully its cool.
/obj/machinery/atmospherics/proc/setPipingLayer(new_layer)
if(pipe_flags & (PIPING_DEFAULT_LAYER_ONLY|PIPING_ALL_LAYER))
new_layer = PIPING_LAYER_DEFAULT
piping_layer = new_layer
// Do it the Polaris way
switch(piping_layer)
if(PIPING_LAYER_SCRUBBER)
icon_state = "[icon_state]-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
layer = 2.38
icon_connect_type = "-scrubbers"
if(PIPING_LAYER_SUPPLY)
icon_state = "[icon_state]-supply"
connect_types = CONNECT_TYPE_SUPPLY
layer = 2.39
icon_connect_type = "-supply"
if(pipe_flags & PIPING_ALL_LAYER)
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER
// Or if we were to do it the TG way...
// pixel_x = PIPE_PIXEL_OFFSET_X(piping_layer)
// pixel_y = PIPE_PIXEL_OFFSET_Y(piping_layer)
// layer = initial(layer) + PIPE_LAYER_OFFSET(piping_layer)

View File

@@ -30,6 +30,9 @@
initialize_directions = EAST|WEST initialize_directions = EAST|WEST
// Housekeeping and pipe network stuff below // Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/binary/get_neighbor_nodes_for_init()
return list(node1, node2)
/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1) if(reference == node1)
network1 = new_network network1 = new_network
@@ -64,17 +67,8 @@
var/node2_connect = dir var/node2_connect = dir
var/node1_connect = turn(dir, 180) var/node1_connect = turn(dir, 180)
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect)) STANDARD_ATMOS_CHOOSE_NODE(1, node1_connect)
if(target.initialize_directions & get_dir(target,src)) STANDARD_ATMOS_CHOOSE_NODE(2, node2_connect)
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
update_icon() update_icon()
update_underlays() update_underlays()

View File

@@ -9,6 +9,7 @@
icon = 'icons/obj/pipes.dmi' icon = 'icons/obj/pipes.dmi'
icon_state = "circ-off" icon_state = "circ-off"
anchored = 0 anchored = 0
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
var/kinetic_efficiency = 0.04 //combined kinetic and kinetic-to-electric efficiency var/kinetic_efficiency = 0.04 //combined kinetic and kinetic-to-electric efficiency
var/volume_ratio = 0.2 var/volume_ratio = 0.2

View File

@@ -24,6 +24,7 @@
idle_power_usage = 150 //internal circuitry, friction losses and stuff idle_power_usage = 150 //internal circuitry, friction losses and stuff
power_rating = 7500 //7500 W ~ 10 HP power_rating = 7500 //7500 W ~ 10 HP
pipe_flags = PIPING_ALL_LAYER
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER //connects to regular, supply and scrubbers pipes connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER //connects to regular, supply and scrubbers pipes
var/pump_direction = 1 //0 = siphoning, 1 = releasing var/pump_direction = 1 //0 = siphoning, 1 = releasing

View File

@@ -5,6 +5,8 @@
/obj/machinery/atmospherics/binary/passive_gate /obj/machinery/atmospherics/binary/passive_gate
icon = 'icons/atmos/passive_gate.dmi' icon = 'icons/atmos/passive_gate.dmi'
icon_state = "map" icon_state = "map"
construction_type = /obj/item/pipe/directional
pipe_state = "passivegate"
level = 1 level = 1
name = "pressure regulator" name = "pressure regulator"
@@ -257,8 +259,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear ratchet.") "You hear ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
#undef REGULATE_NONE #undef REGULATE_NONE
#undef REGULATE_INPUT #undef REGULATE_INPUT

View File

@@ -139,6 +139,9 @@
src.set_dir(turn(src.dir, 90)) src.set_dir(turn(src.dir, 90))
//Goddamn copypaste from binary base class because atmospherics machinery API is not damn flexible //Goddamn copypaste from binary base class because atmospherics machinery API is not damn flexible
get_neighbor_nodes_for_init()
return list(node1, node2)
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1) if(reference == node1)
network1 = new_network network1 = new_network

View File

@@ -15,6 +15,8 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump /obj/machinery/atmospherics/binary/pump
icon = 'icons/atmos/pump.dmi' icon = 'icons/atmos/pump.dmi'
icon_state = "map_off" icon_state = "map_off"
construction_type = /obj/item/pipe/directional
pipe_state = "pump"
level = 1 level = 1
name = "gas pump" name = "gas pump"
@@ -236,5 +238,4 @@ Thus, the two variables affect pump operation are set in New():
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear ratchet.") "You hear ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/binary/pump/high_power /obj/machinery/atmospherics/binary/pump/high_power
icon = 'icons/atmos/volume_pump.dmi' icon = 'icons/atmos/volume_pump.dmi'
icon_state = "map_off" icon_state = "map_off"
construction_type = /obj/item/pipe/directional
pipe_state = "volumepump"
level = 1 level = 1
name = "high power gas pump" name = "high power gas pump"

View File

@@ -4,6 +4,7 @@
/obj/machinery/atmospherics/omni/atmos_filter /obj/machinery/atmospherics/omni/atmos_filter
name = "omni gas filter" name = "omni gas filter"
icon_state = "map_filter" icon_state = "map_filter"
pipe_state = "omni_filter"
var/list/atmos_filters = new() var/list/atmos_filters = new()
var/datum/omni_port/input var/datum/omni_port/input

View File

@@ -4,6 +4,7 @@
/obj/machinery/atmospherics/omni/mixer /obj/machinery/atmospherics/omni/mixer
name = "omni gas mixer" name = "omni gas mixer"
icon_state = "map_mixer" icon_state = "map_mixer"
pipe_state = "omni_mixer"
use_power = 1 use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff idle_power_usage = 150 //internal circuitry, friction losses and stuff

View File

@@ -7,6 +7,7 @@
icon_state = "base" icon_state = "base"
use_power = 1 use_power = 1
initialize_directions = 0 initialize_directions = 0
construction_type = /obj/item/pipe/quaternary
level = 1 level = 1
var/configuring = 0 var/configuring = 0
@@ -93,8 +94,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
/obj/machinery/atmospherics/omni/can_unwrench() /obj/machinery/atmospherics/omni/can_unwrench()
var/int_pressure = 0 var/int_pressure = 0
@@ -222,6 +222,11 @@
// Housekeeping and pipe network stuff below // Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/omni/get_neighbor_nodes_for_init()
var/list/neighbor_nodes = list()
for(var/datum/omni_port/P in ports)
neighbor_nodes += P.node
return neighbor_nodes
/obj/machinery/atmospherics/omni/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/omni/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
for(var/datum/omni_port/P in ports) for(var/datum/omni_port/P in ports)
@@ -252,10 +257,9 @@
if(P.node || P.mode == 0) if(P.node || P.mode == 0)
continue continue
for(var/obj/machinery/atmospherics/target in get_step(src, P.dir)) for(var/obj/machinery/atmospherics/target in get_step(src, P.dir))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) P.node = target
P.node = target break
break
for(var/datum/omni_port/P in ports) for(var/datum/omni_port/P in ports)
P.update = 1 P.update = 1

View File

@@ -7,6 +7,9 @@
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
construction_type = /obj/item/pipe/directional
pipe_state = "connector"
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
var/obj/machinery/portable_atmospherics/connected_device var/obj/machinery/portable_atmospherics/connected_device
@@ -47,6 +50,9 @@
return 1 return 1
// Housekeeping and pipe network stuff below // Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/portables_connector/get_neighbor_nodes_for_init()
return list(node)
/obj/machinery/atmospherics/portables_connector/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/portables_connector/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node) if(reference == node)
network = new_network network = new_network
@@ -77,10 +83,9 @@
var/node_connect = dir var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) node = target
node = target break
break
update_icon() update_icon()
update_underlays() update_underlays()
@@ -146,5 +151,4 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/trinary/atmos_filter /obj/machinery/atmospherics/trinary/atmos_filter
icon = 'icons/atmos/filter.dmi' icon = 'icons/atmos/filter.dmi'
icon_state = "map" icon_state = "map"
construction_type = /obj/item/pipe/trinary/flippable
pipe_state = "filter"
density = 0 density = 0
level = 1 level = 1

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/trinary/mixer /obj/machinery/atmospherics/trinary/mixer
icon = 'icons/atmos/mixer.dmi' icon = 'icons/atmos/mixer.dmi'
icon_state = "map" icon_state = "map"
construction_type = /obj/item/pipe/trinary/flippable
pipe_state = "mixer"
density = 0 density = 0
level = 1 level = 1
@@ -133,6 +135,8 @@
// //
obj/machinery/atmospherics/trinary/mixer/t_mixer obj/machinery/atmospherics/trinary/mixer/t_mixer
icon_state = "tmap" icon_state = "tmap"
construction_type = /obj/item/pipe/trinary // Can't flip a "T", its symmetrical
pipe_state = "t_mixer"
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH|EAST|WEST initialize_directions = SOUTH|EAST|WEST
tee = TRUE tee = TRUE

View File

@@ -2,6 +2,7 @@
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST initialize_directions = SOUTH|NORTH|WEST
use_power = 0 use_power = 0
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
var/mirrored = FALSE var/mirrored = FALSE
var/tee = FALSE var/tee = FALSE
@@ -64,10 +65,12 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
// Housekeeping and pipe network stuff below // Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/trinary/get_neighbor_nodes_for_init()
return list(node1, node2, node3)
/obj/machinery/atmospherics/trinary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/trinary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1) if(reference == node1)
network1 = new_network network1 = new_network
@@ -113,21 +116,9 @@
var/list/node_connects = get_node_connect_dirs() var/list/node_connects = get_node_connect_dirs()
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[1])) STANDARD_ATMOS_CHOOSE_NODE(1, node_connects[1])
if(target.initialize_directions & get_dir(target,src)) STANDARD_ATMOS_CHOOSE_NODE(2, node_connects[2])
if (check_connect_types(target,src)) STANDARD_ATMOS_CHOOSE_NODE(3, node_connects[3])
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[2]))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[3]))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target
break
update_icon() update_icon()
update_underlays() update_underlays()

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/tvalve /obj/machinery/atmospherics/tvalve
icon = 'icons/atmos/tvalve.dmi' icon = 'icons/atmos/tvalve.dmi'
icon_state = "map_tvalve0" icon_state = "map_tvalve0"
construction_type = /obj/item/pipe/trinary/flippable
pipe_state = "mtvalve"
name = "manual switching valve" name = "manual switching valve"
desc = "A pipe valve" desc = "A pipe valve"
@@ -12,6 +14,7 @@
var/state = 0 // 0 = go straight, 1 = go to side var/state = 0 // 0 = go straight, 1 = go to side
var/mirrored = FALSE var/mirrored = FALSE
var/tee = FALSE // Note: Tee not actually supported for T-valves: no sprites
// like a trinary component, node1 is input, node2 is side output, node3 is straight output // like a trinary component, node1 is input, node2 is side output, node3 is straight output
var/obj/machinery/atmospherics/node3 var/obj/machinery/atmospherics/node3
@@ -47,6 +50,9 @@
/obj/machinery/atmospherics/tvalve/init_dir() /obj/machinery/atmospherics/tvalve/init_dir()
initialize_directions = get_initialize_directions_trinary(dir, mirrored) initialize_directions = get_initialize_directions_trinary(dir, mirrored)
/obj/machinery/atmospherics/tvalve/get_neighbor_nodes_for_init()
return list(node1, node2, node3)
/obj/machinery/atmospherics/tvalve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/tvalve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1) if(reference == node1)
network_node1 = new_network network_node1 = new_network
@@ -178,21 +184,9 @@
var/list/node_connects = get_node_connect_dirs() var/list/node_connects = get_node_connect_dirs()
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[1])) STANDARD_ATMOS_CHOOSE_NODE(1, node_connects[1])
if(target.initialize_directions & get_dir(target,src)) STANDARD_ATMOS_CHOOSE_NODE(2, node_connects[2])
if (check_connect_types(target,src)) STANDARD_ATMOS_CHOOSE_NODE(3, node_connects[3])
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[2]))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[3]))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target
break
update_icon() update_icon()
update_underlays() update_underlays()
@@ -262,6 +256,7 @@
name = "digital switching valve" name = "digital switching valve"
desc = "A digitally controlled valve." desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_tvalve.dmi' icon = 'icons/atmos/digital_tvalve.dmi'
pipe_state = "dtvalve"
var/frequency = 0 var/frequency = 0
var/id = null var/id = null
@@ -348,8 +343,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
/obj/machinery/atmospherics/tvalve/mirrored /obj/machinery/atmospherics/tvalve/mirrored
icon_state = "map_tvalvem0" icon_state = "map_tvalvem0"

View File

@@ -38,18 +38,15 @@
var/node_connect = dir var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src, node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src, node_connect))
if(target.initialize_directions & get_dir(target, src)) if(can_be_node(target, 1))
node = target node = target
break break
//copied from pipe construction code since heaters/freezers don't use fittings and weren't doing this check - this all really really needs to be refactored someday. if(check_for_obstacles())
//check that there are no incompatible pipes/machinery in our own location node = null
for(var/obj/machinery/atmospherics/M in src.loc)
if(M != src && (M.initialize_directions & node_connect) && M.check_connect_types(M,src)) // matches at least one direction on either type of pipe & same connection type
node = null
break
update_icon() if(node)
update_icon()
/obj/machinery/atmospherics/unary/freezer/update_icon() /obj/machinery/atmospherics/unary/freezer/update_icon()
if(node) if(node)

View File

@@ -2,6 +2,7 @@
icon = 'icons/obj/atmospherics/heat_exchanger.dmi' icon = 'icons/obj/atmospherics/heat_exchanger.dmi'
icon_state = "intact" icon_state = "intact"
pipe_state = "heunary"
density = 1 density = 1
name = "Heat Exchanger" name = "Heat Exchanger"
@@ -83,5 +84,4 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)

View File

@@ -39,18 +39,15 @@
//check that there is something to connect to //check that there is something to connect to
for(var/obj/machinery/atmospherics/target in get_step(src, node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src, node_connect))
if(target.initialize_directions & get_dir(target, src)) if(can_be_node(target, 1))
node = target node = target
break break
//copied from pipe construction code since heaters/freezers don't use fittings and weren't doing this check - this all really really needs to be refactored someday. if(check_for_obstacles())
//check that there are no incompatible pipes/machinery in our own location node = null
for(var/obj/machinery/atmospherics/M in src.loc)
if(M != src && (M.initialize_directions & node_connect) && M.check_connect_types(M,src)) // matches at least one direction on either type of pipe & same connection type
node = null
break
update_icon() if(node)
update_icon()
/obj/machinery/atmospherics/unary/heater/update_icon() /obj/machinery/atmospherics/unary/heater/update_icon()

View File

@@ -5,6 +5,7 @@
/obj/machinery/atmospherics/unary/outlet_injector /obj/machinery/atmospherics/unary/outlet_injector
icon = 'icons/atmos/injector.dmi' icon = 'icons/atmos/injector.dmi'
icon_state = "map_injector" icon_state = "map_injector"
pipe_state = "injector"
layer = 3 layer = 3
name = "air injector" name = "air injector"

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/unary /obj/machinery/atmospherics/unary
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
construction_type = /obj/item/pipe/directional
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
//layer = TURF_LAYER+0.1 //layer = TURF_LAYER+0.1
var/datum/gas_mixture/air_contents var/datum/gas_mixture/air_contents
@@ -21,6 +23,9 @@
initialize_directions = dir initialize_directions = dir
// Housekeeping and pipe network stuff below // Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/unary/get_neighbor_nodes_for_init()
return list(node)
/obj/machinery/atmospherics/unary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/unary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node) if(reference == node)
network = new_network network = new_network
@@ -48,10 +53,9 @@
var/node_connect = dir var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) node = target
node = target break
break
update_icon() update_icon()
update_underlays() update_underlays()
@@ -93,4 +97,19 @@
update_icon() update_icon()
update_underlays() update_underlays()
return null return null
// Check if there are any other atmos machines in the same turf that will block this machine from initializing.
// Intended for use when a frame-constructable machine (i.e. not made from pipe fittings) wants to wrench down and connect.
// Returns TRUE if something is blocking, FALSE if its okay to continue.
/obj/machinery/atmospherics/unary/proc/check_for_obstacles()
for(var/obj/machinery/atmospherics/M in loc)
if((M.pipe_flags & pipe_flags & PIPING_ONE_PER_TURF)) //Only one dense/requires density object per tile, eg connectors/cryo/heater/coolers.
visible_message("<span class='warning'>\The [src]'s cannot be connected, something is hogging the tile!</span>")
return TRUE
if((M.piping_layer != piping_layer) && !((M.pipe_flags | flags) & PIPING_ALL_LAYER)) // Pipes on different layers can't block each other unless they are ALL_LAYER
continue
if(M.get_init_dirs() & get_init_dirs()) // matches at least one direction on either type of pipe
visible_message("<span class='warning'>\The [src]'s connector can't be connected, there is already a pipe at that location!</span>")
return TRUE
return FALSE

View File

@@ -10,6 +10,7 @@
/obj/machinery/atmospherics/unary/vent_pump /obj/machinery/atmospherics/unary/vent_pump
icon = 'icons/atmos/vent_pump.dmi' icon = 'icons/atmos/vent_pump.dmi'
icon_state = "map_vent" icon_state = "map_vent"
pipe_state = "uvent"
name = "Air Vent" name = "Air Vent"
desc = "Has a valve and pump attached to it" desc = "Has a valve and pump attached to it"
@@ -410,8 +411,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
#undef DEFAULT_PRESSURE_DELTA #undef DEFAULT_PRESSURE_DELTA

View File

@@ -1,6 +1,7 @@
/obj/machinery/atmospherics/unary/vent_scrubber /obj/machinery/atmospherics/unary/vent_scrubber
icon = 'icons/atmos/vent_scrubber.dmi' icon = 'icons/atmos/vent_scrubber.dmi'
icon_state = "map_scrubber_off" icon_state = "map_scrubber_off"
pipe_state = "scrubber"
name = "Air Scrubber" name = "Air Scrubber"
desc = "Has a valve and pump attached to it" desc = "Has a valve and pump attached to it"
@@ -283,8 +284,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
/obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user) /obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user)
if(..(user, 1)) if(..(user, 1))

View File

@@ -1,6 +1,8 @@
/obj/machinery/atmospherics/valve /obj/machinery/atmospherics/valve
icon = 'icons/atmos/valve.dmi' icon = 'icons/atmos/valve.dmi'
icon_state = "map_valve0" icon_state = "map_valve0"
construction_type = /obj/item/pipe/binary
pipe_state = "mvalve"
name = "manual valve" name = "manual valve"
desc = "A pipe valve" desc = "A pipe valve"
@@ -45,6 +47,9 @@
if(EAST || WEST) if(EAST || WEST)
initialize_directions = EAST|WEST initialize_directions = EAST|WEST
/obj/machinery/atmospherics/valve/get_neighbor_nodes_for_init()
return list(node1, node2)
/obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) /obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1) if(reference == node1)
network_node1 = new_network network_node1 = new_network
@@ -153,16 +158,8 @@
else if (!node2_dir) else if (!node2_dir)
node2_dir = direction node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) STANDARD_ATMOS_CHOOSE_NODE(1, node1_dir)
if(target.initialize_directions & get_dir(target,src)) STANDARD_ATMOS_CHOOSE_NODE(2, node2_dir)
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
build_network() build_network()
@@ -224,6 +221,7 @@
name = "digital valve" name = "digital valve"
desc = "A digitally controlled valve." desc = "A digitally controlled valve."
icon = 'icons/atmos/digital_valve.dmi' icon = 'icons/atmos/digital_valve.dmi'
pipe_state = "dvalve"
var/frequency = 0 var/frequency = 0
var/id = null var/id = null
@@ -306,8 +304,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
qdel(src)
/obj/machinery/atmospherics/valve/examine(mob/user) /obj/machinery/atmospherics/valve/examine(mob/user)
..() ..()

View File

@@ -92,6 +92,9 @@ obj/machinery/atmospherics/mains_pipe
else return 1 else return 1
get_neighbor_nodes_for_init()
return nodes
disconnect() disconnect()
..() ..()
for(var/obj/machinery/atmospherics/pipe/mains_component/node in nodes) for(var/obj/machinery/atmospherics/pipe/mains_component/node in nodes)

View File

@@ -14,6 +14,9 @@
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
construction_type = /obj/item/pipe/directional
pipe_state = "cap"
var/obj/machinery/atmospherics/node var/obj/machinery/atmospherics/node
/obj/machinery/atmospherics/pipe/cap/init_dir() /obj/machinery/atmospherics/pipe/cap/init_dir()
@@ -56,10 +59,9 @@
/obj/machinery/atmospherics/pipe/cap/atmos_init() /obj/machinery/atmospherics/pipe/cap/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src, dir)) for(var/obj/machinery/atmospherics/target in get_step(src, dir))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 1))
if (check_connect_types(target,src)) node = target
node = target break
break
var/turf/T = src.loc // hide if turf is not intact var/turf/T = src.loc // hide if turf is not intact
if(level == 1 && !T.is_plating()) hide(1) if(level == 1 && !T.is_plating()) hide(1)

View File

@@ -8,6 +8,10 @@
color = "#404040" color = "#404040"
level = 2 level = 2
connect_types = CONNECT_TYPE_HE connect_types = CONNECT_TYPE_HE
pipe_flags = PIPING_DEFAULT_LAYER_ONLY
construction_type = /obj/item/pipe/binary/bendable
pipe_state = "he"
layer = 2.41 layer = 2.41
var/initialize_directions_he var/initialize_directions_he
var/surface = 2 //surface area in m^2 var/surface = 2 //surface area in m^2
@@ -27,6 +31,16 @@
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/init_dir() /obj/machinery/atmospherics/pipe/simple/heat_exchanging/init_dir()
..() ..()
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
initialize_directions = 0
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/get_init_dirs()
return ..() | initialize_directions_he
// Use initialize_directions_he to connect to neighbors instead.
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/can_be_node(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target)
if(!istype(target))
return FALSE
return (target.initialize_directions_he & get_dir(target,src)) && check_connectable(target) && target.check_connectable(src)
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/atmos_init() /obj/machinery/atmospherics/pipe/simple/heat_exchanging/atmos_init()
normalize_dir() normalize_dir()
@@ -41,11 +55,11 @@
node2_dir = direction node2_dir = direction
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir)) for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
if(target.initialize_directions_he & get_dir(target,src)) if(can_be_node(target, 1))
node1 = target node1 = target
break break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir)) for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
if(target.initialize_directions_he & get_dir(target,src)) if(can_be_node(target, 2))
node2 = target node2 = target
break break
if(!node1 && !node2) if(!node1 && !node2)
@@ -117,6 +131,8 @@
pipe_icon = "hejunction" pipe_icon = "hejunction"
level = 2 level = 2
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_HE connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_HE
construction_type = /obj/item/pipe/directional
pipe_state = "junction"
minimum_temperature_difference = 300 minimum_temperature_difference = 300
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
@@ -136,6 +152,18 @@
initialize_directions = EAST initialize_directions = EAST
initialize_directions_he = WEST initialize_directions_he = WEST
// Allow ourselves to make connections to either HE or normal pipes depending on which node we are doing.
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/can_be_node(obj/machinery/atmospherics/target, node_num)
var/target_initialize_directions
switch(node_num)
if(1)
target_initialize_directions = target.initialize_directions // Node1 is towards normal pipes
if(2)
var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/H = target
if(!istype(H))
return FALSE
target_initialize_directions = H.initialize_directions_he // Node2 is towards HE pies.
return (target_initialize_directions & get_dir(target,src)) && check_connectable(target) && target.check_connectable(src)
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/atmos_init() /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions)) for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))

View File

@@ -12,6 +12,9 @@
dir = SOUTH dir = SOUTH
initialize_directions = EAST|NORTH|WEST initialize_directions = EAST|NORTH|WEST
construction_type = /obj/item/pipe/trinary
pipe_state = "manifold"
var/obj/machinery/atmospherics/node3 var/obj/machinery/atmospherics/node3
level = 1 level = 1
@@ -116,11 +119,10 @@
for(var/direction in cardinal) for(var/direction in cardinal)
if(direction&connect_directions) if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction)) for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target connect_directions &= ~direction
connect_directions &= ~direction break
break
if (node1) if (node1)
break break
@@ -128,11 +130,10 @@
for(var/direction in cardinal) for(var/direction in cardinal)
if(direction&connect_directions) if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction)) for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 2))
if (check_connect_types(target,src)) node2 = target
node2 = target connect_directions &= ~direction
connect_directions &= ~direction break
break
if (node2) if (node2)
break break
@@ -140,11 +141,10 @@
for(var/direction in cardinal) for(var/direction in cardinal)
if(direction&connect_directions) if(direction&connect_directions)
for(var/obj/machinery/atmospherics/target in get_step(src,direction)) for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 3))
if (check_connect_types(target,src)) node3 = target
node3 = target connect_directions &= ~direction
connect_directions &= ~direction break
break
if (node3) if (node3)
break break

View File

@@ -12,6 +12,9 @@
dir = SOUTH dir = SOUTH
initialize_directions = NORTH|SOUTH|EAST|WEST initialize_directions = NORTH|SOUTH|EAST|WEST
construction_type = /obj/item/pipe/quaternary
pipe_state = "manifold4w"
var/obj/machinery/atmospherics/node3 var/obj/machinery/atmospherics/node3
var/obj/machinery/atmospherics/node4 var/obj/machinery/atmospherics/node4
@@ -127,29 +130,25 @@
/obj/machinery/atmospherics/pipe/manifold4w/atmos_init() /obj/machinery/atmospherics/pipe/manifold4w/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src,1)) for(var/obj/machinery/atmospherics/target in get_step(src, NORTH))
if(target.initialize_directions & 2) if (can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
for(var/obj/machinery/atmospherics/target in get_step(src,2)) for(var/obj/machinery/atmospherics/target in get_step(src, SOUTH))
if(target.initialize_directions & 1) if (can_be_node(target, 2))
if (check_connect_types(target,src)) node2 = target
node2 = target break
break
for(var/obj/machinery/atmospherics/target in get_step(src,4)) for(var/obj/machinery/atmospherics/target in get_step(src, EAST))
if(target.initialize_directions & 8) if (can_be_node(target, 3))
if (check_connect_types(target,src)) node3 = target
node3 = target break
break
for(var/obj/machinery/atmospherics/target in get_step(src,8)) for(var/obj/machinery/atmospherics/target in get_step(src, WEST))
if(target.initialize_directions & 4) if (can_be_node(target, 4))
if (check_connect_types(target,src)) node4 = target
node4 = target break
break
if(!node1 && !node2 && !node3 && !node4) if(!node1 && !node2 && !node3 && !node4)
qdel(src) qdel(src)

View File

@@ -10,6 +10,8 @@
layer = 2.4 //under wires with their 2.44 layer = 2.4 //under wires with their 2.44
use_power = 0 use_power = 0
pipe_flags = 0 // Does not have PIPING_DEFAULT_LAYER_ONLY flag.
var/alert_pressure = 80*ONE_ATMOSPHERE var/alert_pressure = 80*ONE_ATMOSPHERE
//minimum pressure before check_pressure(...) should be called //minimum pressure before check_pressure(...) should be called
@@ -31,6 +33,10 @@
/obj/machinery/atmospherics/pipe/proc/pipeline_expansion() /obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
return null return null
// For pipes this is the same as pipeline_expansion()
/obj/machinery/atmospherics/pipe/get_neighbor_nodes_for_init()
return pipeline_expansion()
/obj/machinery/atmospherics/pipe/proc/check_pressure(pressure) /obj/machinery/atmospherics/pipe/proc/check_pressure(pressure)
//Return 1 if parent should continue checking other pipes //Return 1 if parent should continue checking other pipes
//Return null if parent should stop checking other pipes. Recall: qdel(src) will by default return null //Return null if parent should stop checking other pipes. Recall: qdel(src) will by default return null
@@ -69,7 +75,11 @@
qdel_null(parent) qdel_null(parent)
if(air_temporary) if(air_temporary)
loc.assume_air(air_temporary) loc.assume_air(air_temporary)
for(var/obj/machinery/meter/meter in loc)
if(meter.target == src)
var/obj/item/pipe_meter/PM = new /obj/item/pipe_meter(loc)
meter.transfer_fingerprints_to(PM)
qdel(meter)
. = ..() . = ..()
/obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) /obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
@@ -96,12 +106,7 @@
"<span class='notice'>\The [user] unfastens \the [src].</span>", \ "<span class='notice'>\The [user] unfastens \the [src].</span>", \
"<span class='notice'>You have unfastened \the [src].</span>", \ "<span class='notice'>You have unfastened \the [src].</span>", \
"You hear a ratchet.") "You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src) deconstruct()
for (var/obj/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
/obj/machinery/atmospherics/pipe/proc/change_color(var/new_color) /obj/machinery/atmospherics/pipe/proc/change_color(var/new_color)
//only pass valid pipe colors please ~otherwise your pipe will turn invisible //only pass valid pipe colors please ~otherwise your pipe will turn invisible

View File

@@ -13,6 +13,10 @@
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH|NORTH initialize_directions = SOUTH|NORTH
pipe_flags = PIPING_CARDINAL_AUTONORMALIZE
construction_type = /obj/item/pipe/binary/bendable
pipe_state = "simple"
var/minimum_temperature_difference = 300 var/minimum_temperature_difference = 300
var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
@@ -47,9 +51,13 @@
/obj/machinery/atmospherics/pipe/simple/init_dir() /obj/machinery/atmospherics/pipe/simple/init_dir()
switch(dir) switch(dir)
if(SOUTH || NORTH) if(SOUTH)
initialize_directions = SOUTH|NORTH initialize_directions = SOUTH|NORTH
if(EAST || WEST) if(NORTH)
initialize_directions = SOUTH|NORTH
if(EAST)
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST initialize_directions = EAST|WEST
if(NORTHEAST) if(NORTHEAST)
initialize_directions = NORTH|EAST initialize_directions = NORTH|EAST
@@ -124,15 +132,13 @@
node2_dir = direction node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir)) for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 2))
if (check_connect_types(target,src)) node2 = target
node2 = target break
break
if(!node1 && !node2) if(!node1 && !node2)
qdel(src) qdel(src)
@@ -248,6 +254,9 @@
icon = 'icons/obj/atmospherics/red_pipe.dmi' icon = 'icons/obj/atmospherics/red_pipe.dmi'
icon_state = "intact" icon_state = "intact"
construction_type = /obj/item/pipe/binary/bendable
pipe_state = "insulated"
minimum_temperature_difference = 10000 minimum_temperature_difference = 10000
thermal_conductivity = 0 thermal_conductivity = 0
maximum_pressure = 1000*ONE_ATMOSPHERE maximum_pressure = 1000*ONE_ATMOSPHERE

View File

@@ -14,6 +14,7 @@
level = 1 level = 1
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
pipe_flags = PIPING_DEFAULT_LAYER_ONLY
density = 1 density = 1
/obj/machinery/atmospherics/pipe/tank/New() /obj/machinery/atmospherics/pipe/tank/New()
@@ -48,10 +49,9 @@
var/connect_direction = dir var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction)) for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
update_underlays() update_underlays()

View File

@@ -6,6 +6,9 @@
desc = "An adapter for regular, supply and scrubbers pipes" desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER
icon_state = "map_universal" icon_state = "map_universal"
pipe_flags = PIPING_ALL_LAYER|PIPING_CARDINAL_AUTONORMALIZE
construction_type = /obj/item/pipe/binary
pipe_state = "universal"
/obj/machinery/atmospherics/pipe/simple/visible/universal/update_icon(var/safety = 0) /obj/machinery/atmospherics/pipe/simple/visible/universal/update_icon(var/safety = 0)
if(!check_icon_cache()) if(!check_icon_cache())
@@ -41,6 +44,9 @@
desc = "An adapter for regular, supply and scrubbers pipes" desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER
icon_state = "map_universal" icon_state = "map_universal"
pipe_flags = PIPING_ALL_LAYER|PIPING_CARDINAL_AUTONORMALIZE
construction_type = /obj/item/pipe/binary
pipe_state = "universal"
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0) /obj/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0)
if(!check_icon_cache()) if(!check_icon_cache())

View File

@@ -14,6 +14,9 @@
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
pipe_flags = PIPING_DEFAULT_LAYER_ONLY
construction_type = /obj/item/pipe/directional
pipe_state = "passive vent"
var/build_killswitch = 1 var/build_killswitch = 1
@@ -58,10 +61,9 @@
var/connect_direction = dir var/connect_direction = dir
for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction)) for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
if(target.initialize_directions & get_dir(target,src)) if (can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
update_icon() update_icon()

View File

@@ -1,4 +1,6 @@
//
// Frame construction
//
// Frame construction states // Frame construction states
#define FRAME_PLACED 0 // Has been placed (can be anchored or not). #define FRAME_PLACED 0 // Has been placed (can be anchored or not).
@@ -16,3 +18,44 @@
// Does the frame get built on the floor or a wall? // Does the frame get built on the floor or a wall?
#define FRAME_STYLE_FLOOR "floor" #define FRAME_STYLE_FLOOR "floor"
#define FRAME_STYLE_WALL "wall" #define FRAME_STYLE_WALL "wall"
//
// Pipe Construction
//
//Construction Orientation Types - Each of these categories has a different selection of how pipes can rotate and flip. Used for RPD.
#define PIPE_STRAIGHT 0 //2 directions: N/S, E/W
#define PIPE_BENDABLE 1 //6 directions: N/S, E/W, N/E, N/W, S/E, S/W
#define PIPE_TRINARY 2 //4 directions: N/E/S, E/S/W, S/W/N, W/N/E
#define PIPE_TRIN_M 3 //8 directions: N->S+E, S->N+E, N->S+W, S->N+W, E->W+S, W->E+S, E->W+N, W->E+N
#define PIPE_DIRECTIONAL 4 //4 directions: N, S, E, W
#define PIPE_ONEDIR 5 //1 direction: N/S/E/W
#define PIPE_UNARY_FLIPPABLE 6 //8 directions: N, S, E, W, N-flipped, S-flipped, E-flipped, W-flipped
#define PIPE_TRIN_T 7 //8 directions: N->S+E, S->N+E, N->S+W, S->N+W, E->W+S, W->E+S, E->W+N, W->E+N
// Pipe connectivity bit flags
#define CONNECT_TYPE_REGULAR 1
#define CONNECT_TYPE_SUPPLY 2
#define CONNECT_TYPE_SCRUBBER 4
#define CONNECT_TYPE_HE 8
// We are based on the three named layers of supply, regular, and scrubber.
#define PIPING_LAYER_SUPPLY 1
#define PIPING_LAYER_REGULAR 2
#define PIPING_LAYER_SCRUBBER 3
#define PIPING_LAYER_DEFAULT PIPING_LAYER_REGULAR
// Pipe flags
#define PIPING_ALL_LAYER 1 //intended to connect with all layers, check for all instead of just one.
#define PIPING_ONE_PER_TURF 2 //can only be built if nothing else with this flag is on the tile already.
#define PIPING_DEFAULT_LAYER_ONLY 4 //can only exist at PIPING_LAYER_DEFAULT
#define PIPING_CARDINAL_AUTONORMALIZE 8 //north/south east/west doesn't matter, auto normalize on build.
// Macro for easy use of boilerplate code for searching for a valid node connection.
#define STANDARD_ATMOS_CHOOSE_NODE(node_num, direction) \
for(var/obj/machinery/atmospherics/target in get_step(src, direction)) { \
if(can_be_node(target, node_num)) { \
node##node_num = target; \
break; \
} \
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,74 +6,32 @@
anchored = 1 anchored = 1
var/unwrenched = 0 var/unwrenched = 0
var/wait = 0 var/wait = 0
var/p_layer = PIPING_LAYER_REGULAR
/obj/machinery/pipedispenser/attack_hand(user as mob) // TODO - Its about time to make this NanoUI don't we think?
if(..()) /obj/machinery/pipedispenser/attack_hand(var/mob/user as mob)
if((. = ..()))
return return
///// Z-Level stuff src.interact(user)
var/dat = {"
<b>Regular pipes:</b><BR>
<A href='?src=\ref[src];make=0;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=1;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=5;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=44;dir=1'>Digital Valve</A><BR>
<A href='?src=\ref[src];make=8;dir=1'>Manual Valve</A><BR>
<A href='?src=\ref[src];make=20;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=19;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=45;dir=4'>Digital T-Valve</A><BR>
<A href='?src=\ref[src];make=46;dir=8'>Digital T-Valve - Mirrored</A><BR>
<A href='?src=\ref[src];make=18;dir=4'>Manual T-Valve</A><BR>
<A href='?src=\ref[src];make=43;dir=8'>Manual T-Valve - Mirrored</A><BR>
<A href='?src=\ref[src];make=21;dir=1'>Upward Pipe</A><BR>
<A href='?src=\ref[src];make=22;dir=1'>Downward Pipe</A><BR>
<b>Supply pipes:</b><BR>
<A href='?src=\ref[src];make=29;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=30;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=33;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=41;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=35;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=37;dir=1'>Upward Pipe</A><BR>
<A href='?src=\ref[src];make=39;dir=1'>Downward Pipe</A><BR>
<b>Scrubbers pipes:</b><BR>
<A href='?src=\ref[src];make=31;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=32;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=34;dir=1'>Manifold</A><BR>
<A href='?src=\ref[src];make=42;dir=1'>Pipe Cap</A><BR>
<A href='?src=\ref[src];make=36;dir=1'>4-Way Manifold</A><BR>
<A href='?src=\ref[src];make=38;dir=1'>Upward Pipe</A><BR>
<A href='?src=\ref[src];make=40;dir=1'>Downward Pipe</A><BR>
<b>Devices:</b><BR>
<A href='?src=\ref[src];make=28;dir=1'>Universal pipe adapter</A><BR>
<A href='?src=\ref[src];make=4;dir=1'>Connector</A><BR>
<A href='?src=\ref[src];make=7;dir=1'>Unary Vent</A><BR>
<A href='?src=\ref[src];make=47;dir=1'>Passive Vent</A><BR>
<A href='?src=\ref[src];make=9;dir=1'>Gas Pump</A><BR>
<A href='?src=\ref[src];make=15;dir=1'>Pressure Regulator</A><BR>
<A href='?src=\ref[src];make=16;dir=1'>High Power Gas Pump</A><BR>
<A href='?src=\ref[src];make=10;dir=1'>Scrubber</A><BR>
<A href='?src=\ref[src];makemeter=1'>Meter</A><BR>
<A href='?src=\ref[src];make=13;dir=1'>Gas Filter</A><BR>
<A href='?src=\ref[src];make=23;dir=1'>Gas Filter - Mirrored</A><BR>
<A href='?src=\ref[src];make=14;dir=1'>Gas Mixer</A><BR>
<A href='?src=\ref[src];make=25;dir=1'>Gas Mixer - Mirrored</A><BR>
<A href='?src=\ref[src];make=24;dir=1'>Gas Mixer - T</A><BR>
<A href='?src=\ref[src];make=26;dir=1'>Omni Gas Mixer</A><BR>
<A href='?src=\ref[src];make=27;dir=1'>Omni Gas Filter</A><BR>
<b>Heat exchange:</b><BR>
<A href='?src=\ref[src];make=2;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=3;dir=5'>Bent Pipe</A><BR>
<A href='?src=\ref[src];make=6;dir=1'>Junction</A><BR>
<A href='?src=\ref[src];make=17;dir=1'>Heat Exchanger</A><BR>
<b>Insulated pipes:</b><BR>
<A href='?src=\ref[src];make=11;dir=1'>Pipe</A><BR>
<A href='?src=\ref[src];make=12;dir=5'>Bent Pipe</A><BR>
"} /obj/machinery/pipedispenser/interact(mob/user)
///// Z-Level stuff user.set_machine(src)
//What number the make points to is in the define # at the top of construction.dm in same folder
user << browse("<HEAD><TITLE>[src]</TITLE></HEAD><TT>[dat]</TT>", "window=pipedispenser") var/list/lines = list()
onclose(user, "pipedispenser") for(var/category in atmos_pipe_recipes)
lines += "<b>[category]:</b><BR>"
if(category == "Pipes")
// Stupid hack. Fix someday. So tired right now.
lines += "<a class='[p_layer == PIPING_LAYER_REGULAR ? "linkOn" : "linkOff"]' href='?src=\ref[src];setlayer=[PIPING_LAYER_REGULAR]'>Regular</a> "
lines += "<a class='[p_layer == PIPING_LAYER_SUPPLY ? "linkOn" : "linkOff"]' href='?src=\ref[src];setlayer=[PIPING_LAYER_SUPPLY]'>Supply</a> "
lines += "<a class='[p_layer == PIPING_LAYER_SCRUBBER ? "linkOn" : "linkOff"]' href='?src=\ref[src];setlayer=[PIPING_LAYER_SCRUBBER]'>Scrubber</a> "
lines += "<br>"
for(var/datum/pipe_recipe/PI in atmos_pipe_recipes[category])
lines += PI.Render(src)
var/dat = lines.Join()
var/datum/browser/popup = new(user, "pipedispenser", name, 300, 800, src)
popup.set_content("<TT>[dat]</TT>")
popup.open()
return return
/obj/machinery/pipedispenser/Topic(href, href_list) /obj/machinery/pipedispenser/Topic(href, href_list)
@@ -81,20 +39,27 @@
return return
if(unwrenched || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr)) if(unwrenched || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
usr << browse(null, "window=pipedispenser") usr << browse(null, "window=pipedispenser")
usr.unset_machine(src)
return return
usr.set_machine(src) usr.set_machine(src)
src.add_fingerprint(usr) src.add_fingerprint(usr)
if(href_list["make"]) if(href_list["setlayer"])
var/new_pipe_layer = text2num(href_list["setlayer"])
if(isnum(new_pipe_layer))
p_layer = new_pipe_layer
updateDialog()
else if(href_list["makepipe"])
if(!wait) if(!wait)
var/p_type = text2num(href_list["make"]) var/obj/machinery/atmospherics/p_type = text2path(href_list["makepipe"])
var/p_dir = text2num(href_list["dir"]) var/p_dir = text2num(href_list["dir"])
var/obj/item/pipe/P = new (/*usr.loc*/ src.loc, pipe_type=p_type, dir=p_dir) var/pi_type = initial(p_type.construction_type)
P.update() var/obj/item/pipe/P = new pi_type(src.loc, p_type, p_dir)
P.setPipingLayer(p_layer)
P.add_fingerprint(usr) P.add_fingerprint(usr)
wait = 1 wait = 1
spawn(10) spawn(10)
wait = 0 wait = 0
if(href_list["makemeter"]) else if(href_list["makemeter"])
if(!wait) if(!wait)
new /obj/item/pipe_meter(/*usr.loc*/ src.loc) new /obj/item/pipe_meter(/*usr.loc*/ src.loc)
wait = 1 wait = 1

View File

@@ -0,0 +1,102 @@
//
// Recipies for Pipe Dispenser and (someday) the RPD
//
var/global/list/atmos_pipe_recipes = null
/hook/startup/proc/init_pipe_recipes()
global.atmos_pipe_recipes = list(
"Pipes" = list(
new /datum/pipe_recipe/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple),
new /datum/pipe_recipe/pipe("Manifold", /obj/machinery/atmospherics/pipe/manifold),
new /datum/pipe_recipe/pipe("Manual Valve", /obj/machinery/atmospherics/valve),
new /datum/pipe_recipe/pipe("Digital Valve", /obj/machinery/atmospherics/valve/digital),
new /datum/pipe_recipe/pipe("Pipe cap", /obj/machinery/atmospherics/pipe/cap),
new /datum/pipe_recipe/pipe("4-Way Manifold", /obj/machinery/atmospherics/pipe/manifold4w),
new /datum/pipe_recipe/pipe("Manual T-Valve", /obj/machinery/atmospherics/tvalve),
new /datum/pipe_recipe/pipe("Digital T-Valve", /obj/machinery/atmospherics/tvalve/digital),
new /datum/pipe_recipe/pipe("Upward Pipe", /obj/machinery/atmospherics/pipe/zpipe/up),
new /datum/pipe_recipe/pipe("Downward Pipe", /obj/machinery/atmospherics/pipe/zpipe/down),
new /datum/pipe_recipe/pipe("Universal Pipe Adaptor", /obj/machinery/atmospherics/pipe/simple/visible/universal),
),
"Devices" = list(
new /datum/pipe_recipe/pipe("Connector", /obj/machinery/atmospherics/portables_connector),
new /datum/pipe_recipe/pipe("Unary Vent", /obj/machinery/atmospherics/unary/vent_pump),
new /datum/pipe_recipe/pipe("Passive Vent", /obj/machinery/atmospherics/pipe/vent),
new /datum/pipe_recipe/pipe("Injector", /obj/machinery/atmospherics/unary/outlet_injector),
new /datum/pipe_recipe/pipe("Gas Pump", /obj/machinery/atmospherics/binary/pump),
new /datum/pipe_recipe/pipe("Pressure Regulator", /obj/machinery/atmospherics/binary/passive_gate),
new /datum/pipe_recipe/pipe("High Power Gas Pump",/obj/machinery/atmospherics/binary/pump/high_power),
new /datum/pipe_recipe/pipe("Scrubber", /obj/machinery/atmospherics/unary/vent_scrubber),
new /datum/pipe_recipe/meter("Meter"),
new /datum/pipe_recipe/pipe("Gas Filter", /obj/machinery/atmospherics/trinary/atmos_filter),
new /datum/pipe_recipe/pipe("Gas Mixer", /obj/machinery/atmospherics/trinary/mixer),
new /datum/pipe_recipe/pipe("Gas Mixer 'T'", /obj/machinery/atmospherics/trinary/mixer/t_mixer),
new /datum/pipe_recipe/pipe("Omni Gas Mixer", /obj/machinery/atmospherics/omni/mixer),
new /datum/pipe_recipe/pipe("Omni Gas Filter", /obj/machinery/atmospherics/omni/atmos_filter),
),
"Heat Exchange" = list(
new /datum/pipe_recipe/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple/heat_exchanging),
new /datum/pipe_recipe/pipe("Junction", /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction),
new /datum/pipe_recipe/pipe("Heat Exchanger", /obj/machinery/atmospherics/unary/heat_exchanger),
),
"Insulated pipes" = list(
new /datum/pipe_recipe/pipe("Pipe", /obj/machinery/atmospherics/pipe/simple/insulated),
)
)
return TRUE
//
// New method of handling pipe construction. Instead of numeric constants and a giant switch statement of doom
// every pipe type has a datum instance which describes its name, placement rules and construction method, dispensing etc.
// The advantages are obvious, mostly in simplifying the code of the dispenser, and the ability to add new pipes without hassle.
//
/datum/pipe_recipe
var/name = "Abstract Pipe (fixme)" // Recipe name
var/dirtype // If using an RPD, this tells more about what previews to show.
// Render an HTML link to select this pipe type. Returns text.
/datum/pipe_recipe/proc/Render(dispenser)
return "<A href='?src=\ref[dispenser]&[Params()]'>[name]</A><BR>"
// Parameters for the Topic link returned by Render(). Returns text.
/datum/pipe_recipe/proc/Params()
return ""
//
// Subtype for actual pipes
//
/datum/pipe_recipe/pipe
var/obj/item/pipe/construction_type // The type PATH to the type of pipe fitting object the recipe makes.
var/obj/machinery/atmospherics/pipe_type // The type PATH of what actual pipe the fitting becomes.
/datum/pipe_recipe/pipe/New(var/label, var/obj/machinery/atmospherics/path)
name = label
pipe_type = path
construction_type = initial(path.construction_type)
dirtype = initial(construction_type.dispenser_class)
// Render an HTML link to select this pipe type
/datum/pipe_recipe/pipe/Render(dispenser)
var/dat = ..(dispenser)
// Stationary pipe dispensers don't allow you to pre-select pipe directions.
// This makes it impossble to spawn bent versions of bendable pipes.
// We add a "Bent" pipe type with a preset diagonal direction to work around it.
if(istype(dispenser, /obj/machinery/pipedispenser) && (dirtype == PIPE_BENDABLE))
dat += "<A href='?src=\ref[dispenser]&[Params()]&dir=[NORTHEAST]'>Bent [name]</A><BR>"
return dat
/datum/pipe_recipe/pipe/Params()
return "makepipe=[pipe_type]"
//
// Subtype for meters
//
/datum/pipe_recipe/meter
dirtype = PIPE_ONEDIR
/datum/pipe_recipe/meter/New(label)
name = label
/datum/pipe_recipe/meter/Params()
return "makemeter=1"

View File

@@ -13,6 +13,9 @@ obj/machinery/atmospherics/pipe/zpipe
dir = SOUTH dir = SOUTH
initialize_directions = SOUTH initialize_directions = SOUTH
construction_type = /obj/item/pipe/directional
pipe_state = "cap"
// node1 is the connection on the same Z // node1 is the connection on the same Z
// node2 is the connection on the other Z // node2 is the connection on the other Z
@@ -135,16 +138,15 @@ obj/machinery/atmospherics/pipe/zpipe/up/atmos_init()
node1_dir = direction node1_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
var/turf/above = GetAbove(src) var/turf/above = GetAbove(src)
if(above) if(above)
for(var/obj/machinery/atmospherics/target in above) for(var/obj/machinery/atmospherics/target in above)
if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/down)) if(istype(target, /obj/machinery/atmospherics/pipe/zpipe/down))
if (check_connect_types(target,src)) if (check_connectable(target) && target.check_connectable(src))
node2 = target node2 = target
break break
@@ -173,16 +175,15 @@ obj/machinery/atmospherics/pipe/zpipe/down/atmos_init()
node1_dir = direction node1_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir)) for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src)) if(can_be_node(target, 1))
if (check_connect_types(target,src)) node1 = target
node1 = target break
break
var/turf/below = GetBelow(src) var/turf/below = GetBelow(src)
if(below) if(below)
for(var/obj/machinery/atmospherics/target in below) for(var/obj/machinery/atmospherics/target in below)
if(target.initialize_directions && istype(target, /obj/machinery/atmospherics/pipe/zpipe/up)) if(istype(target, /obj/machinery/atmospherics/pipe/zpipe/up))
if (check_connect_types(target,src)) if (check_connectable(target) && target.check_connectable(src))
node2 = target node2 = target
break break

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -751,6 +751,7 @@
#include "code\game\machinery\kitchen\cooking_machines\oven.dm" #include "code\game\machinery\kitchen\cooking_machines\oven.dm"
#include "code\game\machinery\pipe\construction.dm" #include "code\game\machinery\pipe\construction.dm"
#include "code\game\machinery\pipe\pipe_dispenser.dm" #include "code\game\machinery\pipe\pipe_dispenser.dm"
#include "code\game\machinery\pipe\pipe_recipes.dm"
#include "code\game\machinery\pipe\pipelayer.dm" #include "code\game\machinery\pipe\pipelayer.dm"
#include "code\game\machinery\telecomms\broadcaster.dm" #include "code\game\machinery\telecomms\broadcaster.dm"
#include "code\game\machinery\telecomms\logbrowser.dm" #include "code\game\machinery\telecomms\logbrowser.dm"