Skip to content

Commit

Permalink
refactor to reduce the number variable using colour in them instead o…
Browse files Browse the repository at this point in the history
…f color. (#5472)

# About the pull request
another PR to reduce the number of time colour is being used for
variables.

did some change of comment to be to standard format too.

left with 54 instance of colour in 15 differents files. most that is
left have color var that could create conflit so i would rather do in a
seperate PR later.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
refactor: refactor to reduce the number variable using colour in them
instead of color.
/:cl:

Co-authored-by: Julien <[email protected]>
  • Loading branch information
Huffie56 and Julien authored Jan 18, 2024
1 parent 192f2f1 commit ac9a7e6
Show file tree
Hide file tree
Showing 21 changed files with 123 additions and 120 deletions.
10 changes: 5 additions & 5 deletions code/game/jobs/job/marine/squads.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
/// If uses the overlay
var/use_stripe_overlay = TRUE
/// Color for the squad marines gear overlays
var/equipment_color = "#FFFFFF"
var/equipment_color = COLOR_WHITE
/// The alpha for the armor overlay used by equipment color
var/armor_alpha = 125
/// Color for the squad marines langchat
var/chat_color = "#FFFFFF"
var/chat_color = COLOR_WHITE
/// Which special access do we grant them
var/list/access = list()
/// Can use any squad vendor regardless of squad connection
Expand Down Expand Up @@ -400,17 +400,17 @@

/// Displays a message to squad members directly on the game map
/datum/squad/proc/send_maptext(text = "", title_text = "", only_leader = 0)
var/message_colour = chat_color
var/message_color = chat_color
if(only_leader)
if(squad_leader)
if(!squad_leader.stat && squad_leader.client)
playsound_client(squad_leader.client, 'sound/effects/radiostatic.ogg', squad_leader.loc, 25, FALSE)
squad_leader.play_screen_text("<span class='langchat' style=font-size:16pt;text-align:center valign='top'><u>[title_text]</u></span><br>" + text, /atom/movable/screen/text/screen_text/command_order, message_colour)
squad_leader.play_screen_text("<span class='langchat' style=font-size:16pt;text-align:center valign='top'><u>[title_text]</u></span><br>" + text, /atom/movable/screen/text/screen_text/command_order, message_color)
else
for(var/mob/living/carbon/human/marine in marines_list)
if(!marine.stat && marine.client) //Only living and connected people in our squad
playsound_client(marine.client, 'sound/effects/radiostatic.ogg', marine.loc, 25, FALSE)
marine.play_screen_text("<span class='langchat' style=font-size:16pt;text-align:center valign='top'><u>[title_text]</u></span><br>" + text, /atom/movable/screen/text/screen_text/command_order, message_colour)
marine.play_screen_text("<span class='langchat' style=font-size:16pt;text-align:center valign='top'><u>[title_text]</u></span><br>" + text, /atom/movable/screen/text/screen_text/command_order, message_color)

/// Displays a message to the squad members in chat
/datum/squad/proc/send_message(text = "", plus_name = 0, only_leader = 0)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/taperecorder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
var/unspooled = FALSE
var/list/icons_available = list()
var/radial_icon_file = 'icons/mob/radial_tape.dmi'
var/list/cassette_colours = list("blue", "gray", "green", "orange", "pink_stripe", "purple", "rainbow", "red_black", "red_stripe", "camo", "rising_sun", "orange", "blue", "ocean", "aesthetic")
var/list/cassette_colors = list("blue", "gray", "green", "orange", "pink_stripe", "purple", "rainbow", "red_black", "red_stripe", "camo", "rising_sun", "orange", "blue", "ocean", "aesthetic")
var/list/cassette_map_themes = list("solaris", "ice", "lz", "dam", "worstmap")
inherent_traits = list(TRAIT_ITEM_RENAME_SPECIAL) //used to make the rename component work specially.
///used to store the tape's name for one side and the other side
Expand Down Expand Up @@ -501,7 +501,7 @@
icon_state = "cassette_rainbow"

/obj/item/tape/random/Initialize(mapload)
icon_state = "cassette_[pick(cassette_colours)]"
icon_state = "cassette_[pick(cassette_colors)]"
. = ..()

/obj/item/tape/regulation
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/reagent_containers/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@
/obj/item/reagent_container/food/snacks/egg/attackby(obj/item/W as obj, mob/user as mob)
if(istype( W, /obj/item/toy/crayon ))
var/obj/item/toy/crayon/C = W
var/clr = C.colourName
var/clr = C.colorName

if(!(clr in list("blue","green","mime","orange","purple","rainbow","red","yellow")))
to_chat(usr, SPAN_NOTICE(" The egg refuses to take on this color!"))
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/fancy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@
overlays = list() //resets list
overlays += image('icons/obj/items/crayons.dmi',"crayonbox")
for(var/obj/item/toy/crayon/crayon in contents)
overlays += image('icons/obj/items/crayons.dmi',crayon.colourName)
overlays += image('icons/obj/items/crayons.dmi',crayon.colorName)

/obj/item/storage/fancy/crayons/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/toy/crayon))
switch(W:colourName)
switch(W:colorName)
if("mime")
to_chat(usr, "This crayon is too sad to be contained in this box.")
return
Expand Down
42 changes: 21 additions & 21 deletions code/game/objects/items/toys/crayons.dm
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
/obj/item/toy/crayon/red
icon_state = "crayonred"
crayon_color = "#DA0000"
shadeColour = "#810C0C"
colourName = "red"
shade_color = "#810C0C"
colorName = "red"

/obj/item/toy/crayon/orange
icon_state = "crayonorange"
crayon_color = "#FF9300"
shadeColour = "#A55403"
colourName = "orange"
shade_color = "#A55403"
colorName = "orange"

/obj/item/toy/crayon/yellow
icon_state = "crayonyellow"
crayon_color = "#FFF200"
shadeColour = "#886422"
colourName = "yellow"
shade_color = "#886422"
colorName = "yellow"

/obj/item/toy/crayon/green
icon_state = "crayongreen"
crayon_color = "#A8E61D"
shadeColour = "#61840F"
colourName = "green"
shade_color = "#61840F"
colorName = "green"

/obj/item/toy/crayon/blue
icon_state = "crayonblue"
crayon_color = "#00B7EF"
shadeColour = "#0082A8"
colourName = "blue"
shade_color = "#0082A8"
colorName = "blue"

/obj/item/toy/crayon/purple
icon_state = "crayonpurple"
crayon_color = "#DA00FF"
shadeColour = "#810CFF"
colourName = "purple"
shade_color = "#810CFF"
colorName = "purple"

/obj/item/toy/crayon/mime
icon_state = "crayonmime"
desc = "A very sad-looking crayon."
crayon_color = COLOR_WHITE
shadeColour = COLOR_BLACK
colourName = "mime"
shade_color = COLOR_BLACK
colorName = "mime"
uses = 0

/obj/item/toy/crayon/mime/attack_self(mob/living/user) //inversion
..()

if(crayon_color != COLOR_WHITE && shadeColour != COLOR_BLACK)
if(crayon_color != COLOR_WHITE && shade_color != COLOR_BLACK)
crayon_color = COLOR_WHITE
shadeColour = COLOR_BLACK
shade_color = COLOR_BLACK
to_chat(user, "You will now draw in white and black with this crayon.")
else
crayon_color = COLOR_BLACK
shadeColour = COLOR_WHITE
shade_color = COLOR_WHITE
to_chat(user, "You will now draw in black and white with this crayon.")

/obj/item/toy/crayon/rainbow
icon_state = "crayonrainbow"
crayon_color = "#FFF000"
shadeColour = "#000FFF"
colourName = "rainbow"
shade_color = "#000FFF"
colorName = "rainbow"
uses = 0

/obj/item/toy/crayon/rainbow/attack_self(mob/living/user)
..()
crayon_color = input(user, "Please select the main color.", "Crayon color") as color
shadeColour = input(user, "Please select the shade color.", "Crayon color") as color
shade_color = input(user, "Please select the shade color.", "Crayon color") as color

/obj/item/toy/crayon/afterattack(atom/target, mob/user, proximity)
if(!proximity)
Expand All @@ -80,7 +80,7 @@
if("rune")
to_chat(user, "You start drawing a rune on the [target.name].")
if(instant || do_after(user, 50, INTERRUPT_ALL, BUSY_ICON_GENERIC))
new /obj/effect/decal/cleanable/crayon(target,crayon_color,shadeColour,drawtype)
new /obj/effect/decal/cleanable/crayon(target,crayon_color,shade_color,drawtype)
to_chat(user, "You finish drawing.")
target.add_fingerprint(user) // Adds their fingerprints to the floor the crayon is drawn on.
if(uses)
Expand Down
17 changes: 7 additions & 10 deletions code/game/objects/items/toys/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* Other things
*/


//recreational items

/obj/item/toy
Expand All @@ -23,7 +22,6 @@
force = 0
black_market_value = 5


/*
* Balloons
*/
Expand Down Expand Up @@ -118,24 +116,24 @@
icon_state = "singularity_s1"



/*
* Crayons
*/

/obj/item/toy/crayon
name = "crayon"
desc = "A colourful crayon. Please refrain from eating it or putting it in your nose."
desc = "A colorful crayon. Please refrain from eating it or putting it in your nose."
icon = 'icons/obj/items/crayons.dmi'
icon_state = "crayonred"
w_class = SIZE_TINY
attack_verb = list("attacked", "coloured")
attack_verb = list("attacked", "colored")
black_market_value = 5
var/crayon_color = "#FF0000" //RGB
var/shadeColour = "#220000" //RGB
var/uses = 30 //0 for unlimited uses
var/crayon_color = COLOR_RED
var/shade_color = "#220000"
/// 0 for unlimited uses
var/uses = 30
var/instant = 0
var/colourName = "red" //for updateIcon purposes
var/colorName = "red" //for updateIcon purposes

/*
* Snap pops
Expand Down Expand Up @@ -237,7 +235,6 @@
. += "[reagents.total_volume] units of water left!"



/*
* Mech prizes
*/
Expand Down
34 changes: 17 additions & 17 deletions code/modules/clothing/glasses/glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
/obj/item/clothing/glasses/disco_fever/proc/apply_discovision(mob/user)
//Caramelldansen HUD overlay.
//Use of this filter in armed conflict is in direct contravention of the Geneva Suggestions (2120 revision)
//Colours are based on a bit of the music video. Original version was a rainbow with #c20000 and #db6c03 as well.
//Colors are based on a bit of the music video. Original version was a rainbow with #c20000 and #db6c03 as well.

//Animate the obj and onmob in sync with the client.
for(var/I in list(obj_glass_overlay, mob_glass_overlay))
Expand All @@ -361,35 +361,35 @@
if(!user.client) //Shouldn't happen but can't hurt to check.
return

var/base_colour
var/base_colors
if(!user.client.color) //No set client color.
base_colour = color_matrix_saturation(1.35) //Crank up the saturation and get ready to party.
base_colors = color_matrix_saturation(1.35) //Crank up the saturation and get ready to party.
else if(istext(user.client.color)) //Hex color string.
base_colour = color_matrix_multiply(color_matrix_from_string(user.client.color), color_matrix_saturation(1.35))
else //Colour matrix.
base_colour = color_matrix_multiply(user.client.color, color_matrix_saturation(1.35))
base_colors = color_matrix_multiply(color_matrix_from_string(user.client.color), color_matrix_saturation(1.35))
else //Color matrix.
base_colors = color_matrix_multiply(user.client.color, color_matrix_saturation(1.35))

var/list/colours = list(
"yellow" = color_matrix_multiply(base_colour, color_matrix_from_string("#d4c218")),
"green" = color_matrix_multiply(base_colour, color_matrix_from_string("#2dc404")),
"cyan" = color_matrix_multiply(base_colour, color_matrix_from_string("#2ac1db")),
"blue" = color_matrix_multiply(base_colour, color_matrix_from_string("#005BF7")),
"indigo" = color_matrix_multiply(base_colour, color_matrix_from_string("#b929f7"))
"yellow" = color_matrix_multiply(base_colors, color_matrix_from_string("#d4c218")),
"green" = color_matrix_multiply(base_colors, color_matrix_from_string("#2dc404")),
"cyan" = color_matrix_multiply(base_colors, color_matrix_from_string("#2ac1db")),
"blue" = color_matrix_multiply(base_colors, color_matrix_from_string("#005BF7")),
"indigo" = color_matrix_multiply(base_colors, color_matrix_from_string("#b929f7"))
)

//Animate the victim's client.
animate(user.client, color = colours["indigo"], time = 0.3 SECONDS, loop = -1)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)
animate(color = colours["cyan"], time = 0.3 SECONDS)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)
animate(color = colours["yellow"], time = 0.3 SECONDS)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)
animate(color = colours["green"], time = 0.3 SECONDS)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)
animate(color = colours["blue"], time = 0.3 SECONDS)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)
animate(color = colours["yellow"], time = 0.3 SECONDS)
animate(color = base_colour, time = 0.3 SECONDS)
animate(color = base_colors, time = 0.3 SECONDS)

/obj/item/clothing/glasses/disco_fever/dropped(mob/living/carbon/human/user)
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/hydro_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@
dat += "<br>It will periodically alter the local temperature by [grown_seed.alter_temp] degrees Kelvin."

if(grown_seed.biolum)
dat += "<br>It is [grown_seed.biolum_colour ? "<font color='[grown_seed.biolum_colour]'>bio-luminescent</font>" : "bio-luminescent"]."
dat += "<br>It is [grown_seed.biolum_color ? "<font color='[grown_seed.biolum_color]'>bio-luminescent</font>" : "bio-luminescent"]."
if(grown_seed.flowers)
dat += "<br>It has [grown_seed.flower_colour ? "<font color='[grown_seed.flower_colour]'>flowers</font>" : "flowers"]."
dat += "<br>It has [grown_seed.flower_color ? "<font color='[grown_seed.flower_color]'>flowers</font>" : "flowers"]."

if(dat)
show_browser(user, dat, "Plant Analysis", "plant_analyzer")
Expand Down
Loading

0 comments on commit ac9a7e6

Please sign in to comment.