mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-19 03:49:10 +01:00
Abling Disability (#4485)
This PR implements a system for manipulating a client's color safely and also ports a prioritization system for sorting client color from /tg/. Currently this PR also implements client coloration in the form of color blindness, namely: Monochromacy Deuteranopia Tritanopia Protanopia DTP are mild brain traumas, whereas monocrhomacy is a severe brain trauma. Furthermore, this PR removes the Needs Glasses prompt in character creation, and replaces it with a disability selector, allowing people to more closely refine their special little snowflakes. Current disabilities available: Nervousness Nearsightedness Deuteranopia Tritanopia Protanopia Deafness Muteness
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/datum/client_color
|
||||
var/client_color = "" //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 color" as the former is much more important
|
||||
|
||||
|
||||
/mob
|
||||
var/list/client_colors = list()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Adds an instance of color_type to the mob's client_colors list
|
||||
color_type - a typepath (subtyped from /datum/client_color)
|
||||
*/
|
||||
/mob/proc/add_client_color(color_type)
|
||||
if(!ispath(/datum/client_color))
|
||||
return
|
||||
|
||||
var/datum/client_color/CC = new color_type()
|
||||
client_colors |= CC
|
||||
sortTim(client_colors, /proc/cmp_clientcolor_priority)
|
||||
update_client_color()
|
||||
|
||||
|
||||
/*
|
||||
Removes an instance of color_type from the mob's client_colors list
|
||||
color_type - a typepath (subtyped from /datum/client_color)
|
||||
*/
|
||||
/mob/proc/remove_client_color(color_type)
|
||||
if(!ispath(/datum/client_color))
|
||||
return
|
||||
|
||||
for(var/cc in client_colors)
|
||||
var/datum/client_color/CC = cc
|
||||
if(CC.type == color_type)
|
||||
client_colors -= CC
|
||||
qdel(CC)
|
||||
break
|
||||
update_client_color()
|
||||
|
||||
|
||||
/*
|
||||
Resets the mob's client.color to null, and then sets it to the highest priority
|
||||
client_color datum, if one exists
|
||||
*/
|
||||
/mob/proc/update_client_color()
|
||||
if(!client)
|
||||
return
|
||||
client.color = ""
|
||||
if(!client_colors.len)
|
||||
return
|
||||
var/datum/client_color/CC = client_colors[1]
|
||||
if(CC)
|
||||
animate(client, color = CC.client_color)
|
||||
|
||||
/datum/client_color/monochrome
|
||||
client_color = list(0.33,0.33,0.33, 0.33,0.33,0.33, 0.33,0.33,0.33)
|
||||
priority = INFINITY
|
||||
|
||||
/datum/client_color/deuteranopia
|
||||
client_color = list(0.47,0.38,0.15, 0.54,0.31,0.15, 0,0.3,0.7)
|
||||
priority = 100
|
||||
|
||||
/datum/client_color/protanopia
|
||||
client_color = list(0.51,0.4,0.12, 0.49,0.41,0.12, 0,0.2,0.76)
|
||||
priority = 100
|
||||
|
||||
/datum/client_color/tritanopia
|
||||
client_color = list(0.95,0.07,0, 0,0.44,0.52, 0.05,0.49,0.48)
|
||||
priority = 100
|
||||
@@ -103,7 +103,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
"facial_style" = pref.f_style,
|
||||
"eyes_colour" = rgb(pref.r_eyes, pref.g_eyes, pref.b_eyes),
|
||||
"b_type" = pref.b_type,
|
||||
"disabilities" = pref.disabilities,
|
||||
"disabilities" = json_encode(pref.disabilities),
|
||||
"organs_data" = list2params(pref.organ_data),
|
||||
"organs_robotic"= list2params(pref.rlimb_data),
|
||||
"body_markings" = json_encode(pref.body_markings),
|
||||
@@ -135,8 +135,6 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
pref.g_eyes = GetGreenPart(pref.eyes_colour)
|
||||
pref.b_eyes = GetBluePart(pref.eyes_colour)
|
||||
|
||||
pref.disabilities = text2num(pref.disabilities)
|
||||
|
||||
if (istext(pref.organ_data))
|
||||
pref.organ_data = params2list(pref.organ_data)
|
||||
if (istext(pref.rlimb_data))
|
||||
@@ -148,6 +146,13 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
catch (var/exception/e)
|
||||
log_debug("BODY MARKINGS: Caught [e]. Initial value: [before]")
|
||||
pref.body_markings = list()
|
||||
if (istext(pref.disabilities))
|
||||
var/before = pref.disabilities
|
||||
try
|
||||
pref.disabilities = json_decode(pref.disabilities)
|
||||
catch (var/exception/e)
|
||||
log_debug("DISABILITIES: Caught [e]. Initial value: [before]")
|
||||
pref.disabilities = list()
|
||||
|
||||
pref.r_hair = sanitize_integer(pref.r_hair, 0, 255, initial(pref.r_hair))
|
||||
pref.g_hair = sanitize_integer(pref.g_hair, 0, 255, initial(pref.g_hair))
|
||||
@@ -166,13 +171,14 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
pref.b_eyes = sanitize_integer(pref.b_eyes, 0, 255, initial(pref.b_eyes))
|
||||
pref.b_type = sanitize_text(pref.b_type, initial(pref.b_type))
|
||||
|
||||
pref.disabilities = sanitize_integer(pref.disabilities, 0, 65535, initial(pref.disabilities))
|
||||
if (!pref.organ_data || !islist(pref.organ_data))
|
||||
pref.organ_data = list()
|
||||
if (!pref.rlimb_data || !islist(pref.rlimb_data))
|
||||
pref.rlimb_data = list()
|
||||
if (!pref.body_markings || !islist(pref.body_markings))
|
||||
pref.body_markings = list()
|
||||
if (!pref.disabilities || !islist(pref.disabilities))
|
||||
pref.disabilities = list()
|
||||
|
||||
/datum/category_item/player_setup_item/general/body/content(var/mob/user)
|
||||
var/list/out = list()
|
||||
@@ -189,7 +195,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
out += "Blood Type: <a href='?src=\ref[src];blood_type=1'>[pref.b_type]</a><br>"
|
||||
if(has_flag(mob_species, HAS_SKIN_TONE))
|
||||
out += "Skin Tone: <a href='?src=\ref[src];skin_tone=1'>[-pref.s_tone + 35]/220</a><br>"
|
||||
out += "Needs Glasses: <a href='?src=\ref[src];disabilities=[NEARSIGHTED]'><b>[pref.disabilities & NEARSIGHTED ? "Yes" : "No"]</b></a><br>"
|
||||
out += "Disabilities: <a href='?src=\ref[src];trait_add=1'>Adjust</a><br>"
|
||||
for(var/M in pref.disabilities)
|
||||
out += " [M] <a href='?src=\ref[src];trait_remove=[M]'>-</a><br>"
|
||||
if(!(has_flag(mob_species, HAS_FBP)))
|
||||
out += "Limbs: <a href='?src=\ref[src];limbs=1'>Adjust</a><br>"
|
||||
out += "Internal Organs: <a href='?src=\ref[src];organs=1'>Adjust</a><br>"
|
||||
@@ -622,9 +630,17 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["disabilities"])
|
||||
var/disability_flag = text2num(href_list["disabilities"])
|
||||
pref.disabilities ^= disability_flag
|
||||
else if(href_list["trait_add"])
|
||||
var/list/available_disabilities = pref.disabilities ^ chargen_disabilities_list
|
||||
|
||||
var/new_trait = input(user, "Choose a disability:", "Character Preference") as null|anything in available_disabilities
|
||||
if(new_trait && CanUseTopic(user))
|
||||
pref.disabilities += new_trait
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["trait_remove"])
|
||||
var/M = href_list["trait_remove"]
|
||||
pref.disabilities -= M
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["toggle_clothing"])
|
||||
|
||||
@@ -116,7 +116,7 @@ datum/preferences
|
||||
var/exploit_record = ""
|
||||
var/ccia_record = ""
|
||||
var/list/ccia_actions = list()
|
||||
var/disabilities = 0
|
||||
var/list/disabilities = list()
|
||||
|
||||
var/nanotrasen_relation = "Neutral"
|
||||
|
||||
@@ -369,6 +369,8 @@ datum/preferences
|
||||
// Destroy/cyborgize organs & setup body markings
|
||||
character.sync_organ_prefs_to_mob(src)
|
||||
|
||||
character.sync_trait_prefs_to_mob(src)
|
||||
|
||||
character.underwear = underwear
|
||||
|
||||
character.undershirt = undershirt
|
||||
@@ -535,7 +537,7 @@ datum/preferences
|
||||
flavour_texts_robot = list()
|
||||
|
||||
ccia_actions = list()
|
||||
disabilities = 0
|
||||
disabilities = list()
|
||||
|
||||
nanotrasen_relation = "Neutral"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user