WireArt: Fixed and improved (#55622)

Cyborg's pipe cleaner is now using a radial menu for choosing it's colors instead of a clumsy input one.

RCL now properly updates it's pipe cleaner holder's color, so you can actually see the color when using RCL radial menu.

RCL is now able to put cables down on floors seamlessly, as there is no reason to restrict it to just a plating and catwalks anymore due to the fact that pipe cleaner coils no longer function as a power carriers, but are merely visual entities for players to play with.

And lastly, pipe cleaners now use color defines and are setting its color directly instead of having redundant variable do it for them, which was needlessly complicating it.
This commit is contained in:
Arkatos1
2020-12-24 01:05:05 -08:00
committed by GitHub
parent b95a240c4b
commit f483ed1157
3 changed files with 97 additions and 96 deletions
+83 -89
View File
@@ -1,12 +1,12 @@
GLOBAL_LIST_INIT(pipe_cleaner_colors, list(
"yellow" = "#ffff00",
"green" = "#00aa00",
"blue" = "#1919c8",
"pink" = "#ff3cc8",
"orange" = "#ff8000",
"cyan" = "#00ffff",
"white" = "#ffffff",
"red" = "#ff0000"
"blue" = COLOR_STRONG_BLUE,
"cyan" = COLOR_CYAN,
"green" = COLOR_DARK_LIME,
"orange" = COLOR_MOSTLY_PURE_ORANGE,
"pink" = COLOR_LIGHT_PINK,
"red" = COLOR_RED,
"white" = COLOR_WHITE,
"yellow" = COLOR_YELLOW
))
//This is the old cable code, but minus any actual powernet logic
@@ -42,40 +42,34 @@ By design, d1 is the smallest direction and d2 is the highest
layer = WIRE_LAYER //Above hidden pipes, GAS_PIPE_HIDDEN_LAYER
anchored = TRUE
obj_flags = CAN_BE_HIT | ON_BLUEPRINTS
var/d1 = 0 // pipe_cleaner direction 1 (see above)
var/d2 = 1 // pipe_cleaner direction 2 (see above)
color = COLOR_RED
/// Pipe_cleaner direction 1 (see above)
var/d1 = 0
/// pipe_cleaner direction 2 (see above)
var/d2 = 1
/// Internal cable stack
var/obj/item/stack/pipe_cleaner_coil/stored
var/pipe_cleaner_color = "red"
color = "#ff0000"
/obj/structure/pipe_cleaner/yellow
pipe_cleaner_color = "yellow"
color = "#ffff00"
color = COLOR_YELLOW
/obj/structure/pipe_cleaner/green
pipe_cleaner_color = "green"
color = "#00aa00"
color = COLOR_DARK_LIME
/obj/structure/pipe_cleaner/blue
pipe_cleaner_color = "blue"
color = "#1919c8"
color = COLOR_STRONG_BLUE
/obj/structure/pipe_cleaner/pink
pipe_cleaner_color = "pink"
color = "#ff3cc8"
color = COLOR_LIGHT_PINK
/obj/structure/pipe_cleaner/orange
pipe_cleaner_color = "orange"
color = "#ff8000"
color = COLOR_MOSTLY_PURE_ORANGE
/obj/structure/pipe_cleaner/cyan
pipe_cleaner_color = "cyan"
color = "#00ffff"
color = COLOR_CYAN
/obj/structure/pipe_cleaner/white
pipe_cleaner_color = "white"
color = "#ffffff"
color = COLOR_WHITE
// the power pipe_cleaner object
/obj/structure/pipe_cleaner/Initialize(mapload, param_color)
@@ -87,14 +81,15 @@ By design, d1 is the smallest direction and d2 is the highest
d2 = text2num(copytext(icon_state, dash + length(icon_state[dash])))
if(d1)
stored = new/obj/item/stack/pipe_cleaner_coil(null,2,pipe_cleaner_color)
stored = new/obj/item/stack/pipe_cleaner_coil(null, 2, color)
else
stored = new/obj/item/stack/pipe_cleaner_coil(null,1,pipe_cleaner_color)
stored = new/obj/item/stack/pipe_cleaner_coil(null, 1, color)
var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors
pipe_cleaner_color = param_color || pipe_cleaner_color || pick(pipe_cleaner_colors)
if(pipe_cleaner_colors[pipe_cleaner_color])
pipe_cleaner_color = pipe_cleaner_colors[pipe_cleaner_color]
color = param_color || color
if(!color)
var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors
var/random_color = pick(pipe_cleaner_colors)
color = pipe_cleaner_colors[random_color]
update_icon()
/obj/structure/pipe_cleaner/Destroy() // called when a pipe_cleaner is deleted
@@ -120,8 +115,7 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/pipe_cleaner/update_icon()
icon_state = "[d1]-[d2]"
color = null
add_atom_colour(pipe_cleaner_color, FIXED_COLOUR_PRIORITY)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
// Items usable on a pipe_cleaner :
// - Wirecutters : cut it duh !
@@ -150,15 +144,14 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/pipe_cleaner/attackby(obj/item/W, mob/user, params)
handlecable(W, user, params)
/obj/structure/pipe_cleaner/singularity_pull(S, current_size)
..()
if(current_size >= STAGE_FIVE)
deconstruct()
/obj/structure/pipe_cleaner/proc/update_stored(length = 1, colorC = "red")
/obj/structure/pipe_cleaner/proc/update_stored(length = 1, colorC = COLOR_RED)
stored.amount = length
stored.pipe_cleaner_color = colorC
stored.color = colorC
stored.update_icon()
/obj/structure/pipe_cleaner/AltClick(mob/living/user)
@@ -203,16 +196,37 @@ By design, d1 is the smallest direction and d2 is the highest
usesound = 'sound/items/deconstruct.ogg'
cost = 1
source = /datum/robot_energy_storage/pipe_cleaner
/// Currently set cable color
var/pipe_cleaner_color = COLOR_RED
color = COLOR_RED
/obj/item/stack/pipe_cleaner_coil/cyborg/attack_self(mob/user)
var/selected_color = input(user, "Pick a pipe cleaner color.", "Cable Color") as null|anything in list("blue", "cyan", "green", "orange", "pink", "red", "white", "yellow")
var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors
var/list/possible_colors = list()
for(var/color in pipe_cleaner_colors)
var/image/pipe_icon = image(icon = src.icon, icon_state = src.icon_state)
pipe_icon.color = pipe_cleaner_colors[color]
possible_colors += list("[color]" = pipe_icon)
var/selected_color = show_radial_menu(user, src, possible_colors, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 40, require_near = TRUE)
if(!selected_color)
return
pipe_cleaner_color = GLOB.pipe_cleaner_colors[selected_color]
color = pipe_cleaner_colors[selected_color]
update_icon()
/**
* Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The mob interacting with the menu
*/
/obj/item/stack/pipe_cleaner_coil/cyborg/proc/check_menu(mob/user)
if(!istype(user))
return FALSE
if(!user.is_holding(src))
return FALSE
if(user.incapacitated())
return FALSE
return TRUE
/obj/item/stack/pipe_cleaner_coil/suicide_act(mob/user)
if(locate(/obj/structure/chair/stool) in get_turf(user))
user.visible_message("<span class='suicide'>[user] is making a noose with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -223,10 +237,11 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/item/stack/pipe_cleaner_coil/Initialize(mapload, new_amount = null, param_color = null)
. = ..()
var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors
pipe_cleaner_color = param_color || pipe_cleaner_color || pick(pipe_cleaner_colors)
if(pipe_cleaner_colors[pipe_cleaner_color])
pipe_cleaner_color = pipe_cleaner_colors[pipe_cleaner_color]
color = param_color || color
if(!color)
var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors
var/random_color = pick(pipe_cleaner_colors)
color = pipe_cleaner_colors[random_color]
pixel_x = base_pixel_x + rand(-2, 2)
pixel_y = base_pixel_y + rand(-2, 2)
@@ -236,12 +251,10 @@ By design, d1 is the smallest direction and d2 is the highest
// General procedures
///////////////////////////////////
/obj/item/stack/pipe_cleaner_coil/update_icon()
icon_state = "[initial(inhand_icon_state)][amount < 3 ? amount : ""]"
name = "pipe cleaner [amount < 3 ? "piece" : "coil"]"
color = null
add_atom_colour(pipe_cleaner_color, FIXED_COLOUR_PRIORITY)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
/obj/item/stack/pipe_cleaner_coil/attack_hand(mob/user)
. = ..()
@@ -249,7 +262,7 @@ By design, d1 is the smallest direction and d2 is the highest
return
var/obj/item/stack/pipe_cleaner_coil/new_pipe_cleaner = ..()
if(istype(new_pipe_cleaner))
new_pipe_cleaner.pipe_cleaner_color = pipe_cleaner_color
new_pipe_cleaner.color = color
new_pipe_cleaner.update_icon()
//add pipe_cleaners to the stack
@@ -260,15 +273,13 @@ By design, d1 is the smallest direction and d2 is the highest
amount += extra
update_icon()
///////////////////////////////////////////////
// Cable laying procedures
//////////////////////////////////////////////
/obj/item/stack/pipe_cleaner_coil/proc/get_new_pipe_cleaner(location)
var/path = /obj/structure/pipe_cleaner
return new path(location, pipe_cleaner_color)
return new path(location, color)
// called when pipe_cleaner_coil is clicked on a turf
/obj/item/stack/pipe_cleaner_coil/proc/place_turf(turf/T, mob/user, dirnew)
@@ -395,7 +406,7 @@ By design, d1 is the smallest direction and d2 is the highest
C.d2 = nd2
//updates the stored pipe_cleaner coil
C.update_stored(2, pipe_cleaner_color)
C.update_stored(2, color)
C.add_fingerprint(user)
C.update_icon()
@@ -409,40 +420,31 @@ By design, d1 is the smallest direction and d2 is the highest
/////////////////////////////
/obj/item/stack/pipe_cleaner_coil/red
pipe_cleaner_color = "red"
color = "#ff0000"
color = COLOR_RED
/obj/item/stack/pipe_cleaner_coil/yellow
pipe_cleaner_color = "yellow"
color = "#ffff00"
color = COLOR_YELLOW
/obj/item/stack/pipe_cleaner_coil/blue
pipe_cleaner_color = "blue"
color = "#1919c8"
color = COLOR_STRONG_BLUE
/obj/item/stack/pipe_cleaner_coil/green
pipe_cleaner_color = "green"
color = "#00aa00"
color = COLOR_DARK_LIME
/obj/item/stack/pipe_cleaner_coil/pink
pipe_cleaner_color = "pink"
color = "#ff3ccd"
color = COLOR_LIGHT_PINK
/obj/item/stack/pipe_cleaner_coil/orange
pipe_cleaner_color = "orange"
color = "#ff8000"
color = COLOR_MOSTLY_PURE_ORANGE
/obj/item/stack/pipe_cleaner_coil/cyan
pipe_cleaner_color = "cyan"
color = "#00ffff"
color = COLOR_CYAN
/obj/item/stack/pipe_cleaner_coil/white
pipe_cleaner_color = "white"
color = COLOR_WHITE
/obj/item/stack/pipe_cleaner_coil/random
pipe_cleaner_color = null
color = "#ffffff"
color = null
/obj/item/stack/pipe_cleaner_coil/random/five
amount = 5
@@ -460,36 +462,28 @@ By design, d1 is the smallest direction and d2 is the highest
update_icon()
/obj/item/stack/pipe_cleaner_coil/cut/red
pipe_cleaner_color = "red"
color = "#ff0000"
color = COLOR_RED
/obj/item/stack/pipe_cleaner_coil/cut/yellow
pipe_cleaner_color = "yellow"
color = "#ffff00"
color = COLOR_YELLOW
/obj/item/stack/pipe_cleaner_coil/cut/blue
pipe_cleaner_color = "blue"
color = "#1919c8"
color = COLOR_STRONG_BLUE
/obj/item/stack/pipe_cleaner_coil/cut/green
pipe_cleaner_color = "green"
color = "#00aa00"
color = COLOR_DARK_LIME
/obj/item/stack/pipe_cleaner_coil/cut/pink
pipe_cleaner_color = "pink"
color = "#ff3ccd"
color = COLOR_LIGHT_PINK
/obj/item/stack/pipe_cleaner_coil/cut/orange
pipe_cleaner_color = "orange"
color = "#ff8000"
color = COLOR_MOSTLY_PURE_ORANGE
/obj/item/stack/pipe_cleaner_coil/cut/cyan
pipe_cleaner_color = "cyan"
color = "#00ffff"
color = COLOR_CYAN
/obj/item/stack/pipe_cleaner_coil/cut/white
pipe_cleaner_color = "white"
color = COLOR_WHITE
/obj/item/stack/pipe_cleaner_coil/cut/random
pipe_cleaner_color = null
color = "#ffffff"
color = null