From 2cbdae2f0aaa76557a77d8c98158aa502bd085d3 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 5 Mar 2020 18:46:33 +0100
Subject: [PATCH 01/13] Made flavor texts into an element datum.
---
code/__DEFINES/components.dm | 3 +
code/__HELPERS/_cit_helpers.dm | 32 -----
code/datums/dna.dm | 6 +-
code/datums/elements/flavor_text.dm | 113 ++++++++++++++++++
code/modules/client/preferences.dm | 2 +
code/modules/mob/living/carbon/carbon.dm | 5 +
.../mob/living/carbon/human/examine.dm | 27 +----
code/modules/mob/living/carbon/human/human.dm | 6 +-
code/modules/mob/mob.dm | 8 --
.../code/modules/client/preferences.dm | 1 -
tgstation.dme | 1 +
11 files changed, 138 insertions(+), 66 deletions(-)
create mode 100644 code/datums/elements/flavor_text.dm
diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm
index 5a4e7c0380..fb44916ee1 100644
--- a/code/__DEFINES/components.dm
+++ b/code/__DEFINES/components.dm
@@ -210,6 +210,7 @@
// /mob/living/carbon signals
#define COMSIG_CARBON_SOUNDBANG "carbon_soundbang" //from base of mob/living/carbon/soundbang_act(): (list(intensity))
+#define COMSIG_CARBON_IDENTITY_TRANSFERRED_TO "carbon_id_transferred_to" //from datum/dna/transfer_identity(): (datum/dna, transfer_SE)
// /mob/living/simple_animal/hostile signals
#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget"
@@ -274,6 +275,8 @@
#define COMSIG_HUMAN_MELEE_UNARMED_ATTACK "human_melee_unarmed_attack" //from mob/living/carbon/human/UnarmedAttack(): (atom/target)
#define COMSIG_HUMAN_MELEE_UNARMED_ATTACKBY "human_melee_unarmed_attackby" //from mob/living/carbon/human/UnarmedAttack(): (mob/living/carbon/human/attacker)
#define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" //Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted)
+#define COMSIG_HUMAN_PREFS_COPIED_TO "human_prefs_copied_to" //from datum/preferences/copy_to(): (datum/preferences, icon_updates, roundstart_checks)
+#define COMSIG_HUMAN_HARDSET_DNA "human_hardset_dna" //from mob/living/carbon/human/hardset_dna(): (ui, se, newreal_name, newblood_type, datum/species, newfeatures)
// /datum/species signals
#define COMSIG_SPECIES_GAIN "species_gain" //from datum/species/on_species_gain(): (datum/species/new_species, datum/species/old_species)
diff --git a/code/__HELPERS/_cit_helpers.dm b/code/__HELPERS/_cit_helpers.dm
index 4ae30838e4..ffc1bcc6b7 100644
--- a/code/__HELPERS/_cit_helpers.dm
+++ b/code/__HELPERS/_cit_helpers.dm
@@ -107,38 +107,6 @@ GLOBAL_VAR_INIT(miscreants_allowed, FALSE)
if(!src.holder) return
message_admins("[key_name_admin(usr)] manually reloaded mentors")
-//Flavor Text
-/mob/proc/set_flavor()
- set name = "Set Flavor Text"
- set desc = "Sets an extended description of your character's features."
- set category = "IC"
-
- var/new_flavor = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", flavor_text, MAX_FAVOR_LEN, TRUE)
- if(!isnull(new_flavor))
- flavor_text = html_decode(new_flavor)
- to_chat(src, "Your flavor text has been updated.")
-
-//Flavor Text
-/mob/proc/set_flavor_2()
- set name = "Set Temporary Flavor Text"
- set desc = "Sets a description of your character's current appearance. Use this for emotions, poses etc."
- set category = "IC"
-
- var/new_flavor = stripped_multiline_input(usr, "Set the temporary flavor text in your 'examine' verb. This should be used only for things pertaining to the current round!", "Short-Term Flavor Text", flavor_text_2, MAX_FAVOR_LEN, TRUE)
- if(!isnull(new_flavor))
- flavor_text_2 = html_decode(new_flavor)
- to_chat(src, "Your temporary flavor text has been updated.")
-
-/mob/proc/print_flavor_text(flavor,temp = FALSE)
- if(!flavor)
- return
- // We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown.
- var/msg = html_decode(replacetext(flavor, "\n", " "))
- if(length_char(msg) <= 40)
- return "[html_encode(msg)]"
- else
- return "[html_encode(copytext_char(msg, 1, 37))]... More..."
-
//LOOC toggles
/client/verb/listen_looc()
set name = "Show/Hide LOOC"
diff --git a/code/datums/dna.dm b/code/datums/dna.dm
index 68c6839482..3994dcc8bc 100644
--- a/code/datums/dna.dm
+++ b/code/datums/dna.dm
@@ -51,10 +51,11 @@
if(ishuman(destination))
var/mob/living/carbon/human/H = destination
H.give_genitals(TRUE)//This gives the body the genitals of this DNA. Used for any transformations based on DNA
- destination.flavor_text = destination.dna.features["flavor_text"] //Update the flavor_text to use new dna text
if(transfer_SE)
destination.dna.struc_enzymes = struc_enzymes
+ SEND_SIGNAL(destination, COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, src, transfer_SE)
+
/datum/dna/proc/copy_dna(datum/dna/new_dna)
new_dna.unique_enzymes = unique_enzymes
new_dna.struc_enzymes = struc_enzymes
@@ -284,7 +285,6 @@
if(newfeatures)
dna.features = newfeatures
- flavor_text = dna.features["flavor_text"] //Update the flavor_text to use new dna text
if(mrace)
var/datum/species/newrace = new mrace.type
@@ -306,6 +306,8 @@
dna.struc_enzymes = se
domutcheck()
+ SEND_SIGNAL(src, COMSIG_HUMAN_HARDSET_DNA, ui, se, newreal_name, newblood_type, mrace, newfeatures)
+
if(mrace || newfeatures || ui)
update_body()
update_hair()
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
new file mode 100644
index 0000000000..f823f4aa79
--- /dev/null
+++ b/code/datums/elements/flavor_text.dm
@@ -0,0 +1,113 @@
+/datum/element/flavor_text
+ element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
+ id_arg_index = 3
+ var/flavor_name = "Flavor Text"
+ var/procpath/verb_instance
+ var/invoke_proc
+ var/list/texts_by_mob = list()
+ var/addendum = "This can also be used for OOC notes and preferences!"
+ var/always_show = FALSE
+ var/max_len = MAX_FAVOR_LEN
+
+/datum/element/flavor_text/Attach(datum/target, text, _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+ . = ..()
+
+ if(. == ELEMENT_INCOMPATIBLE || !isatom(target)) //no reason why this shouldn't work on atoms too.
+ return ELEMENT_INCOMPATIBLE
+
+ texts_by_mob[target] = text
+ if(_name)
+ flavor_name = _name
+ if(_proc)
+ invoke_proc = _proc
+ if(_max_len)
+ max_len = _max_len
+ if(!isnull(addendum))
+ addendum = _addendum
+ always_show = _always_show
+
+ RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/show_flavor)
+
+ if(can_edit && ismob(target)) //but only mobs receive the proc/verb for the time being
+ var/mob/M = target
+ if(!verb_instance)
+ verb_instance = new /datum/element/flavor_text/proc/set_flavor (src, "Set [_name]", _desc)
+ M.verbs += verb_instance
+
+/datum/element/flavor_text/Detach(atom/A)
+ . = ..()
+ UnregisterSignal(A, COMSIG_PARENT_EXAMINE)
+ texts_by_mob -= A
+ A.verbs -= verb_instance
+
+/datum/element/flavor_text/proc/show_flavor(atom/target, mob/user, list/examine_list)
+ if(!always_show && isliving(target))
+ var/mob/living/L = target
+ var/unknown = L.get_visible_name() == "Unknown"
+ if(!unknown && iscarbon(target))
+ var/mob/living/carbon/C = L
+ unknown = (C.wear_mask && (C.wear_mask.flags_inv & HIDEFACE)) || (C.head && (C.head.flags_inv & HIDEFACE))
+ if(unknown)
+ if(!("...?" in examine_list)) //can't think of anything better in case of multiple flavor texts.
+ examine_list += "...?"
+ return
+ var/text = texts_by_mob[target]
+ if(!text)
+ return
+ var/msg = replacetext(text, "\n", " ")
+ if(length_char(msg) <= 40)
+ return "[html_encode(msg)]"
+ else
+ return "[html_encode(copytext_char(msg, 1, 37))]... More..."
+
+/datum/element/flavor_text/Topic(href, href_list)
+ . = ..()
+ if(.)
+ return
+ if(href_list["show_flavor"])
+ var/atom/target = href_list["show_flavor"]
+ var/text = texts_by_mob[target]
+ if(text)
+ usr << browse("
[target.name][replacetext(texts_by_mob[target], "\n", "
")]", "window=[target.name];size=500x200")
+ onclose(usr, "[target.name]")
+ return TRUE
+
+/datum/element/flavor_text/proc/set_flavor()
+ set category = "IC"
+
+ if(!(usr in texts_by_mob))
+ return
+
+ var/lower_name = lowertext(flavor_name)
+ var/new_text = stripped_multiline_input(usr, "Set the [lower_name] displayed on 'examine'. [addendum]", flavor_name, texts_by_mob[usr], max_len, TRUE)
+ if(!isnull(new_text) && (usr in texts_by_mob))
+ texts_by_mob[usr] = html_decode(new_text)
+ to_chat(src, "Your [lower_name] has been updated.")
+ if(invoke_proc)
+ INVOKE_ASYNC(usr, invoke_proc, new_text)
+
+//subtypes with additional hooks for DNA and preferences.
+/datum/element/flavor_text/carbon
+ invoke_proc = /mob/living/carbon.proc/update_flavor_text_feature
+
+/datum/element/flavor_text/carbon/Attach(datum/target, text, _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+ if(!iscarbon(target))
+ return ELEMENT_INCOMPATIBLE
+ . = ..()
+ if(. == ELEMENT_INCOMPATIBLE)
+ return
+ RegisterSignal(target, COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, .proc/update_dna_flavor_text)
+ if(ishuman(target))
+ RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
+ RegisterSignal(target, COMSIG_HUMAN_HARDSET_DNA, .proc/update_dna_flavor_text)
+
+
+/datum/element/flavor_text/carbon/Detach(mob/living/carbon/C)
+ . = ..()
+ UnregisterSignal(C, list(COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_HUMAN_HARDSET_DNA))
+
+/datum/element/flavor_text/carbon/proc/update_dna_flavor_text(mob/living/carbon/C)
+ texts_by_mob[C] = C.dna.features["flavor_text"]
+
+/datum/element/flavor_text/carbon/proc/update_prefs_flavor_text(mob/living/carbon/human/H, datum/preferences/P, icon_updates = TRUE, roundstart_checks = TRUE)
+ texts_by_mob[H] = P.features["flavor_text"]
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index cdc3fbc5b9..a48680fb80 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -2390,6 +2390,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
character.Digitigrade_Leg_Swap(TRUE)
+ SEND_SIGNAL(character, COMSIG_HUMAN_PREFS_COPIED_TO, src, icon_updates, roundstart_checks)
+
//let's be sure the character updates
if(icon_updates)
character.update_body()
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 574a5aedd2..5f8b90bb5f 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -1010,3 +1010,8 @@
/mob/living/carbon/can_hold_items()
return TRUE
+
+/mob/living/carbon/proc/update_flavor_text_feature(new_text)
+ if(!dna)
+ return
+ dna.features["flavor_text"] = new_text
diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm
index fec82b357f..cb21534d25 100644
--- a/code/modules/mob/living/carbon/human/examine.dm
+++ b/code/modules/mob/living/carbon/human/examine.dm
@@ -25,15 +25,10 @@
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
- if(ishuman(src)) //user just returned, y'know, the user's own species. dumb.
- var/mob/living/carbon/human/H = src
- var/datum/species/pref_species = H.dna.species
- if(get_visible_name() == "Unknown") // same as flavor text, but hey it works.
- . += "You can't make out what species they are."
- else if(skipface)
- . += "You can't make out what species they are."
- else
- . += "[t_He] [t_is] a [H.dna.custom_species ? H.dna.custom_species : pref_species.name]!"
+ if(skipface || get_visible_name() == "Unknown")
+ . += "You can't make out what species they are."
+ else
+ . += "[t_He] [t_is] a [dna.custom_species ? dna.custom_species : dna.species.name]!"
//uniform
if(w_uniform && !(SLOT_W_UNIFORM in obscured))
@@ -389,18 +384,8 @@
else if(isobserver(user) && traitstring)
. += "Traits: [traitstring]"
- //No flavor text unless the face can be seen. Prevents certain metagaming with impersonation.
- var/invisible_man = skipface || get_visible_name() == "Unknown"
- if(invisible_man)
- . += "...?"
- else
- var/flavor = print_flavor_text(flavor_text)
- if(flavor)
- . += flavor
- var/temp_flavor = print_flavor_text(flavor_text_2,TRUE)
- if(temp_flavor)
- . += temp_flavor
- SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
+ SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .) //This also handles flavor texts now
+
. += "*---------*"
/mob/living/proc/status_effect_examines(pronoun_replacement) //You can include this in any mob's examine() to show the examine texts of status effects!
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 423277863f..2320715dac 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -9,8 +9,6 @@
verbs += /mob/living/proc/mob_sleep
verbs += /mob/living/proc/lay_down
verbs += /mob/living/carbon/human/proc/underwear_toggle //fwee
- verbs += /mob/proc/set_flavor
- verbs += /mob/proc/set_flavor_2
//initialize limbs first
create_bodyparts()
@@ -40,6 +38,10 @@
. = ..()
if(!CONFIG_GET(flag/disable_human_mood))
AddComponent(/datum/component/mood)
+ AddElement(/datum/element/flavor_text/carbon)
+ AddElement(/datum/element/flavor_text, null, null, "Temporary Flavor Text",
+ "Sets a description of your character's current appearance. Use this for emotions, poses etc.",
+ "This should be used only for things pertaining to the current round!")
/mob/living/carbon/human/Destroy()
QDEL_NULL(physiology)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 1ca6299efb..f9acb8bd45 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -504,14 +504,6 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
unset_machine()
src << browse(null, t1)
- if(href_list["flavor_more"])
- usr << browse(text("[][]", name, replacetext(flavor_text, "\n", "
")), text("window=[];size=500x200", name))
- onclose(usr, "[name]")
-
- if(href_list["flavor2_more"])
- usr << browse(text("[][]", name, replacetext(flavor_text_2, "\n", "
")), text("window=[];size=500x200", name))
- onclose(usr, "[name]")
-
if(href_list["refresh"])
if(machine && in_range(src, usr))
show_inv(machine)
diff --git a/modular_citadel/code/modules/client/preferences.dm b/modular_citadel/code/modules/client/preferences.dm
index 8b0ba2dd43..f1dbe31d02 100644
--- a/modular_citadel/code/modules/client/preferences.dm
+++ b/modular_citadel/code/modules/client/preferences.dm
@@ -49,6 +49,5 @@
/datum/preferences/copy_to(mob/living/carbon/human/character, icon_updates = 1)
..()
character.give_genitals(TRUE)
- character.flavor_text = features["flavor_text"] //Let's update their flavor_text at least initially
if(icon_updates)
character.update_genitals()
diff --git a/tgstation.dme b/tgstation.dme
index 73beef27e5..e83df63774 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -499,6 +499,7 @@
#include "code\datums\elements\dusts_on_leaving_area.dm"
#include "code\datums\elements\earhealing.dm"
#include "code\datums\elements\firestacker.dm"
+#include "code\datums\elements\flavor_text.dm"
#include "code\datums\elements\ghost_role_eligibility.dm"
#include "code\datums\elements\mob_holder.dm"
#include "code\datums\elements\swimming.dm"
From 6de290758be750ff3ed7f02e32cf505f6dbd2bdc Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 5 Mar 2020 19:07:24 +0100
Subject: [PATCH 02/13] Oh, yea.
---
code/datums/elements/flavor_text.dm | 15 +++++++--------
code/modules/mob/living/carbon/human/human.dm | 2 +-
code/modules/mob/mob_defines.dm | 3 ---
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index f823f4aa79..cdee3f44c0 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -9,19 +9,19 @@
var/always_show = FALSE
var/max_len = MAX_FAVOR_LEN
-/datum/element/flavor_text/Attach(datum/target, text, _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
. = ..()
if(. == ELEMENT_INCOMPATIBLE || !isatom(target)) //no reason why this shouldn't work on atoms too.
return ELEMENT_INCOMPATIBLE
- texts_by_mob[target] = text
+ if(_max_len)
+ max_len = _max_len
+ texts_by_mob[target] = copytext(text, 1, max_len)
if(_name)
flavor_name = _name
if(_proc)
invoke_proc = _proc
- if(_max_len)
- max_len = _max_len
if(!isnull(addendum))
addendum = _addendum
always_show = _always_show
@@ -56,9 +56,9 @@
return
var/msg = replacetext(text, "\n", " ")
if(length_char(msg) <= 40)
- return "[html_encode(msg)]"
+ examine_list += "[html_encode(msg)]"
else
- return "[html_encode(copytext_char(msg, 1, 37))]... More..."
+ examine_list += "[html_encode(copytext_char(msg, 1, 37))]... More..."
/datum/element/flavor_text/Topic(href, href_list)
. = ..()
@@ -90,7 +90,7 @@
/datum/element/flavor_text/carbon
invoke_proc = /mob/living/carbon.proc/update_flavor_text_feature
-/datum/element/flavor_text/carbon/Attach(datum/target, text, _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
if(!iscarbon(target))
return ELEMENT_INCOMPATIBLE
. = ..()
@@ -101,7 +101,6 @@
RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
RegisterSignal(target, COMSIG_HUMAN_HARDSET_DNA, .proc/update_dna_flavor_text)
-
/datum/element/flavor_text/carbon/Detach(mob/living/carbon/C)
. = ..()
UnregisterSignal(C, list(COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_HUMAN_HARDSET_DNA))
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 2320715dac..b114c4e3b1 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -39,7 +39,7 @@
if(!CONFIG_GET(flag/disable_human_mood))
AddComponent(/datum/component/mood)
AddElement(/datum/element/flavor_text/carbon)
- AddElement(/datum/element/flavor_text, null, null, "Temporary Flavor Text",
+ AddElement(/datum/element/flavor_text, "", null, "Temporary Flavor Text",
"Sets a description of your character's current appearance. Use this for emotions, poses etc.",
"This should be used only for things pertaining to the current round!")
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index c45f6eec13..0ad9b672d3 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -125,6 +125,3 @@
var/siliconaccesstoggle = FALSE
var/voluntary_ghosted = FALSE //whether or not they voluntarily ghosted.
-
- var/flavor_text = ""
- var/flavor_text_2 = "" //version of the above that only lasts for the current round.
From 324f75c4db36be530a032239471a47a98ec31dac Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 5 Mar 2020 21:41:41 +0100
Subject: [PATCH 03/13] Makes the thing actually work.
---
code/datums/elements/flavor_text.dm | 62 ++++++++++++++-----
code/modules/mob/living/carbon/carbon.dm | 5 --
code/modules/mob/living/carbon/human/human.dm | 2 +-
3 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index cdee3f44c0..989bf6d2cd 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -1,15 +1,15 @@
+GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
+
/datum/element/flavor_text
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
id_arg_index = 3
var/flavor_name = "Flavor Text"
- var/procpath/verb_instance
- var/invoke_proc
var/list/texts_by_mob = list()
var/addendum = "This can also be used for OOC notes and preferences!"
var/always_show = FALSE
var/max_len = MAX_FAVOR_LEN
-/datum/element/flavor_text/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/Attach(datum/target, text = "", _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
. = ..()
if(. == ELEMENT_INCOMPATIBLE || !isatom(target)) //no reason why this shouldn't work on atoms too.
@@ -20,8 +20,6 @@
texts_by_mob[target] = copytext(text, 1, max_len)
if(_name)
flavor_name = _name
- if(_proc)
- invoke_proc = _proc
if(!isnull(addendum))
addendum = _addendum
always_show = _always_show
@@ -29,16 +27,20 @@
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/show_flavor)
if(can_edit && ismob(target)) //but only mobs receive the proc/verb for the time being
+ LAZYADD(GLOB.mobs_with_editable_flavor_text[target], src)
var/mob/M = target
- if(!verb_instance)
- verb_instance = new /datum/element/flavor_text/proc/set_flavor (src, "Set [_name]", _desc)
- M.verbs += verb_instance
+ M.verbs |= /mob/proc/manage_flavor_tests
/datum/element/flavor_text/Detach(atom/A)
. = ..()
UnregisterSignal(A, COMSIG_PARENT_EXAMINE)
texts_by_mob -= A
- A.verbs -= verb_instance
+ LAZYREMOVE(GLOB.mobs_with_editable_flavor_text[A], src)
+ if(!GLOB.mobs_with_editable_flavor_text[A])
+ GLOB.mobs_with_editable_flavor_text -= A
+ if(ismob(A))
+ var/mob/M = A
+ M.verbs -= /mob/proc/manage_flavor_tests
/datum/element/flavor_text/proc/show_flavor(atom/target, mob/user, list/examine_list)
if(!always_show && isliving(target))
@@ -72,23 +74,44 @@
onclose(usr, "[target.name]")
return TRUE
-/datum/element/flavor_text/proc/set_flavor()
+/mob/proc/manage_flavor_tests()
+ set name = "Manage Flavor Texts"
+ set name = "Used to manage your various flavor texts."
set category = "IC"
- if(!(usr in texts_by_mob))
+ var/list/L = GLOB.mobs_with_editable_flavor_text[src]
+
+ if(length(L) == 1)
+ var/datum/element/flavor_text/F = L[1]
+ F.set_flavor(src)
return
+ var/list/choices
+
+ for(var/i in L)
+ var/datum/element/flavor_text/F = i
+ LAZYSET(choices, F.flavor_name, F)
+
+ var/chosen = input(src, "Which flavor text would you like to modify?") as null|anything in choices
+ if(!chosen)
+ return
+ var/datum/element/flavor_text/F = choices[chosen]
+ F.set_flavor(src)
+
+/datum/element/flavor_text/proc/set_flavor(mob/user)
+ if(!(user in texts_by_mob))
+ return FALSE
+
var/lower_name = lowertext(flavor_name)
- var/new_text = stripped_multiline_input(usr, "Set the [lower_name] displayed on 'examine'. [addendum]", flavor_name, texts_by_mob[usr], max_len, TRUE)
- if(!isnull(new_text) && (usr in texts_by_mob))
- texts_by_mob[usr] = html_decode(new_text)
+ var/new_text = stripped_multiline_input(user, "Set the [lower_name] displayed on 'examine'. [addendum]", flavor_name, texts_by_mob[usr], max_len, TRUE)
+ if(!isnull(new_text) && (user in texts_by_mob))
+ texts_by_mob[user] = html_decode(new_text)
to_chat(src, "Your [lower_name] has been updated.")
- if(invoke_proc)
- INVOKE_ASYNC(usr, invoke_proc, new_text)
+ return TRUE
+ return FALSE
//subtypes with additional hooks for DNA and preferences.
/datum/element/flavor_text/carbon
- invoke_proc = /mob/living/carbon.proc/update_flavor_text_feature
/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
if(!iscarbon(target))
@@ -110,3 +133,8 @@
/datum/element/flavor_text/carbon/proc/update_prefs_flavor_text(mob/living/carbon/human/H, datum/preferences/P, icon_updates = TRUE, roundstart_checks = TRUE)
texts_by_mob[H] = P.features["flavor_text"]
+
+/datum/element/flavor_text/carbon/set_flavor(mob/living/carbon/user)
+ . = ..()
+ if(. && user.dna)
+ user.dna.features["flavor_text"] = texts_by_mob[user]
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 5f8b90bb5f..574a5aedd2 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -1010,8 +1010,3 @@
/mob/living/carbon/can_hold_items()
return TRUE
-
-/mob/living/carbon/proc/update_flavor_text_feature(new_text)
- if(!dna)
- return
- dna.features["flavor_text"] = new_text
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index b114c4e3b1..78f97c69bc 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -39,7 +39,7 @@
if(!CONFIG_GET(flag/disable_human_mood))
AddComponent(/datum/component/mood)
AddElement(/datum/element/flavor_text/carbon)
- AddElement(/datum/element/flavor_text, "", null, "Temporary Flavor Text",
+ AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text",
"Sets a description of your character's current appearance. Use this for emotions, poses etc.",
"This should be used only for things pertaining to the current round!")
From 5ae796574497a312258dd31aad72f0238e3aacf0 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 5 Mar 2020 22:06:48 +0100
Subject: [PATCH 04/13] Ok.
---
code/datums/elements/flavor_text.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 989bf6d2cd..61c549d222 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -76,7 +76,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
/mob/proc/manage_flavor_tests()
set name = "Manage Flavor Texts"
- set name = "Used to manage your various flavor texts."
+ set desc = "Used to manage your various flavor texts."
set category = "IC"
var/list/L = GLOB.mobs_with_editable_flavor_text[src]
From ec0d0f9ada5482e6c603a0390c336b5f411dbfba Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 8 Mar 2020 01:27:14 +0100
Subject: [PATCH 05/13] Update flavor_text.dm
---
code/datums/elements/flavor_text.dm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 61c549d222..cf1154299b 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -9,7 +9,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
var/always_show = FALSE
var/max_len = MAX_FAVOR_LEN
-/datum/element/flavor_text/Attach(datum/target, text = "", _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
. = ..()
if(. == ELEMENT_INCOMPATIBLE || !isatom(target)) //no reason why this shouldn't work on atoms too.
@@ -113,7 +113,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
//subtypes with additional hooks for DNA and preferences.
/datum/element/flavor_text/carbon
-/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _desc = "Sets an extended description of your character's features.", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
if(!iscarbon(target))
return ELEMENT_INCOMPATIBLE
. = ..()
@@ -137,4 +137,4 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
/datum/element/flavor_text/carbon/set_flavor(mob/living/carbon/user)
. = ..()
if(. && user.dna)
- user.dna.features["flavor_text"] = texts_by_mob[user]
\ No newline at end of file
+ user.dna.features["flavor_text"] = texts_by_mob[user]
From 5f3496e908b29b1ef9155c0e33d998274ec824ca Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 8 Mar 2020 01:27:35 +0100
Subject: [PATCH 06/13] Update human.dm
---
code/modules/mob/living/carbon/human/human.dm | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 78f97c69bc..99ad0ea4a1 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -39,9 +39,7 @@
if(!CONFIG_GET(flag/disable_human_mood))
AddComponent(/datum/component/mood)
AddElement(/datum/element/flavor_text/carbon)
- AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text",
- "Sets a description of your character's current appearance. Use this for emotions, poses etc.",
- "This should be used only for things pertaining to the current round!")
+ AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text", "This should be used only for things pertaining to the current round!")
/mob/living/carbon/human/Destroy()
QDEL_NULL(physiology)
From d10f0b0e2f9b0b445e753cecc8cb94bca9b17c0e Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 8 Mar 2020 01:28:42 +0100
Subject: [PATCH 07/13] Update flavor_text.dm
---
code/datums/elements/flavor_text.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index cf1154299b..2da9bc994a 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -113,7 +113,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
//subtypes with additional hooks for DNA and preferences.
/datum/element/flavor_text/carbon
-/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _proc, _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
if(!iscarbon(target))
return ELEMENT_INCOMPATIBLE
. = ..()
From 991f9a75b787157642af496c99933979da15d71f Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 8 Mar 2020 01:33:02 +0100
Subject: [PATCH 08/13] Update flavor_text.dm
---
code/datums/elements/flavor_text.dm | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 2da9bc994a..43b2b601f3 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -4,12 +4,13 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
id_arg_index = 3
var/flavor_name = "Flavor Text"
- var/list/texts_by_mob = list()
+ var/list/texts_by_atom = list()
var/addendum = "This can also be used for OOC notes and preferences!"
var/always_show = FALSE
var/max_len = MAX_FAVOR_LEN
+ var/can_edit = TRUE
-/datum/element/flavor_text/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, _edit = TRUE)
. = ..()
if(. == ELEMENT_INCOMPATIBLE || !isatom(target)) //no reason why this shouldn't work on atoms too.
@@ -17,12 +18,13 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(_max_len)
max_len = _max_len
- texts_by_mob[target] = copytext(text, 1, max_len)
+ texts_by_atom[target] = copytext(text, 1, max_len)
if(_name)
flavor_name = _name
if(!isnull(addendum))
addendum = _addendum
always_show = _always_show
+ can_edit = _edit
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/show_flavor)
@@ -34,12 +36,12 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
/datum/element/flavor_text/Detach(atom/A)
. = ..()
UnregisterSignal(A, COMSIG_PARENT_EXAMINE)
- texts_by_mob -= A
- LAZYREMOVE(GLOB.mobs_with_editable_flavor_text[A], src)
- if(!GLOB.mobs_with_editable_flavor_text[A])
- GLOB.mobs_with_editable_flavor_text -= A
- if(ismob(A))
- var/mob/M = A
+ texts_by_atom -= A
+ if(can_edit && ismob(A))
+ var/mob/M = A
+ LAZYREMOVE(GLOB.mobs_with_editable_flavor_text[M], src)
+ if(!GLOB.mobs_with_editable_flavor_text[M])
+ GLOB.mobs_with_editable_flavor_text -= M
M.verbs -= /mob/proc/manage_flavor_tests
/datum/element/flavor_text/proc/show_flavor(atom/target, mob/user, list/examine_list)
@@ -113,7 +115,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
//subtypes with additional hooks for DNA and preferences.
/datum/element/flavor_text/carbon
-/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, can_edit = TRUE)
+/datum/element/flavor_text/carbon/Attach(datum/target, text = "", _name = "Flavor Text", _addendum, _max_len = MAX_FAVOR_LEN, _always_show = FALSE, _edit = TRUE)
if(!iscarbon(target))
return ELEMENT_INCOMPATIBLE
. = ..()
From a139f0adc64b85701786e81b6007df1d1893f28b Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Sun, 8 Mar 2020 01:38:42 +0100
Subject: [PATCH 09/13] Update flavor_text.dm
---
code/datums/elements/flavor_text.dm | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 43b2b601f3..232d338a05 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -55,7 +55,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(!("...?" in examine_list)) //can't think of anything better in case of multiple flavor texts.
examine_list += "...?"
return
- var/text = texts_by_mob[target]
+ var/text = texts_by_atom[target]
if(!text)
return
var/msg = replacetext(text, "\n", " ")
@@ -70,9 +70,9 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
return
if(href_list["show_flavor"])
var/atom/target = href_list["show_flavor"]
- var/text = texts_by_mob[target]
+ var/text = texts_by_atom[target]
if(text)
- usr << browse("[target.name][replacetext(texts_by_mob[target], "\n", "
")]", "window=[target.name];size=500x200")
+ usr << browse("[target.name][replacetext(texts_by_atom[target], "\n", "
")]", "window=[target.name];size=500x200")
onclose(usr, "[target.name]")
return TRUE
@@ -101,13 +101,13 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
F.set_flavor(src)
/datum/element/flavor_text/proc/set_flavor(mob/user)
- if(!(user in texts_by_mob))
+ if(!(user in texts_by_atom))
return FALSE
var/lower_name = lowertext(flavor_name)
- var/new_text = stripped_multiline_input(user, "Set the [lower_name] displayed on 'examine'. [addendum]", flavor_name, texts_by_mob[usr], max_len, TRUE)
- if(!isnull(new_text) && (user in texts_by_mob))
- texts_by_mob[user] = html_decode(new_text)
+ var/new_text = stripped_multiline_input(user, "Set the [lower_name] displayed on 'examine'. [addendum]", flavor_name, texts_by_atom[usr], max_len, TRUE)
+ if(!isnull(new_text) && (user in texts_by_atom))
+ texts_by_atom[user] = html_decode(new_text)
to_chat(src, "Your [lower_name] has been updated.")
return TRUE
return FALSE
@@ -131,12 +131,12 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
UnregisterSignal(C, list(COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_HUMAN_HARDSET_DNA))
/datum/element/flavor_text/carbon/proc/update_dna_flavor_text(mob/living/carbon/C)
- texts_by_mob[C] = C.dna.features["flavor_text"]
+ texts_by_atom[C] = C.dna.features["flavor_text"]
/datum/element/flavor_text/carbon/proc/update_prefs_flavor_text(mob/living/carbon/human/H, datum/preferences/P, icon_updates = TRUE, roundstart_checks = TRUE)
- texts_by_mob[H] = P.features["flavor_text"]
+ texts_by_atom[H] = P.features["flavor_text"]
/datum/element/flavor_text/carbon/set_flavor(mob/living/carbon/user)
. = ..()
if(. && user.dna)
- user.dna.features["flavor_text"] = texts_by_mob[user]
+ user.dna.features["flavor_text"] = texts_by_atom[user]
From aa8dc93a5d4aea663a2dd6f33ce3f98eb858e9e7 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Mon, 9 Mar 2020 22:27:27 +0100
Subject: [PATCH 10/13] locate textref.
---
code/datums/elements/flavor_text.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 61c549d222..bb89836cf1 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -67,7 +67,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(.)
return
if(href_list["show_flavor"])
- var/atom/target = href_list["show_flavor"]
+ var/atom/target = locate(href_list["show_flavor"])
var/text = texts_by_mob[target]
if(text)
usr << browse("[target.name][replacetext(texts_by_mob[target], "\n", "
")]", "window=[target.name];size=500x200")
From 7ba120a8d39db56fabae48f754ee0c3fb39a936a Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 10 Mar 2020 14:12:11 +0100
Subject: [PATCH 11/13] lazyor
---
code/datums/elements/flavor_text.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index f5f029b792..41e9820640 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -29,8 +29,8 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/show_flavor)
if(can_edit && ismob(target)) //but only mobs receive the proc/verb for the time being
- LAZYADD(GLOB.mobs_with_editable_flavor_text[target], src)
var/mob/M = target
+ LAZYOR(GLOB.mobs_with_editable_flavor_text[M], src)
M.verbs |= /mob/proc/manage_flavor_tests
/datum/element/flavor_text/Detach(atom/A)
From 7578d60436dd486fc38a9f959e76ce5e57393058 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 10 Mar 2020 15:11:16 +0100
Subject: [PATCH 12/13] flavor texts unset on randomize, yay.
---
code/__DEFINES/components.dm | 1 +
code/datums/elements/flavor_text.dm | 6 +++++-
code/modules/admin/create_mob.dm | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm
index a8e6e7f67f..5385d6f9ed 100644
--- a/code/__DEFINES/components.dm
+++ b/code/__DEFINES/components.dm
@@ -292,6 +292,7 @@
#define COMSIG_HUMAN_DISARM_HIT "human_disarm_hit" //Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted)
#define COMSIG_HUMAN_PREFS_COPIED_TO "human_prefs_copied_to" //from datum/preferences/copy_to(): (datum/preferences, icon_updates, roundstart_checks)
#define COMSIG_HUMAN_HARDSET_DNA "human_hardset_dna" //from mob/living/carbon/human/hardset_dna(): (ui, se, newreal_name, newblood_type, datum/species, newfeatures)
+#define COMSIG_HUMAN_ON_RANDOMIZE "humman_on_randomize" //from base of proc/randomize_human()
// /datum/species signals
#define COMSIG_SPECIES_GAIN "species_gain" //from datum/species/on_species_gain(): (datum/species/new_species, datum/species/old_species)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 41e9820640..904a314beb 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -125,10 +125,11 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(ishuman(target))
RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
RegisterSignal(target, COMSIG_HUMAN_HARDSET_DNA, .proc/update_dna_flavor_text)
+ RegisterSignal(target, COMSIG_HUMAN_ON_RANDOMIZE, .proc/unset_flavor)
/datum/element/flavor_text/carbon/Detach(mob/living/carbon/C)
. = ..()
- UnregisterSignal(C, list(COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_HUMAN_HARDSET_DNA))
+ UnregisterSignal(C, list(COMSIG_CARBON_IDENTITY_TRANSFERRED_TO, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_HUMAN_HARDSET_DNA, COMSIG_HUMAN_ON_RANDOMIZE))
/datum/element/flavor_text/carbon/proc/update_dna_flavor_text(mob/living/carbon/C)
texts_by_atom[C] = C.dna.features["flavor_text"]
@@ -140,3 +141,6 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
. = ..()
if(. && user.dna)
user.dna.features["flavor_text"] = texts_by_atom[user]
+
+/datum/element/flavor_text/carbon/unset_flavor(mob/living/carbon/user)
+ texts_by_atom[user] = ""
\ No newline at end of file
diff --git a/code/modules/admin/create_mob.dm b/code/modules/admin/create_mob.dm
index 9784aa7cd1..4d1cb1a7de 100644
--- a/code/modules/admin/create_mob.dm
+++ b/code/modules/admin/create_mob.dm
@@ -40,6 +40,9 @@
H.dna.features["insect_wings"] = pick(GLOB.insect_wings_list)
H.dna.features["deco_wings"] = pick(GLOB.deco_wings_list)
H.dna.features["insect_fluff"] = pick(GLOB.insect_fluffs_list)
+ H.dna.features["flavor_text"] = "" //Oh no.
+
+ SEND_SIGNAL(H, COMSIG_HUMAN_ON_RANDOMIZE)
H.update_body()
H.update_hair()
From ddc7d5cf125b08210ab664bbdc3ef48bfc353c6c Mon Sep 17 00:00:00 2001
From: Ghom <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 10 Mar 2020 17:28:31 +0100
Subject: [PATCH 13/13] Update flavor_text.dm
---
code/datums/elements/flavor_text.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/datums/elements/flavor_text.dm b/code/datums/elements/flavor_text.dm
index 904a314beb..54729d5f83 100644
--- a/code/datums/elements/flavor_text.dm
+++ b/code/datums/elements/flavor_text.dm
@@ -142,5 +142,5 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(. && user.dna)
user.dna.features["flavor_text"] = texts_by_atom[user]
-/datum/element/flavor_text/carbon/unset_flavor(mob/living/carbon/user)
- texts_by_atom[user] = ""
\ No newline at end of file
+/datum/element/flavor_text/carbon/proc/unset_flavor(mob/living/carbon/user)
+ texts_by_atom[user] = ""