Files
Yogstation/code/modules/client/client_colour.dm
phil235 8e8061e851 Wearing colored glasses colors your vision, if you want to. (#20499)
* Adds semi-transparent colored fullscreen overlays which are used by glasses with tint_color.
Currently only red, blue, and green are available. And only nightvision glasses currently have a tint_color when worn (green).

* Completely rewrites how I did color tinting. We now use datum/client_colour and the client's color var.
I fixed items in our inventory UI being colored when using client.color.
I added an altclick() option on all glasses to toggle a new pref regarding the use of glass coloring your view.
I made a lot more glasses use vision coloring.
I fixed Thermal HUD Scanner not having its action button to switch hud type.
2016-09-17 16:28:50 +12:00

108 lines
2.4 KiB
Plaintext

/*
Client Colour Priority System By RemieRichards
A System that gives finer control over which client.colour value to display on screen
so that the "highest priority" one is always displayed as opposed to the default of
"whichever was set last is displayed"
*/
/*
Define subtypes of this datum
*/
/datum/client_colour
var/colour = "" //Any client.color-valid value
var/priority = 1 //Since only one client.color can be rendered on screen, we take the one with the highest priority value:
//eg: "Bloody screen" > "goggles colour" as the former is much more important
/mob
var/list/client_colours = list()
/*
Adds an instance of colour_type to the mob's client_colours list
colour_type - a typepath (subtyped from /datum/client_colour)
*/
/mob/proc/add_client_colour(colour_type)
if(!ispath(colour_type, /datum/client_colour))
return
var/datum/client_colour/CC = new colour_type()
client_colours |= CC
sortTim(client_colours, /proc/cmp_clientcolour_priority)
update_client_colour()
/*
Removes an instance of colour_type from the mob's client_colours list
colour_type - a typepath (subtyped from /datum/client_colour)
*/
/mob/proc/remove_client_colour(colour_type)
if(!ispath(colour_type, /datum/client_colour))
return
for(var/cc in client_colours)
var/datum/client_colour/CC = cc
if(CC.type == colour_type)
client_colours -= CC
qdel(CC)
break
update_client_colour()
/*
Resets the mob's client.color to null, and then sets it to the highest priority
client_colour datum, if one exists
*/
/mob/proc/update_client_colour()
if(!client)
return
client.color = ""
if(!client_colours.len)
return
var/datum/client_colour/CC = client_colours[1]
if(CC)
client.color = CC.colour
/datum/client_colour/glass_colour
priority = 0
colour = "red"
/datum/client_colour/glass_colour/green
colour = "#aaffaa"
/datum/client_colour/glass_colour/lightgreen
colour = "#ccffcc"
/datum/client_colour/glass_colour/blue
colour = "#aaaaff"
/datum/client_colour/glass_colour/lightblue
colour = "#ccccff"
/datum/client_colour/glass_colour/yellow
colour = "#ffff66"
/datum/client_colour/glass_colour/red
colour = "#ffaaaa"
/datum/client_colour/glass_colour/darkred
colour = "#bb5555"
/datum/client_colour/glass_colour/orange
colour = "#ffbb99"
/datum/client_colour/glass_colour/lightorange
colour = "#ffddaa"
/datum/client_colour/glass_colour/purple
colour = "#ff99ff"
/datum/client_colour/glass_colour/gray
colour = "#cccccc"