Changes the values of the pen colour variable from color name to hexadecimal (#65553)

About The Pull Request

See the title. Hexadecimal values are better than color names for programming since they can be sanitized and are more easily converted to RGB(A) or HSV. Color names aren't really meant to be used in some functions and methods about colors.

TL;DR: color names don't work with the Color common package in the TGUI folder.
Why It's Good For The Game

This will remove the need of a hacky bandaid from /obj/item/canvas/proc/get_paint_tool_color that only covers about half the pen colors anyway.
Changelog

cl
fix: Fixed certain pens breaking painting on a canvas because of their peculiar colors.
/cl
This commit is contained in:
Ghom
2022-04-01 11:38:18 +13:00
committed by GitHub
parent ef8866db05
commit 4d41a2186a
2 changed files with 24 additions and 26 deletions
+2 -9
View File
@@ -301,15 +301,8 @@
var/obj/item/toy/crayon/crayon = painting_implement
return crayon.paint_color
else if(istype(painting_implement, /obj/item/pen))
var/obj/item/pen/P = painting_implement
switch(P.colour)
if("black")
return "#000000"
if("blue")
return "#0000ff"
if("red")
return "#ff0000"
return P.colour
var/obj/item/pen/pen = painting_implement
return pen.colour
else if(istype(painting_implement, /obj/item/soap) || istype(painting_implement, /obj/item/reagent_containers/glass/rag))
return canvas_color
+22 -17
View File
@@ -25,7 +25,7 @@
custom_materials = list(/datum/material/iron=10)
pressure_resistance = 2
grind_results = list(/datum/reagent/iron = 2, /datum/reagent/iodine = 1)
var/colour = "black" //what colour the ink is!
var/colour = "#000000" //what colour the ink is!
var/degrees = 0
var/font = PEN_FONT
embedding = list(embed_chance = 50)
@@ -38,39 +38,44 @@
/obj/item/pen/blue
desc = "It's a normal blue ink pen."
icon_state = "pen_blue"
colour = "blue"
colour = "#0000FF"
/obj/item/pen/red
desc = "It's a normal red ink pen."
icon_state = "pen_red"
colour = "red"
colour = "#FF0000"
throw_speed = 4 // red ones go faster (in this case, fast enough to embed!)
/obj/item/pen/invisible
desc = "It's an invisible pen marker."
icon_state = "pen"
colour = "white"
colour = "#FFFFFF"
/obj/item/pen/fourcolor
desc = "It's a fancy four-color ink pen, set to black."
name = "four-color pen"
icon_state = "pen_4color"
colour = "black"
colour = "#000000"
/obj/item/pen/fourcolor/attack_self(mob/living/carbon/user)
. = ..()
var/chosen_color = "black"
switch(colour)
if("black")
colour = "red"
if("#000000")
colour = "#FF0000"
chosen_color = "red"
throw_speed++
if("red")
colour = "green"
if("#FF0000")
colour = "#00FF00"
chosen_color = "green"
throw_speed = initial(throw_speed)
if("green")
colour = "blue"
if("#00FF00")
colour = "#0000FF"
chosen_color = "blue"
else
colour = "black"
to_chat(user, span_notice("\The [src] will now write in [colour]."))
desc = "It's a fancy four-color ink pen, set to [colour]."
colour = "#000000"
to_chat(user, span_notice("\The [src] will now write in [chosen_color]."))
desc = "It's a fancy four-color ink pen, set to [chosen_color]."
/obj/item/pen/fountain
name = "fountain pen"
@@ -82,7 +87,7 @@
name = "charcoal stylus"
desc = "It's just a wooden stick with some compressed ash on the end. At least it can write."
icon_state = "pen-charcoal"
colour = "dimgray"
colour = "#696969"
font = CHARCOAL_FONT
custom_materials = null
grind_results = list(/datum/reagent/ash = 5, /datum/reagent/cellulose = 10)
@@ -101,7 +106,7 @@
force = 5
throwforce = 5
throw_speed = 4
colour = "crimson"
colour = "#DC143C"
custom_materials = list(/datum/material/gold = 750)
sharpness = SHARP_EDGED
resistance_flags = FIRE_PROOF
@@ -309,4 +314,4 @@
tool_behaviour = TOOL_MINING //For the classic "digging out of prison with a spoon but you're in space so this analogy doesn't work" situation.
toolspeed = 10 //You will never willingly choose to use one of these over a shovel.
font = FOUNTAIN_PEN_FONT
colour = "blue"
colour = "#0000FF"