PR - Gender Update (#14406)

* PR - Gender Update

Gives Gender three states instead of two. This allows clones of tri-gendered species to properly carry their genders over to new bodies (e.g. Greys, Drask, etc.).

Tristate Gender Set Proc
Tristate Gender Get Proc
Fixes where Binary State was needed.

* Update update_icons.dm

Yeah, let's _not_ have Genderless folks get inconsistently gendered body part sprites (e.g. head, groin, torso mismatch).

* Update dna2.dm

* Update dna2.dm

* Update organ_icon.dm

* Update update_icons.dm

* Update dna2_helpers.dm

* Update organ_icon.dm

Readability (spacing)

* Update dna_injector.dm

* Update dna2.dm

* Changes made per Affected's requests.

Changes made per Affected's feedback.

* Update dna2.dm

Got our heads too deep in using this just for DNA_UI_GENDERr - returning the Set and Get procs to 0, 1, 2 as per Affected's request.

While in there, noticed some housekeeping items:
- reorganized the ranges so they flow numerically now
- changed the ranges so they don't overlap (line 205 having been the worst)
- removed the "else" statement from line 222 since we're using ASSERTS. There shouldn't be a value outside the range of 0 to 2 for this.
This commit is contained in:
Iren
2020-10-21 09:45:44 -04:00
committed by GitHub
parent f5a1a359a1
commit a3d01c18f7
5 changed files with 62 additions and 17 deletions
+5
View File
@@ -55,3 +55,8 @@
#define DNA_UI_LENGTH 38 // Update this when you add something, or you WILL break shit.
#define DNA_SE_LENGTH 55 // Was STRUCDNASIZE, size 27. 15 new blocks added = 42, plus room to grow.
//Trinary State Values for DNA_UI_GENDER
#define DNA_GENDER_FEMALE 0
#define DNA_GENDER_MALE 1
#define DNA_GENDER_PLURAL 2
+39 -6
View File
@@ -85,7 +85,6 @@ GLOBAL_LIST_EMPTY(bad_blocks)
// FIXME: Species-specific defaults pls
var/obj/item/organ/external/head/H = character.get_organ("head")
var/obj/item/organ/internal/eyes/eyes_organ = character.get_int_organ(/obj/item/organ/internal/eyes)
var/datum/species/S = character.dna.species
/*// Body Accessory
if(!character.body_accessory)
@@ -121,16 +120,20 @@ GLOBAL_LIST_EMPTY(bad_blocks)
SetUIValueRange(DNA_UI_SKIN_TONE, 35-character.s_tone, 220, 1) // Value can be negative.
if(S.has_gender)
SetUIState(DNA_UI_GENDER, character.gender!=MALE, 1)
else
SetUIState(DNA_UI_GENDER, pick(0,1), 1)
/*SetUIValueRange(DNA_UI_BACC_STYLE, bodyacc, GLOB.facial_hair_styles_list.len, 1)*/
SetUIValueRange(DNA_UI_HEAD_MARK_STYLE, head_marks, GLOB.marking_styles_list.len, 1)
SetUIValueRange(DNA_UI_BODY_MARK_STYLE, body_marks, GLOB.marking_styles_list.len, 1)
SetUIValueRange(DNA_UI_TAIL_MARK_STYLE, tail_marks, GLOB.marking_styles_list.len, 1)
//Set the Gender
switch(character.gender)
if(FEMALE)
SetUITriState(DNA_UI_GENDER, DNA_GENDER_FEMALE, 1)
if(MALE)
SetUITriState(DNA_UI_GENDER, DNA_GENDER_MALE, 1)
if(PLURAL)
SetUITriState(DNA_UI_GENDER, DNA_GENDER_PLURAL, 1)
UpdateUI()
@@ -189,6 +192,36 @@ GLOBAL_LIST_EMPTY(bad_blocks)
val=rand(1, 2049)
SetUIValue(block, val, defer)
//Get Tri State Block State
/datum/dna/proc/GetUITriState(block)
if(block <= 0)
return
var/val = GetUIValue(block)
switch(val)
if(1 to 1395)
return 0
if(1396 to 2760)
return 1
if(2761 to 4095)
return 2
// Set Trinary UI Block State
/datum/dna/proc/SetUITriState(block, value, defer = FALSE)
if(block <= 0)
return
ASSERT(value >= 0)
ASSERT(value <= 2)
var/val
switch(value)
if(0)
val = rand(1, 1395)
if(1)
val = rand(1396, 2760)
if(2)
val = rand(2761, 4095)
SetUIValue(block, val, defer)
// Get a hex-encoded UI block.
/datum/dna/proc/GetUIBlock(block)
return EncodeDNABlock(GetUIValue(block))
+7 -6
View File
@@ -136,7 +136,6 @@
var/mob/living/carbon/human/H = src
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
var/obj/item/organ/internal/eyes/eye_organ = H.get_int_organ(/obj/item/organ/internal/eyes)
var/datum/species/S = H.dna.species
if(istype(head_organ))
dna.write_head_attributes(head_organ)
if(istype(eye_organ))
@@ -151,11 +150,13 @@
H.s_tone = 35 - dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) // Value can be negative.
if(S.has_gender)
if(dna.GetUIState(DNA_UI_GENDER))
H.change_gender(FEMALE, 0)
else
H.change_gender(MALE, 0)
switch(dna.GetUITriState(DNA_UI_GENDER))
if(DNA_GENDER_FEMALE)
H.change_gender(FEMALE, FALSE)
if(DNA_GENDER_MALE)
H.change_gender(MALE, FALSE)
if(DNA_GENDER_PLURAL)
H.change_gender(PLURAL, FALSE)
//Head Markings
var/head_marks = dna.GetUIValueRange(DNA_UI_HEAD_MARK_STYLE, GLOB.marking_styles_list.len)
@@ -1289,6 +1289,9 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
var/husk = (HUSK in mutations)
var/hulk = (HULK in mutations)
var/skeleton = (SKELETON in mutations)
var/g = dna.GetUITriState(DNA_UI_GENDER)
if(g == DNA_GENDER_PLURAL)
g = DNA_GENDER_FEMALE
. = ""
@@ -1317,8 +1320,8 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
if(part)
var/datum/species/S = GLOB.all_species[part.dna.species.name]
. += "[S.race_key]"
. += "[part.dna.GetUIState(DNA_UI_GENDER)]"
. += "[part.dna.GetUIValue(DNA_UI_SKIN_TONE)]"
. += "[g]"
if(part.s_col)
. += "[part.s_col]"
if(part.s_tone)
+7 -4
View File
@@ -162,10 +162,13 @@ GLOBAL_LIST_EMPTY(limb_icon_cache)
new_icon_state = "[icon_name][gendered_icon ? "_f" : ""]"
else
if(gendered_icon)
if(dna.GetUIState(DNA_UI_GENDER))
gender = "f"
else
gender = "m"
switch(dna.GetUITriState(DNA_UI_GENDER))
if(DNA_GENDER_FEMALE)
gender = "f"
if(DNA_GENDER_MALE)
gender = "m"
else
gender = "f" //Default to "f" (per line 162). Using a pick("m", "f") will make different body parts different genders for the same character.
if(limb_name == "head")
var/obj/item/organ/external/head/head_organ = src
head_organ.handle_alt_icon()