Geeves
2024-05-02 00:34:15 +02:00
committed by GitHub
parent 61748c7429
commit 3e43bea584
7 changed files with 117 additions and 59 deletions
+10 -1
View File
@@ -139,4 +139,13 @@
#define CONNECT_TYPE_FUEL 16
#define CONNECT_TYPE_AUX 32
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)
GLOBAL_LIST_INIT(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
))
+11
View File
@@ -14,6 +14,17 @@
level = 2
obj_flags = OBJ_FLAG_ROTATABLE
/obj/item/pipe/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
var/pipe_color_check = color || PIPE_COLOR_GREY
var/found_color_name = "Unknown"
for(var/color_name in GLOB.pipe_colors)
var/color_value = GLOB.pipe_colors[color_name]
if(pipe_color_check == color_value)
found_color_name = color_name
break
. += "This pipe is: <span style='color:[pipe_color_check == PIPE_COLOR_GREY ? COLOR_GRAY : pipe_color_check]'>[capitalize(found_color_name)]</span>"
/obj/item/pipe/New(var/loc, var/pipe_type, var/dir, var/obj/machinery/atmospherics/make_from)
..()
if (make_from)
@@ -10,7 +10,7 @@
/obj/item/device/pipe_painter/New()
..()
modes = new()
for(var/C in pipe_colors)
for(var/C in GLOB.pipe_colors)
modes += "[C]"
mode = pick(modes)
@@ -23,10 +23,10 @@
return
else if(istype(A,/obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/P = A
P.change_color(pipe_colors[mode])
else if(istype(A, /obj/item/pipe) && pipe_color_check(pipe_colors[mode]))
P.change_color(GLOB.pipe_colors[mode])
else if(istype(A, /obj/item/pipe) && pipe_color_check(GLOB.pipe_colors[mode]))
var/obj/item/pipe/P = A
P.color = pipe_colors[mode]
P.color = GLOB.pipe_colors[mode]
/obj/item/device/pipe_painter/attack_self(var/mob/user)
mode = tgui_input_list(user, "Which colour do you want to use?", "Pipe Painter", modes, mode)
+31 -31
View File
@@ -1,21 +1,21 @@
//--------------------------------------------
// Pipe colors
//
// Add them here and to the pipe_colors list
// Add them here and to the GLOB.pipe_colors list
// to automatically add them to all relevant
// atmospherics devices.
//--------------------------------------------
/proc/pipe_color_lookup(var/color)
for(var/C in pipe_colors)
if(color == pipe_colors[C])
for(var/C in GLOB.pipe_colors)
if(color == GLOB.pipe_colors[C])
return "[C]"
/proc/pipe_color_check(var/color)
if(!color)
return 1
for(var/C in pipe_colors)
if(color == pipe_colors[C])
for(var/C in GLOB.pipe_colors)
if(color == GLOB.pipe_colors[C])
return 1
return 0
@@ -95,10 +95,10 @@
var/image/I = image('icons/atmos/pipes.dmi', icon_state = state)
pipe_icons[cache_name] = I
for(var/pipe_color in pipe_colors)
for(var/pipe_color in GLOB.pipe_colors)
I = image('icons/atmos/pipes.dmi', icon_state = state)
I.color = pipe_colors[pipe_color]
pipe_icons[state + "[pipe_colors[pipe_color]]"] = I
I.color = GLOB.pipe_colors[pipe_color]
pipe_icons[state + "[GLOB.pipe_colors[pipe_color]]"] = I
pipe = new ('icons/atmos/heat.dmi')
for(var/state in pipe.IconStates())
@@ -128,10 +128,10 @@
if(findtext(state, "core") || findtext(state, "4way"))
var/image/I = image('icons/atmos/manifold.dmi', icon_state = state)
manifold_icons[state] = I
for(var/pipe_color in pipe_colors)
for(var/pipe_color in GLOB.pipe_colors)
I = image('icons/atmos/manifold.dmi', icon_state = state)
I.color = pipe_colors[pipe_color]
manifold_icons[state + pipe_colors[pipe_color]] = I
I.color = GLOB.pipe_colors[pipe_color]
manifold_icons[state + GLOB.pipe_colors[pipe_color]] = I
/datum/pipe_icon_manager/proc/gen_device_icons()
if(!device_icons)
@@ -179,10 +179,10 @@
for(var/D in GLOB.cardinal)
var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
underlays[cache_name + "[D]"] = I
for(var/pipe_color in pipe_colors)
for(var/pipe_color in GLOB.pipe_colors)
I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
I.color = pipe_colors[pipe_color]
underlays[state + "[D]" + "[pipe_colors[pipe_color]]"] = I
I.color = GLOB.pipe_colors[pipe_color]
underlays[state + "[D]" + "[GLOB.pipe_colors[pipe_color]]"] = I
/*
Leaving the old icon manager code commented out for now, as we may want to rewrite the new code to cleanly
@@ -241,39 +241,39 @@
pipe_underlays_exposed["[D]"] = I
if("pipe_intact-scrubbers")
pipe_underlays_intact["[D]"] = I
for(var/pipe_color in pipe_colors)
for(var/pipe_color in GLOB.pipe_colors)
I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
I.color = pipe_colors[pipe_color]
I.color = GLOB.pipe_colors[pipe_color]
switch(state)
if("intact")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("exposed")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("down")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
underlays_down["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_exposed")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_intact")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("intact-supply")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("exposed-supply")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("down-supply")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
underlays_down["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_exposed-supply")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_intact-supply")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("intact-scrubbers")
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("exposed-scrubbers")
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("down-scrubbers")
underlays_down["[D]" + pipe_colors[pipe_color]] = I
underlays_down["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_exposed-scrubbers")
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_exposed["[D]" + GLOB.pipe_colors[pipe_color]] = I
if("pipe_intact-scrubbers")
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
pipe_underlays_intact["[D]" + GLOB.pipe_colors[pipe_color]] = I
*/
+11
View File
@@ -26,6 +26,17 @@
desc_info += "<br>Most pipes and atmospheric devices can be connected or disconnected with a wrench. The pipe's pressure must not be too high, \
or if it is a device, it must be turned off first."
/obj/machinery/atmospherics/pipe/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
var/pipe_color_check = pipe_color || PIPE_COLOR_GREY
var/found_color_name = "Unknown"
for(var/color_name in GLOB.pipe_colors)
var/color_value = GLOB.pipe_colors[color_name]
if(pipe_color_check == color_value)
found_color_name = color_name
break
. += "This pipe is: <span style='color:[pipe_color_check == PIPE_COLOR_GREY ? COLOR_GRAY : pipe_color_check]'>[capitalize(found_color_name)]</span>"
/obj/machinery/atmospherics/pipe/hides_under_flooring()
return level != 2
+44 -23
View File
@@ -1,3 +1,14 @@
GLOBAL_LIST_INIT(cable_coil_colours, list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
"Blue" = COLOR_BLUE,
"Orange" = COLOR_ORANGE,
"Cyan" = COLOR_CYAN,
"Red" = COLOR_RED,
"White" = COLOR_WHITE
))
///////////////////////////////
//CABLE STRUCTURE
///////////////////////////////
@@ -36,6 +47,16 @@ By design, d1 is the smallest direction and d2 is the highest
color = COLOR_RED
var/obj/machinery/power/breakerbox/breaker_box
/obj/structure/cable/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
var/found_color_name = "Unknown"
for(var/color_name in GLOB.cable_coil_colours)
var/color_value = GLOB.cable_coil_colours[color_name]
if(color == color_value)
found_color_name = color_name
break
. += "This cable is: <span style='color:[color]'>[found_color_name]</span>"
/obj/structure/cable/drain_power(var/drain_check, var/surge, var/amount = 0)
if(drain_check)
@@ -490,16 +511,6 @@ By design, d1 is the smallest direction and d2 is the highest
drop_sound = 'sound/items/drop/accessory.ogg'
pickup_sound = 'sound/items/pickup/accessory.ogg'
surgerysound = 'sound/items/surgery/fixovein.ogg'
var/static/list/possible_cable_coil_colours = list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
"Blue" = COLOR_BLUE,
"Orange" = COLOR_ORANGE,
"Cyan" = COLOR_CYAN,
"Red" = COLOR_RED,
"White" = COLOR_WHITE
)
build_from_parts = TRUE
worn_overlay = "end"
@@ -517,6 +528,22 @@ By design, d1 is the smallest direction and d2 is the highest
update_icon()
update_wclass()
/obj/item/stack/cable_coil/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
var/found_color_name = "Unknown"
for(var/color_name in GLOB.cable_coil_colours)
var/color_value = GLOB.cable_coil_colours[color_name]
if(color == color_value)
found_color_name = color_name
break
. += "This cable is: <span style='color:[color]'>[found_color_name]</span>"
if(!uses_charge)
. += "There [src.amount == 1 ? "is" : "are"] <b>[src.amount]</b> [src.singular_name]\s of cable in the coil."
else
. += "You have enough charge to produce <b>[get_amount()]</b>."
/obj/item/stack/cable_coil/attack(mob/living/carbon/M, mob/user)
if(ishuman(M) && user.a_intent == I_HELP)
var/mob/living/carbon/human/H = M
@@ -610,7 +637,7 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/item/stack/cable_coil/update_icon()
if(!color)
color = pick(possible_cable_coil_colours)
color = pick(GLOB.cable_coil_colours)
name = "[initial(name)]"
if(amount == 1)
icon_state = "[initial(icon_state)]1"
@@ -635,16 +662,16 @@ By design, d1 is the smallest direction and d2 is the highest
return ..()
/obj/item/stack/cable_coil/proc/choose_cable_color(var/user)
var/selected_type = tgui_input_list(user, "Pick a new colour.", "Cable Colour", possible_cable_coil_colours)
var/selected_type = tgui_input_list(user, "Pick a new colour.", "Cable Colour", GLOB.cable_coil_colours)
set_cable_color(selected_type, user)
/obj/item/stack/cable_coil/proc/set_cable_color(selected_color, var/user)
if(!selected_color)
return
var/final_color = possible_cable_coil_colours[selected_color]
var/final_color = GLOB.cable_coil_colours[selected_color]
if(!final_color)
final_color = possible_cable_coil_colours["Red"]
final_color = GLOB.cable_coil_colours["Red"]
selected_color = "Red"
color = final_color
to_chat(user, SPAN_NOTICE("You change \the [src]'s color to [lowertext(selected_color)]."))
@@ -657,13 +684,6 @@ By design, d1 is the smallest direction and d2 is the highest
w_class = ITEMSIZE_SMALL
slot_flags = SLOT_BELT
/obj/item/stack/cable_coil/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
if(!uses_charge)
. += "There [src.amount == 1 ? "is" : "are"] <b>[src.amount]</b> [src.singular_name]\s of cable in the coil."
else
. += "You have enough charge to produce <b>[get_amount()]</b>."
/obj/item/stack/cable_coil/verb/make_restraint()
set name = "Make Cable Restraints"
set category = "Object"
@@ -985,8 +1005,9 @@ By design, d1 is the smallest direction and d2 is the highest
color = COLOR_WHITE
/obj/item/stack/cable_coil/random/Initialize()
color = pick(possible_cable_coil_colours)
. = ..()
var/color_name = pick(GLOB.cable_coil_colours)
color = GLOB.cable_coil_colours[color_name]
return ..()
//////////////////////////////
// Nooses.
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- rscadd: "Examining a pipe or cable will now display its color as text."