From 7e510dfdb662b02cc7c8a00f6f1841064a5ea25a Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 29 Feb 2016 19:31:29 -0800 Subject: [PATCH 1/8] Changing a person's appearance now works better Also fixes some problems on changing gender --- code/game/dna/genes/vg_powers.dm | 4 ++-- code/game/objects/items/changestone.dm | 4 ++-- code/game/response_team.dm | 4 ++-- code/modules/admin/verbs/randomverbs.dm | 4 ++-- code/modules/client/preferences.dm | 4 ++-- .../mob/living/carbon/human/appearance.dm | 24 +++++++++++++++---- .../mob/living/carbon/human/human_organs.dm | 8 ++++++- .../mob/living/carbon/human/update_icons.dm | 7 +++--- .../research/xenobiology/xenobiology.dm | 2 +- 9 files changed, 40 insertions(+), 21 deletions(-) diff --git a/code/game/dna/genes/vg_powers.dm b/code/game/dna/genes/vg_powers.dm index 215b07158b9..da98fde4544 100644 --- a/code/game/dna/genes/vg_powers.dm +++ b/code/game/dna/genes/vg_powers.dm @@ -184,9 +184,9 @@ Obviously, requires DNA2. var/new_gender = alert(usr, "Please select gender.", "Character Generation", "Male", "Female") if (new_gender) if(new_gender == "Male") - M.gender = MALE + M.change_gender(MALE) else - M.gender = FEMALE + M.change_gender(FEMALE) M.regenerate_icons() M.check_dna() diff --git a/code/game/objects/items/changestone.dm b/code/game/objects/items/changestone.dm index 242a17074e8..0074303a88f 100644 --- a/code/game/objects/items/changestone.dm +++ b/code/game/objects/items/changestone.dm @@ -9,9 +9,9 @@ obj/item/changestone/attack_hand(var/mob/user as mob) var/mob/living/carbon/human/H = user if(!H.gloves) if (H.gender == FEMALE) - H.gender = MALE + H.change_gender(MALE) else - H.gender = FEMALE + H.change_gender(FEMALE) H.dna.ready_dna(H) H.update_body() ..() diff --git a/code/game/response_team.dm b/code/game/response_team.dm index a8f5a8bba79..fab7bdcbbf1 100644 --- a/code/game/response_team.dm +++ b/code/game/response_team.dm @@ -153,9 +153,9 @@ var/send_emergency_team var/new_gender = alert(usr, "Please select your gender.", "Character Generation", "Male", "Female") if (new_gender) if(new_gender == "Male") - M.gender = MALE + M.change_gender(MALE) else - M.gender = FEMALE + M.change_gender(FEMALE) M.set_species("Human",1) M.dna.ready_dna(M) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index e428f25fc39..970ebfee0ef 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -346,11 +346,11 @@ Traitors and the like can also be revived with the previous role mostly intact. if(record_found)//If they have a record we can determine a few things. new_character.real_name = record_found.fields["name"] - new_character.gender = record_found.fields["sex"] + new_character.change_gender(record_found.fields["sex"]) new_character.age = record_found.fields["age"] new_character.b_type = record_found.fields["b_type"] else - new_character.gender = pick(MALE,FEMALE) + new_character.change_gender(pick(MALE,FEMALE)) var/datum/preferences/A = new() A.real_name = G_found.real_name A.copy_to(new_character) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index a8f97d08947..c7874465210 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1593,7 +1593,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts character.sec_record = sec_record character.gen_record = gen_record - character.gender = gender + character.change_gender(gender) character.age = age character.b_type = b_type @@ -1694,7 +1694,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if(character.gender in list(PLURAL, NEUTER)) if(isliving(src)) //Ghosts get neuter by default message_admins("[key_name_admin(character)] has spawned with their gender as plural or neuter. Please notify coders.") - character.gender = MALE + character.change_gender(MALE) /datum/preferences/proc/open_load_dialog(mob/user) diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index 26612b66ed1..f225671d3e1 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -22,9 +22,18 @@ return src.gender = gender - reset_hair() - update_body() + + var/datum/sprite_accessory/hair/current_hair = hair_styles_list[h_style] + if(current_hair.gender != NEUTER && current_hair.gender != src.gender) + reset_head_hair() + + var/datum/sprite_accessory/hair/current_fhair = facial_hair_styles_list[f_style] + if(current_fhair.gender != NEUTER && current_fhair.gender != src.gender) + reset_facial_hair() + update_dna() + sync_organ_dna(assimilate = 0) + update_body() return 1 /mob/living/carbon/human/proc/change_hair(var/hair_style) @@ -58,8 +67,11 @@ return 1 /mob/living/carbon/human/proc/reset_hair() + reset_head_hair() + reset_facial_hair() + +/mob/living/carbon/human/proc/reset_head_hair() var/list/valid_hairstyles = generate_valid_hairstyles() - var/list/valid_facial_hairstyles = generate_valid_facial_hairstyles() if(valid_hairstyles.len) h_style = pick(valid_hairstyles) @@ -67,13 +79,15 @@ //this shouldn't happen h_style = "Bald" + update_hair() + +/mob/living/carbon/human/proc/reset_facial_hair() + var/list/valid_facial_hairstyles = generate_valid_facial_hairstyles() if(valid_facial_hairstyles.len) f_style = pick(valid_facial_hairstyles) else //this shouldn't happen f_style = "Shaved" - - update_hair() update_fhair() /mob/living/carbon/human/proc/change_eye_color(var/red, var/green, var/blue) diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index c83c35bd61b..b1eff81dc76 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -146,9 +146,15 @@ var/obj/item/organ/O = pick(organs) O.trace_chemicals[A.name] = 100 -/mob/living/carbon/human/proc/sync_organ_dna() +/* +When assimilate is 1, organs that have a different UE will still have their DNA overriden by that of the host +Otherwise, this restricts itself to organs that share the UE of the host. +*/ +/mob/living/carbon/human/proc/sync_organ_dna(var/assimilate = 1) var/list/all_bits = internal_organs|organs for(var/obj/item/organ/O in all_bits) + if(!assimilate && O.dna.unique_enzymes != dna.unique_enzymes) + continue O.set_dna(dna) /* diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 00443ac86ff..40216467132 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -177,11 +177,10 @@ Please contact me on #coderbus IRC. ~Carn x if(istype(I)) overlays += I else icon = stand_icon - if(overlays.len != overlays_standing.len) - overlays.Cut() + overlays.Cut() - for(var/thing in overlays_standing) - if(thing) overlays += thing + for(var/thing in overlays_standing) + if(thing) overlays += thing update_transform() diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 00954e16dc9..42d5ce1b93e 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -504,7 +504,7 @@ user << "The rune fizzles uselessly. There is no spirit nearby." return var/mob/living/carbon/human/golem/G = new /mob/living/carbon/human/golem - if(prob(50)) G.gender = "female" + G.change_gender(pick(MALE,FEMALE)) G.loc = src.loc G.key = ghost.key G << "You are an adamantine golem. You move slowly, but are highly resistant to heat and cold as well as blunt trauma. You are unable to wear clothes, but can still use most tools. Serve [user], and assist them in completing their goals at any cost." From 7a37daa21d0c89a9730e38bc2b3728a59f3f170e Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 29 Feb 2016 20:01:23 -0800 Subject: [PATCH 2/8] One last change I forgot --- code/game/dna/dna2_helpers.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 4aa0453a52d..7d6b8b2760e 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -161,9 +161,9 @@ H.s_tone = 35 - dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) // Value can be negative. if (dna.GetUIState(DNA_UI_GENDER)) - H.gender = FEMALE + H.change_gender(FEMALE) else - H.gender = MALE + H.change_gender(MALE) //Hair var/hair = dna.GetUIValueRange(DNA_UI_HAIR_STYLE,hair_styles_list.len) From fff283bd2aaa41f1efd2c4ba48eb6ad61308fdc7 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 29 Feb 2016 22:49:46 -0800 Subject: [PATCH 3/8] Organs now properly retain appearance upon cloning and DNA scramble --- code/game/machinery/cloning.dm | 13 +++++-------- code/game/objects/items/weapons/dnascrambler.dm | 9 ++++++--- code/modules/mob/living/carbon/human/human.dm | 4 +++- .../modules/mob/living/carbon/human/human_organs.dm | 5 ++--- code/modules/mob/new_player/new_player.dm | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 4de2a851d18..f1c15ee423a 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -237,7 +237,6 @@ H.updatehealth() clonemind.transfer_to(H) - H.ckey = R.ckey H << "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?
" // -- Mode/mind specific stuff goes here @@ -263,9 +262,9 @@ if(!R.dna) H.dna = new /datum/dna() H.dna.real_name = H.real_name + H.dna.ready_dna(H) else - H.dna=R.dna - H.UpdateAppearance() + H.dna = R.dna.Clone() if(efficiency > 2 && efficiency < 5 && prob(25)) randmutb(H) if(efficiency > 5 && prob(20)) @@ -275,13 +274,11 @@ H.dna.UpdateSE() H.dna.UpdateUI() -/* //let's not make people waste even more time after being cloned. - H.f_style = "Shaved" - if(R.dna.species == "Human") //no more xenos losing ears/tentacles - H.h_style = pick("Bedhead", "Bedhead 2", "Bedhead 3") */ - H.set_species(R.dna.species) + H.sync_organ_dna(assimilate=1) // It's literally a fresh body as you can get, so all organs properly belong to it + H.UpdateAppearance() + H.update_body() update_icon() for(var/datum/language/L in R.languages) diff --git a/code/game/objects/items/weapons/dnascrambler.dm b/code/game/objects/items/weapons/dnascrambler.dm index b0e5b0149d9..cf789b828b5 100644 --- a/code/game/objects/items/weapons/dnascrambler.dm +++ b/code/game/objects/items/weapons/dnascrambler.dm @@ -34,10 +34,13 @@ user << "\red You failed to inject [M.name]." proc/injected(var/mob/living/carbon/target, var/mob/living/carbon/user) - target.generate_name() - target.real_name = target.name - scramble(1, target, 100) + target.generate_name() + if(istype(target, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = target + H.sync_organ_dna(1) + H.update_body(0) + target.update_icons() log_attack("[key_name(user)] injected [key_name(target)] with the [name]") log_game("[key_name_admin(user)] injected [key_name_admin(target)] with the [name]") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d70e22f1496..4208ec9fc14 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -44,7 +44,7 @@ if(!delay_ready_dna && dna) dna.ready_dna(src) dna.real_name = real_name - sync_organ_dna() //this shouldn't be necessaaaarrrryyyyyyyy + sync_organ_dna(1) if(species) species.handle_dna(src) @@ -1406,6 +1406,8 @@ /mob/living/carbon/human/generate_name() name = species.makeName(gender,src) real_name = name + if(dna) + dna.real_name = name return name /mob/living/carbon/human/proc/handle_embedded_objects() diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm index b1eff81dc76..460d2a96772 100644 --- a/code/modules/mob/living/carbon/human/human_organs.dm +++ b/code/modules/mob/living/carbon/human/human_organs.dm @@ -153,9 +153,8 @@ Otherwise, this restricts itself to organs that share the UE of the host. /mob/living/carbon/human/proc/sync_organ_dna(var/assimilate = 1) var/list/all_bits = internal_organs|organs for(var/obj/item/organ/O in all_bits) - if(!assimilate && O.dna.unique_enzymes != dna.unique_enzymes) - continue - O.set_dna(dna) + if(assimilate || O.dna.unique_enzymes == dna.unique_enzymes) + O.set_dna(dna) /* Given the name of an organ, returns the external organ it's contained in diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 96876651d31..f77e2ff7ed5 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -477,7 +477,7 @@ domutcheck(new_character) new_character.dna.UpdateSE() - new_character.sync_organ_dna() //just fucking incase I guess + new_character.sync_organ_dna(1) //just fucking incase I guess // Do the initial caching of the player's body icons. new_character.force_update_limbs() From d53b462f1a91ab95b4e60919a8a0bab376657ee8 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 29 Feb 2016 23:03:59 -0800 Subject: [PATCH 4/8] Humans keep their name upon de-monkification --- code/game/dna/genes/monkey.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/game/dna/genes/monkey.dm b/code/game/dna/genes/monkey.dm index dcf6cbd5250..5d410c634b4 100644 --- a/code/game/dna/genes/monkey.dm +++ b/code/game/dna/genes/monkey.dm @@ -10,7 +10,7 @@ /datum/dna/gene/monkey/activate(var/mob/living/carbon/human/H, var/connected, var/flags) if(!istype(H,/mob/living/carbon/human)) return - if(issmall(H)) + if(issmall(H)) return for(var/obj/item/W in H) if(istype(W,/obj/item/organ)) @@ -18,13 +18,13 @@ if(istype(W,/obj/item/weapon/implant)) continue H.unEquip(W) - + H.regenerate_icons() H.SetStunned(1) H.canmove = 0 H.icon = null H.invisibility = 101 - + var/atom/movable/overlay/animation = new /atom/movable/overlay(H.loc) animation.icon_state = "blank" animation.icon = 'icons/mob/mob.dmi' @@ -32,7 +32,7 @@ flick("h2monkey", animation) sleep(22) qdel(animation) - + H.SetStunned(0) H.invisibility = initial(H.invisibility) @@ -65,7 +65,7 @@ H.canmove = 0 H.icon = null H.invisibility = 101 - + var/atom/movable/overlay/animation = new /atom/movable/overlay(H.loc) animation.icon_state = "blank" animation.icon = 'icons/mob/mob.dmi' @@ -82,6 +82,8 @@ return H.set_species(H.species.greater_form) + H.real_name = H.dna.real_name + H.name = H.real_name if(H.hud_used) H.hud_used.instantiate() From e7d34830cb25b2dfb964fd7a11576a342de6c781 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Tue, 1 Mar 2016 08:32:52 -0800 Subject: [PATCH 5/8] Skeletons (from rotted bodies) no longer have a fleshy torso --- code/modules/mob/living/carbon/human/update_icons.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 40216467132..0e6a7bd33f9 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -285,7 +285,7 @@ var/global/list/damage_icon_parts = list() else //BEGIN CACHED ICON GENERATION. var/obj/item/organ/external/chest = get_organ("chest") - base_icon = chest.get_icon() + base_icon = chest.get_icon(skeleton) for(var/obj/item/organ/external/part in organs) var/icon/temp = part.get_icon(skeleton) From 91f025c04fb9db2c972b4002910aa1da2c58fef6 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Tue, 1 Mar 2016 09:35:21 -0800 Subject: [PATCH 6/8] This should make sure you don't lose your hairstyle when cloned --- code/game/dna/dna2_helpers.dm | 4 ++-- code/modules/mob/living/carbon/human/appearance.dm | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 7d6b8b2760e..781c3a1d230 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -161,9 +161,9 @@ H.s_tone = 35 - dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) // Value can be negative. if (dna.GetUIState(DNA_UI_GENDER)) - H.change_gender(FEMALE) + H.change_gender(FEMALE, 0) else - H.change_gender(MALE) + H.change_gender(MALE, 0) //Hair var/hair = dna.GetUIValueRange(DNA_UI_HAIR_STYLE,hair_styles_list.len) diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index f225671d3e1..6cd20e79b19 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -17,7 +17,7 @@ reset_hair() return 1 -/mob/living/carbon/human/proc/change_gender(var/gender) +/mob/living/carbon/human/proc/change_gender(var/gender, var/update_dna = 1) if(src.gender == gender) return @@ -31,7 +31,8 @@ if(current_fhair.gender != NEUTER && current_fhair.gender != src.gender) reset_facial_hair() - update_dna() + if(update_dna) + update_dna() sync_organ_dna(assimilate = 0) update_body() return 1 From d72a086cd51c9bcf57a7ce8851e9463f2967c1ed Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Tue, 1 Mar 2016 11:40:39 -0800 Subject: [PATCH 7/8] Makes the DNA scrambler not give incorrect hairstyles --- code/game/objects/items/weapons/dnascrambler.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/objects/items/weapons/dnascrambler.dm b/code/game/objects/items/weapons/dnascrambler.dm index cf789b828b5..751815e3c06 100644 --- a/code/game/objects/items/weapons/dnascrambler.dm +++ b/code/game/objects/items/weapons/dnascrambler.dm @@ -40,6 +40,8 @@ var/mob/living/carbon/human/H = target H.sync_organ_dna(1) H.update_body(0) + H.reset_hair() // No more winding up with hairstyles you're not supposed to have, and blowing your cover + H.dna.ResetUIFrom(character) target.update_icons() log_attack("[key_name(user)] injected [key_name(target)] with the [name]") From b095d40952798cddfddc2894231ce726a5ef089e Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Tue, 1 Mar 2016 12:11:08 -0800 Subject: [PATCH 8/8] i r inteligunt --- code/game/objects/items/weapons/dnascrambler.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/dnascrambler.dm b/code/game/objects/items/weapons/dnascrambler.dm index 751815e3c06..e654e4ff941 100644 --- a/code/game/objects/items/weapons/dnascrambler.dm +++ b/code/game/objects/items/weapons/dnascrambler.dm @@ -41,7 +41,7 @@ H.sync_organ_dna(1) H.update_body(0) H.reset_hair() // No more winding up with hairstyles you're not supposed to have, and blowing your cover - H.dna.ResetUIFrom(character) + H.dna.ResetUIFrom(H) target.update_icons() log_attack("[key_name(user)] injected [key_name(target)] with the [name]")