Files
CHOMPStation2/code/ATMOSPHERICS/pipes/cap.dm
Leshana 63a1dd0143 - 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.
2018-03-04 14:49:33 -05:00

117 lines
2.8 KiB
Plaintext

//
// Pipe Cap - They go on the end
//
/obj/machinery/atmospherics/pipe/cap
name = "pipe endcap"
desc = "An endcap for pipes"
icon = 'icons/atmos/pipes.dmi'
icon_state = ""
level = 2
layer = 2.4 //under wires with their 2.44
volume = 35
dir = SOUTH
initialize_directions = SOUTH
construction_type = /obj/item/pipe/directional
pipe_state = "cap"
var/obj/machinery/atmospherics/node
/obj/machinery/atmospherics/pipe/cap/init_dir()
initialize_directions = dir
/obj/machinery/atmospherics/pipe/cap/pipeline_expansion()
return list(node)
/obj/machinery/atmospherics/pipe/cap/Destroy()
if(node)
node.disconnect(src)
node = null
. = ..()
/obj/machinery/atmospherics/pipe/cap/disconnect(obj/machinery/atmospherics/reference)
if(reference == node)
if(istype(node, /obj/machinery/atmospherics/pipe))
qdel(parent)
node = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/cap/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node)
node.update_underlays()
/obj/machinery/atmospherics/pipe/cap/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
overlays.Cut()
overlays += icon_manager.get_atmos_icon("pipe", , pipe_color, "cap")
/obj/machinery/atmospherics/pipe/cap/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src, dir))
if (can_be_node(target, 1))
node = target
break
var/turf/T = src.loc // hide if turf is not intact
if(level == 1 && !T.is_plating()) hide(1)
update_icon()
/obj/machinery/atmospherics/pipe/cap/can_unwrench()
return 1
/obj/machinery/atmospherics/pipe/cap/visible
level = 2
icon_state = "cap"
/obj/machinery/atmospherics/pipe/cap/visible/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/cap/visible/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-supply"
connect_types = CONNECT_TYPE_SUPPLY
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/cap/hidden
level = 1
icon_state = "cap"
alpha = 128
/obj/machinery/atmospherics/pipe/cap/hidden/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-f-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/cap/hidden/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-f-supply"
connect_types = CONNECT_TYPE_SUPPLY
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE