Invasion of the moffs (#17000)

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Co-authored-by: mochi <1496804+dearmochi@users.noreply.github.com>
This commit is contained in:
S34N
2022-02-23 20:37:37 +01:00
committed by GitHub
co-authored by AffectedArc07 mochi
parent 1aa4222695
commit a5bc67cd43
55 changed files with 880 additions and 161 deletions
+13 -5
View File
@@ -56,10 +56,14 @@ GLOBAL_LIST_EMPTY(bad_blocks)
new_dna.blood_type = blood_type
new_dna.real_name = real_name
new_dna.species = new species.type
for(var/b=1;b<=DNA_SE_LENGTH;b++)
for(var/b = 1; b <= DNA_SE_LENGTH; b++)
new_dna.SE[b]=SE[b]
if(b<=DNA_UI_LENGTH)
new_dna.UI[b]=UI[b]
if(b <= DNA_UI_LENGTH)
if(b <= length(UI)) //We check index against the length of UI provided, because it may be shorter and thus be out of bounds
new_dna.UI[b]=UI[b]
continue
new_dna.UI[b] = 0
new_dna.UpdateUI()
new_dna.UpdateSE()
return new_dna
@@ -100,7 +104,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
var/body_marks = GLOB.marking_styles_list.Find(character.m_styles["body"])
var/tail_marks = GLOB.marking_styles_list.Find(character.m_styles["tail"])
head_traits_to_dna(H)
head_traits_to_dna(character, H)
eye_color_to_dna(eyes_organ)
SetUIValueRange(DNA_UI_SKIN_R, color2R(character.skin_colour), 255, 1)
@@ -121,11 +125,13 @@ GLOBAL_LIST_EMPTY(bad_blocks)
SetUIValueRange(DNA_UI_SKIN_TONE, 35-character.s_tone, 220, 1) // Value can be negative.
/*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)
var/list/bodyacc = GLOB.body_accessory_by_name.Find(character.body_accessory?.name || "None")
SetUIValueRange(DNA_UI_BACC_STYLE, bodyacc, length(GLOB.body_accessory_by_name), 1)
//Set the Gender
switch(character.gender)
if(FEMALE)
@@ -153,6 +159,8 @@ GLOBAL_LIST_EMPTY(bad_blocks)
/datum/dna/proc/GetUIValue(block)
if(block <= 0)
return FALSE
if(block >= length(UI))
return FALSE
return UI[block]
// Set a DNA UI block's value, given a value and a max possible value.
+19 -6
View File
@@ -171,6 +171,10 @@
if((tail_marks > 0) && (tail_marks <= GLOB.marking_styles_list.len))
H.m_styles["tail"] = GLOB.marking_styles_list[tail_marks]
var/bodyacc = dna.GetUIValueRange(DNA_UI_BACC_STYLE, length(GLOB.body_accessory_by_name))
if(bodyacc > 0 && bodyacc <= length(GLOB.body_accessory_by_name))
H.body_accessory = GLOB.body_accessory_by_name[GLOB.body_accessory_by_name[bodyacc]]
H.regenerate_icons()
return TRUE
@@ -205,9 +209,17 @@
head_organ.sec_facial_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_B, 255))
//Head Accessories
var/headacc = GetUIValueRange(DNA_UI_HACC_STYLE,GLOB.head_accessory_styles_list.len)
if((headacc > 0) && (headacc <= GLOB.head_accessory_styles_list.len))
head_organ.ha_style = GLOB.head_accessory_styles_list[headacc]
var/list/available = list()
for(var/head_accessory in GLOB.head_accessory_styles_list)
var/datum/sprite_accessory/S = GLOB.head_accessory_styles_list[head_accessory]
if(!(head_organ.dna.species.name in S.species_allowed)) //If the user's head is not of a species the head accessory style allows, skip it. Otherwise, add it to the list.
continue
available += head_accessory
var/list/sorted = sortTim(available, /proc/cmp_text_asc)
var/headacc = GetUIValueRange(DNA_UI_HACC_STYLE, length(sorted))
if(headacc > 0 && headacc <= length(sorted))
head_organ.ha_style = sorted[headacc]
head_organ.headacc_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HACC_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HACC_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HACC_B, 255))
@@ -227,7 +239,7 @@
SetUIValueRange(DNA_UI_EYES_G, color2G(eyes_organ.eye_color), 255, 1)
SetUIValueRange(DNA_UI_EYES_B, color2B(eyes_organ.eye_color), 255, 1)
/datum/dna/proc/head_traits_to_dna(obj/item/organ/external/head/head_organ)
/datum/dna/proc/head_traits_to_dna(mob/living/carbon/human/character, obj/item/organ/external/head/head_organ)
if(!head_organ)
log_runtime(EXCEPTION("Attempting to reset DNA from a missing head!"), src)
return
@@ -243,7 +255,6 @@
// Head Accessory
if(!head_organ.ha_style)
head_organ.ha_style = "None"
var/headacc = GLOB.head_accessory_styles_list.Find(head_organ.ha_style)
SetUIValueRange(DNA_UI_HAIR_R, color2R(head_organ.hair_colour), 255, 1)
SetUIValueRange(DNA_UI_HAIR_G, color2G(head_organ.hair_colour), 255, 1)
@@ -267,4 +278,6 @@
SetUIValueRange(DNA_UI_HAIR_STYLE, hair, GLOB.hair_styles_full_list.len, 1)
SetUIValueRange(DNA_UI_BEARD_STYLE, beard, GLOB.facial_hair_styles_list.len, 1)
SetUIValueRange(DNA_UI_HACC_STYLE, headacc, GLOB.head_accessory_styles_list.len, 1)
var/list/available = character.generate_valid_head_accessories()
SetUIValueRange(DNA_UI_HACC_STYLE, available.Find(head_organ.ha_style), max(length(available), 1), 1)
+1 -1
View File
@@ -821,7 +821,7 @@
M.change_head_accessory_color(new_head_accessory_colour)
//Body accessory.
if(M.dna.species.tail && M.dna.species.bodyflags & HAS_TAIL)
if((M.dna.species.tail && M.dna.species.bodyflags & (HAS_TAIL)) || (M.dna.species.wing && M.dna.species.bodyflags & (HAS_WING)))
var/list/valid_body_accessories = M.generate_valid_body_accessories()
if(valid_body_accessories.len > 1) //By default valid_body_accessories will always have at the very least a 'none' entry populating the list, even if the user's species is not present in any of the list items.
var/new_body_accessory = input("Please select body accessory style", "Character Generation", M.body_accessory) as null|anything in valid_body_accessories