Skip to content

Commit

Permalink
Changelings now update their flavor text upon transforming. Updates D…
Browse files Browse the repository at this point in the history
…NA to include flavor text. (#26094)

* Fixes #3352

* bleugh
  • Loading branch information
Spaghetti-bit committed Jul 3, 2024
1 parent 1a3a77d commit 3e46e52
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
27 changes: 19 additions & 8 deletions code/game/dna/dna2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ GLOBAL_LIST_EMPTY(bad_blocks)
/datum/dna
// READ-ONLY, GETS OVERWRITTEN
// DO NOT FUCK WITH THESE OR BYOND WILL EAT YOUR FACE
var/uni_identity = "" // Encoded UI
var/struc_enzymes = "" // Encoded SE
var/unique_enzymes = "" // MD5 of player name
/// Encoded UI
var/uni_identity = ""
/// Encoded SE
var/struc_enzymes = ""
/// MD5 of player name
var/unique_enzymes = ""

// Original Encoded SE, for use with Ryetalin
var/struc_enzymes_original = "" // Encoded SE
Expand All @@ -41,11 +44,16 @@ GLOBAL_LIST_EMPTY(bad_blocks)
var/list/UI[DNA_UI_LENGTH]

// From old dna.
var/blood_type = "A+" // Should probably change to an integer => string map but I'm lazy.
var/real_name // Stores the real name of the person who originally got this dna datum. Used primarily for changelings,

var/datum/species/species = new /datum/species/human //The type of mutant race the player is if applicable (i.e. potato-man)
var/list/default_blocks = list() //list of all blocks toggled at roundstart
/// The blood type of the mob.
var/blood_type = "A+"
/// Stores the real name of the person who originally got this dna datum. Used primarily for changelings,
var/real_name
/// The type of mutant race the player is if applicable (i.e. potato-man)
var/datum/species/species = new /datum/species/human
/// list of all blocks toggled at roundstart
var/list/default_blocks = list()
/// The flavor text of the person. We store this here for polymorph and changelings.
var/flavor_text

// Make a copy of this strand.
// USE THIS WHEN COPYING STUFF OR YOU'LL GET CORRUPTION!
Expand All @@ -57,6 +65,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
new_dna.blood_type = blood_type
new_dna.real_name = real_name
new_dna.species = new species.type
new_dna.flavor_text = flavor_text

for(var/b = 1; b <= DNA_SE_LENGTH; b++)
new_dna.SE[b]=SE[b]
Expand Down Expand Up @@ -439,6 +448,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
// Because old DNA coders were insane or something
data["blood_type"] = blood_type
data["real_name"] = real_name
data["flavor_text"] = flavor_text
return data

/datum/dna/deserialize(data)
Expand All @@ -452,6 +462,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
species = new S
blood_type = data["blood_type"]
real_name = data["real_name"]
flavor_text = data["flavor_text"]

/datum/dna/proc/transfer_identity(mob/living/carbon/human/destination)
if(!istype(destination))
Expand Down
2 changes: 2 additions & 0 deletions code/game/gamemodes/miniantags/abduction/abduction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
H.real_name = team_name + " Agent"
H.cleanSE() //No fat/blind/colourblind/epileptic/whatever ayys.
H.overeatduration = 0
H.dna.flavor_text = null
H.flavor_text = null
H.equipOutfit(/datum/outfit/abductor/agent)
greet_agent(agent,team_number)
Expand All @@ -140,6 +141,7 @@
H.real_name = team_name + " Scientist"
H.cleanSE() //No fat/blind/colourblind/epileptic/whatever ayys.
H.overeatduration = 0
H.dna.flavor_text = null
H.flavor_text = null
H.equipOutfit(/datum/outfit/abductor/scientist)
greet_scientist(scientist,team_number)
Expand Down
3 changes: 2 additions & 1 deletion code/game/gamemodes/nuclear/nuclear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@
var/mob/living/carbon/human/M = synd_mind.current

M.set_species(/datum/species/human, TRUE)
M.dna.flavor_text = null
M.flavor_text = null
M.dna.ready_dna(M) // Quadriplegic Nuke Ops won't be participating in the paralympics
M.dna.species.create_organs(M)
M.cleanSE() //No fat/blind/colourblind/epileptic/whatever ops.
M.overeatduration = 0
M.flavor_text = null

var/obj/item/organ/external/head/head_organ = M.get_organ("head")
var/hair_c = pick("#8B4513","#000000","#FF4500","#FFD700") // Brown, black, red, blonde
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/clonepod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
/obj/machinery/clonepod/proc/create_clone()
clone = new /mob/living/carbon/human(src, patient_data.genetic_info.species.type)

clone.change_dna(patient_data.genetic_info, FALSE, TRUE)
clone.change_dna(patient_data.genetic_info, FALSE)

for(var/obj/item/organ/external/limb in clone.bodyparts)
if(!(limb.limb_name in limbs_to_grow)) //if the limb was determined to be vital
Expand Down
1 change: 1 addition & 0 deletions code/modules/client/preference/character.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,7 @@

character.change_eye_color(e_colour, skip_icons = TRUE)
character.original_eye_color = e_colour
character.dna.flavor_text = flavor_text

if(disabilities & DISABILITY_FLAG_FAT)
character.dna.SetSEState(GLOB.fatblock, TRUE, TRUE)
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/human/human_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1004,16 +1004,16 @@
dna.real_name = name
return name

/mob/living/carbon/human/proc/change_dna(datum/dna/new_dna, include_species_change = FALSE, keep_flavor_text = FALSE)
/mob/living/carbon/human/proc/change_dna(datum/dna/new_dna, include_species_change = FALSE)
if(include_species_change)
set_species(new_dna.species.type, retain_damage = TRUE, transformation = TRUE, keep_missing_bodyparts = TRUE)
dna = new_dna.Clone()
if(include_species_change) //We have to call this after new_dna.Clone() so that species actions don't get overwritten
dna.species.on_species_gain(src)
real_name = new_dna.real_name
if(dna.flavor_text)
flavor_text = dna.flavor_text
domutcheck(src, MUTCHK_FORCED) //Ensures species that get powers by the species proc handle_dna keep them
if(!keep_flavor_text)
flavor_text = ""
dna.UpdateSE()
dna.UpdateUI()
sync_organ_dna(TRUE)
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,13 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
to_chat(usr, "<span class='notice'>You have to be conscious to change your flavor text</span>")
return
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
if(dna)
dna.flavor_text = msg // Only carbon mobs have DNA.
flavor_text = msg

/mob/proc/print_flavor_text(shrink = TRUE)
if(flavor_text && flavor_text != "")
var/msg = replacetext(flavor_text, "\n", " ")
var/msg = !dna.flavor_text ? replacetext(dna.flavor_text, "\n", " ") : replacetext(flavor_text, "\n", " ")
if(length(msg) <= 40 || !shrink)
return "<span class='notice'>[msg]</span>" // There is already encoded by tgui_input
else
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents/toxins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
var/mob/living/carbon/human/H = M
var/datum/dna/D = data["dna"]
if(!D.species.is_small)
H.change_dna(D, TRUE, TRUE)
H.change_dna(D, TRUE)

return ..()

Expand Down

0 comments on commit 3e46e52

Please sign in to comment.