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
This commit is contained in:
Loganbacca
2014-02-20 15:50:12 +13:00
parent 485af511b8
commit f451fd42c1
2 changed files with 62 additions and 49 deletions

View File

@@ -63,6 +63,7 @@ obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/u
return ..() return ..()
if(istype(W,/obj/item/device/pipe_painter)) if(istype(W,/obj/item/device/pipe_painter))
W.afterattack(src, user)
return 1 return 1
if (!istype(W, /obj/item/weapon/wrench)) if (!istype(W, /obj/item/weapon/wrench))
@@ -118,6 +119,7 @@ obj/machinery/atmospherics/pipe/simple
obj/machinery/atmospherics/pipe/simple/New() obj/machinery/atmospherics/pipe/simple/New()
..() ..()
alpha = 255
switch(dir) switch(dir)
if(SOUTH || NORTH) if(SOUTH || NORTH)
initialize_directions = SOUTH|NORTH initialize_directions = SOUTH|NORTH
@@ -220,15 +222,15 @@ obj/machinery/atmospherics/pipe/simple/pipeline_expansion()
obj/machinery/atmospherics/pipe/simple/update_icon() obj/machinery/atmospherics/pipe/simple/update_icon()
if(node1&&node2) if(node1&&node2)
var/C = ""
switch(pipe_color) switch(pipe_color)
if ("red") C = "-r" if ("red") color = COLOR_RED
if ("blue") C = "-b" if ("blue") color = COLOR_BLUE
if ("cyan") C = "-c" if ("cyan") color = COLOR_CYAN
if ("green") C = "-g" if ("green") color = COLOR_GREEN
if ("yellow") C = "-y" if ("yellow") color = "#FFCC00"
if ("purple") C = "-p" if ("purple") color = "#5C1EC0"
icon_state = "intact[C][invisibility ? "-f" : "" ]" if ("grey") color = null
icon_state = "intact[invisibility ? "-f" : "" ]"
//var/node1_direction = get_dir(src, node1) //var/node1_direction = get_dir(src, node1)
//var/node2_direction = get_dir(src, node2) //var/node2_direction = get_dir(src, node2)
@@ -294,42 +296,43 @@ obj/machinery/atmospherics/pipe/simple/visible
obj/machinery/atmospherics/pipe/simple/visible/scrubbers obj/machinery/atmospherics/pipe/simple/visible/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color=COLOR_RED
obj/machinery/atmospherics/pipe/simple/visible/supply obj/machinery/atmospherics/pipe/simple/visible/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/simple/visible/yellow obj/machinery/atmospherics/pipe/simple/visible/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/simple/visible/cyan obj/machinery/atmospherics/pipe/simple/visible/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/simple/visible/green obj/machinery/atmospherics/pipe/simple/visible/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/simple/hidden obj/machinery/atmospherics/pipe/simple/hidden
level = 1 level = 1
icon_state = "intact-f" 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 obj/machinery/atmospherics/pipe/simple/hidden/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color=COLOR_RED
obj/machinery/atmospherics/pipe/simple/hidden/supply obj/machinery/atmospherics/pipe/simple/hidden/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/simple/hidden/yellow obj/machinery/atmospherics/pipe/simple/hidden/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/simple/hidden/cyan obj/machinery/atmospherics/pipe/simple/hidden/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/simple/hidden/green obj/machinery/atmospherics/pipe/simple/hidden/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/simple/insulated obj/machinery/atmospherics/pipe/simple/insulated
@@ -364,6 +367,7 @@ obj/machinery/atmospherics/pipe/manifold
layer = 2.4 //under wires with their 2.44 layer = 2.4 //under wires with their 2.44
obj/machinery/atmospherics/pipe/manifold/New() obj/machinery/atmospherics/pipe/manifold/New()
alpha = 255
switch(dir) switch(dir)
if(NORTH) if(NORTH)
initialize_directions = EAST|SOUTH|WEST 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() obj/machinery/atmospherics/pipe/manifold/update_icon()
if(node1&&node2&&node3) if(node1&&node2&&node3)
var/C = ""
switch(pipe_color) switch(pipe_color)
if ("red") C = "-r" if ("red") color = COLOR_RED
if ("blue") C = "-b" if ("blue") color = COLOR_BLUE
if ("cyan") C = "-c" if ("cyan") color = COLOR_CYAN
if ("green") C = "-g" if ("green") color = COLOR_GREEN
if ("yellow") C = "-y" if ("yellow") color = "#FFCC00"
if ("purple") C = "-p" if ("purple") color = "#5C1EC0"
icon_state = "manifold[C][invisibility ? "-f" : ""]" if ("grey") color = null
icon_state = "manifold[invisibility ? "-f" : "" ]"
else else
var/connected = 0 var/connected = 0
@@ -520,48 +524,48 @@ obj/machinery/atmospherics/pipe/manifold/visible
obj/machinery/atmospherics/pipe/manifold/visible/supply obj/machinery/atmospherics/pipe/manifold/visible/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/manifold/visible/scrubbers obj/machinery/atmospherics/pipe/manifold/visible/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color=COLOR_RED
obj/machinery/atmospherics/pipe/manifold/visible/yellow obj/machinery/atmospherics/pipe/manifold/visible/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/manifold/visible/cyan obj/machinery/atmospherics/pipe/manifold/visible/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/manifold/visible/green obj/machinery/atmospherics/pipe/manifold/visible/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/manifold/hidden obj/machinery/atmospherics/pipe/manifold/hidden
level = 1 level = 1
icon_state = "manifold-f" 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 obj/machinery/atmospherics/pipe/manifold/hidden/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers obj/machinery/atmospherics/pipe/manifold/hidden/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color = COLOR_RED
obj/machinery/atmospherics/pipe/manifold/hidden/yellow obj/machinery/atmospherics/pipe/manifold/hidden/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/manifold/hidden/cyan obj/machinery/atmospherics/pipe/manifold/hidden/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/manifold/hidden/green obj/machinery/atmospherics/pipe/manifold/hidden/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/manifold4w obj/machinery/atmospherics/pipe/manifold4w
icon = 'icons/obj/atmospherics/pipe_manifold.dmi' icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
icon_state = "manifold4w-f"
name = "4-way pipe manifold" name = "4-way pipe manifold"
desc = "A manifold composed of regular pipes" desc = "A manifold composed of regular pipes"
@@ -579,6 +583,10 @@ obj/machinery/atmospherics/pipe/manifold4w
level = 1 level = 1
layer = 2.4 //under wires with their 2.44 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) obj/machinery/atmospherics/pipe/manifold4w/hide(var/i)
if(level == 1 && istype(loc, /turf/simulated)) if(level == 1 && istype(loc, /turf/simulated))
invisibility = i ? 101 : 0 invisibility = i ? 101 : 0
@@ -651,15 +659,15 @@ obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics
obj/machinery/atmospherics/pipe/manifold4w/update_icon() obj/machinery/atmospherics/pipe/manifold4w/update_icon()
overlays.Cut() overlays.Cut()
if(node1&&node2&&node3&&node4) if(node1&&node2&&node3&&node4)
var/C = ""
switch(pipe_color) switch(pipe_color)
if ("red") C = "-r" if ("red") color = COLOR_RED
if ("blue") C = "-b" if ("blue") color = COLOR_BLUE
if ("cyan") C = "-c" if ("cyan") color = COLOR_CYAN
if ("green") C = "-g" if ("green") color = COLOR_GREEN
if ("yellow") C = "-y" if ("yellow") color = "#FFCC00"
if ("purple") C = "-p" if ("purple") color = "#5C1EC0"
icon_state = "manifold4w[C][invisibility ? "-f" : ""]" if ("grey") color = null
icon_state = "manifold4w[invisibility ? "-f" : "" ]"
else else
icon_state = "manifold4w_ex" icon_state = "manifold4w_ex"
@@ -712,42 +720,43 @@ obj/machinery/atmospherics/pipe/manifold4w/visible
obj/machinery/atmospherics/pipe/manifold4w/visible/supply obj/machinery/atmospherics/pipe/manifold4w/visible/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers obj/machinery/atmospherics/pipe/manifold4w/visible/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color=COLOR_RED
obj/machinery/atmospherics/pipe/manifold4w/visible/yellow obj/machinery/atmospherics/pipe/manifold4w/visible/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/manifold4w/visible/cyan obj/machinery/atmospherics/pipe/manifold4w/visible/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/manifold4w/visible/green obj/machinery/atmospherics/pipe/manifold4w/visible/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/manifold4w/hidden obj/machinery/atmospherics/pipe/manifold4w/hidden
level = 1 level = 1
icon_state = "manifold4w-f" 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 obj/machinery/atmospherics/pipe/manifold4w/hidden/supply
name="Air supply pipe" name="Air supply pipe"
color="#0000FF" color=COLOR_BLUE
obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers obj/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers
name="Scrubbers pipe" name="Scrubbers pipe"
color="#FF0000" color=COLOR_RED
obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow obj/machinery/atmospherics/pipe/manifold4w/hidden/yellow
color="#FFCC00" color="#FFCC00"
obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan obj/machinery/atmospherics/pipe/manifold4w/hidden/cyan
color="#00FFFF" color=COLOR_CYAN
obj/machinery/atmospherics/pipe/manifold4w/hidden/green obj/machinery/atmospherics/pipe/manifold4w/hidden/green
color="#00FF00" color=COLOR_GREEN
obj/machinery/atmospherics/pipe/cap obj/machinery/atmospherics/pipe/cap

View File

@@ -47,6 +47,7 @@ Buildable meters
if (make_from) if (make_from)
src.dir = make_from.dir src.dir = make_from.dir
src.pipename = make_from.name src.pipename = make_from.name
color = make_from.color
var/is_bent var/is_bent
if (make_from.initialize_directions in list(NORTH|SOUTH, WEST|EAST)) if (make_from.initialize_directions in list(NORTH|SOUTH, WEST|EAST))
is_bent = 0 is_bent = 0
@@ -299,6 +300,7 @@ Buildable meters
switch(pipe_type) switch(pipe_type)
if(PIPE_SIMPLE_STRAIGHT, PIPE_SIMPLE_BENT) if(PIPE_SIMPLE_STRAIGHT, PIPE_SIMPLE_BENT)
var/obj/machinery/atmospherics/pipe/simple/P = new( src.loc ) var/obj/machinery/atmospherics/pipe/simple/P = new( src.loc )
P.color = color
P.dir = src.dir P.dir = src.dir
P.initialize_directions = pipe_dir P.initialize_directions = pipe_dir
var/turf/T = P.loc var/turf/T = P.loc
@@ -351,6 +353,7 @@ Buildable meters
if(PIPE_MANIFOLD) //manifold if(PIPE_MANIFOLD) //manifold
var/obj/machinery/atmospherics/pipe/manifold/M = new( src.loc ) var/obj/machinery/atmospherics/pipe/manifold/M = new( src.loc )
M.color = color
M.dir = dir M.dir = dir
M.initialize_directions = pipe_dir M.initialize_directions = pipe_dir
//M.New() //M.New()
@@ -373,6 +376,7 @@ Buildable meters
if(PIPE_MANIFOLD4W) //4-way manifold if(PIPE_MANIFOLD4W) //4-way manifold
var/obj/machinery/atmospherics/pipe/manifold4w/M = new( src.loc ) var/obj/machinery/atmospherics/pipe/manifold4w/M = new( src.loc )
M.color = color
M.dir = dir M.dir = dir
M.initialize_directions = pipe_dir M.initialize_directions = pipe_dir
//M.New() //M.New()