From f451fd42c133a7151d0da03b0446564595432d9a Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Thu, 20 Feb 2014 15:50:12 +1300 Subject: [PATCH] Pipe tweaks - updated update_icon() for pipes and manifolds to change the color instead of the sprite - updated subtypes to use global defines for colors instead of hard coded html refs - added an alpha tweak to hidden pipes for the sake of mapping (DM doesn't render semi-transparent icons correctly, but it does handle var/alpha tweaks) - this is overridden when the pipe is spawned in the game world with New() (Thinking about it, we could potentially do away with the transparent pipe sprites by just using the alpha variable. May do this later.) - fixed pipe painter - unwrenched pipes now inherit their source pipe color, and also inherit it when reattached to a pipe network again --- code/ATMOSPHERICS/pipes.dm | 107 ++++++++++++----------- code/game/machinery/pipe/construction.dm | 4 + 2 files changed, 62 insertions(+), 49 deletions(-) diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index a2980482f59..cc7cff44e40 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -63,6 +63,7 @@ obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/u return ..() if(istype(W,/obj/item/device/pipe_painter)) + W.afterattack(src, user) return 1 if (!istype(W, /obj/item/weapon/wrench)) @@ -118,6 +119,7 @@ obj/machinery/atmospherics/pipe/simple obj/machinery/atmospherics/pipe/simple/New() ..() + alpha = 255 switch(dir) if(SOUTH || NORTH) initialize_directions = SOUTH|NORTH @@ -220,15 +222,15 @@ obj/machinery/atmospherics/pipe/simple/pipeline_expansion() obj/machinery/atmospherics/pipe/simple/update_icon() if(node1&&node2) - var/C = "" switch(pipe_color) - if ("red") C = "-r" - if ("blue") C = "-b" - if ("cyan") C = "-c" - if ("green") C = "-g" - if ("yellow") C = "-y" - if ("purple") C = "-p" - icon_state = "intact[C][invisibility ? "-f" : "" ]" + if ("red") color = COLOR_RED + if ("blue") color = COLOR_BLUE + if ("cyan") color = COLOR_CYAN + if ("green") color = COLOR_GREEN + if ("yellow") color = "#FFCC00" + if ("purple") color = "#5C1EC0" + if ("grey") color = null + icon_state = "intact[invisibility ? "-f" : "" ]" //var/node1_direction = get_dir(src, node1) //var/node2_direction = get_dir(src, node2) @@ -294,42 +296,43 @@ obj/machinery/atmospherics/pipe/simple/visible obj/machinery/atmospherics/pipe/simple/visible/scrubbers name="Scrubbers pipe" - color="#FF0000" + color=COLOR_RED obj/machinery/atmospherics/pipe/simple/visible/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/simple/visible/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/simple/visible/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/simple/visible/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/simple/hidden level = 1 icon_state = "intact-f" + alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game obj/machinery/atmospherics/pipe/simple/hidden/scrubbers name="Scrubbers pipe" - color="#FF0000" + color=COLOR_RED obj/machinery/atmospherics/pipe/simple/hidden/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/simple/hidden/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/simple/hidden/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/simple/hidden/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/simple/insulated @@ -364,6 +367,7 @@ obj/machinery/atmospherics/pipe/manifold layer = 2.4 //under wires with their 2.44 obj/machinery/atmospherics/pipe/manifold/New() + alpha = 255 switch(dir) if(NORTH) initialize_directions = EAST|SOUTH|WEST @@ -442,15 +446,15 @@ obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/r obj/machinery/atmospherics/pipe/manifold/update_icon() if(node1&&node2&&node3) - var/C = "" switch(pipe_color) - if ("red") C = "-r" - if ("blue") C = "-b" - if ("cyan") C = "-c" - if ("green") C = "-g" - if ("yellow") C = "-y" - if ("purple") C = "-p" - icon_state = "manifold[C][invisibility ? "-f" : ""]" + if ("red") color = COLOR_RED + if ("blue") color = COLOR_BLUE + if ("cyan") color = COLOR_CYAN + if ("green") color = COLOR_GREEN + if ("yellow") color = "#FFCC00" + if ("purple") color = "#5C1EC0" + if ("grey") color = null + icon_state = "manifold[invisibility ? "-f" : "" ]" else var/connected = 0 @@ -520,48 +524,48 @@ obj/machinery/atmospherics/pipe/manifold/visible obj/machinery/atmospherics/pipe/manifold/visible/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/manifold/visible/scrubbers name="Scrubbers pipe" - color="#FF0000" + color=COLOR_RED obj/machinery/atmospherics/pipe/manifold/visible/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/manifold/visible/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/manifold/visible/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/manifold/hidden level = 1 icon_state = "manifold-f" + alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game obj/machinery/atmospherics/pipe/manifold/hidden/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers name="Scrubbers pipe" - color="#FF0000" + color = COLOR_RED obj/machinery/atmospherics/pipe/manifold/hidden/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/manifold/hidden/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/manifold/hidden/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/manifold4w icon = 'icons/obj/atmospherics/pipe_manifold.dmi' - icon_state = "manifold4w-f" name = "4-way pipe manifold" desc = "A manifold composed of regular pipes" @@ -579,6 +583,10 @@ obj/machinery/atmospherics/pipe/manifold4w level = 1 layer = 2.4 //under wires with their 2.44 +obj/machinery/atmospherics/pipe/manifold4w/New() + ..() + alpha = 255 + obj/machinery/atmospherics/pipe/manifold4w/hide(var/i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 @@ -651,15 +659,15 @@ obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics obj/machinery/atmospherics/pipe/manifold4w/update_icon() overlays.Cut() if(node1&&node2&&node3&&node4) - var/C = "" switch(pipe_color) - if ("red") C = "-r" - if ("blue") C = "-b" - if ("cyan") C = "-c" - if ("green") C = "-g" - if ("yellow") C = "-y" - if ("purple") C = "-p" - icon_state = "manifold4w[C][invisibility ? "-f" : ""]" + if ("red") color = COLOR_RED + if ("blue") color = COLOR_BLUE + if ("cyan") color = COLOR_CYAN + if ("green") color = COLOR_GREEN + if ("yellow") color = "#FFCC00" + if ("purple") color = "#5C1EC0" + if ("grey") color = null + icon_state = "manifold4w[invisibility ? "-f" : "" ]" else icon_state = "manifold4w_ex" @@ -712,42 +720,43 @@ obj/machinery/atmospherics/pipe/manifold4w/visible obj/machinery/atmospherics/pipe/manifold4w/visible/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers name="Scrubbers pipe" - color="#FF0000" + color=COLOR_RED obj/machinery/atmospherics/pipe/manifold4w/visible/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/manifold4w/visible/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/manifold4w/visible/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/manifold4w/hidden level = 1 icon_state = "manifold4w-f" + alpha = 192 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game obj/machinery/atmospherics/pipe/manifold4w/hidden/supply name="Air supply pipe" - color="#0000FF" + color=COLOR_BLUE obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers name="Scrubbers pipe" - color="#FF0000" + color=COLOR_RED obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow color="#FFCC00" obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan - color="#00FFFF" + color=COLOR_CYAN obj/machinery/atmospherics/pipe/manifold4w/hidden/green - color="#00FF00" + color=COLOR_GREEN obj/machinery/atmospherics/pipe/cap diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 72aa31ccee0..d3e494b2d7f 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -47,6 +47,7 @@ Buildable meters if (make_from) src.dir = make_from.dir src.pipename = make_from.name + color = make_from.color var/is_bent if (make_from.initialize_directions in list(NORTH|SOUTH, WEST|EAST)) is_bent = 0 @@ -299,6 +300,7 @@ Buildable meters switch(pipe_type) if(PIPE_SIMPLE_STRAIGHT, PIPE_SIMPLE_BENT) var/obj/machinery/atmospherics/pipe/simple/P = new( src.loc ) + P.color = color P.dir = src.dir P.initialize_directions = pipe_dir var/turf/T = P.loc @@ -351,6 +353,7 @@ Buildable meters if(PIPE_MANIFOLD) //manifold var/obj/machinery/atmospherics/pipe/manifold/M = new( src.loc ) + M.color = color M.dir = dir M.initialize_directions = pipe_dir //M.New() @@ -373,6 +376,7 @@ Buildable meters if(PIPE_MANIFOLD4W) //4-way manifold var/obj/machinery/atmospherics/pipe/manifold4w/M = new( src.loc ) + M.color = color M.dir = dir M.initialize_directions = pipe_dir //M.New()