Skip to content

Commit

Permalink
Remove redundant flavour text settings, finally close #403 (#480)
Browse files Browse the repository at this point in the history
* Remove redundant flavour text settings, finally close #403

* Remove redundant detailed flavor variables and procs, fix flavor
transfer on mob cloning

* Fix compilation errors caused by missing flavor_text preference, remove unused variables

* Remove ingame flavour text change in case of improper preferences saving
between client logins
  • Loading branch information
fluorescent-net committed Feb 11, 2017
1 parent fdeea2b commit abb36d7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 183 deletions.
2 changes: 1 addition & 1 deletion code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
var/ckey=null
var/mind=null
var/languages=null
var/list/flavor=null
var/flavor

/datum/dna2/record/proc/GetData()
var/list/ser=list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

for(var/datum/language/L in R.languages)
H.add_language(L.name)
H.flavor_texts = R.flavor.Copy()
H.flavor_text = R.flavor
attempting = 0
return 1

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
R.name=R.dna.real_name
R.types=DNA2_BUF_UI|DNA2_BUF_UE|DNA2_BUF_SE
R.languages=subject.languages
R.flavor=subject.flavor_texts.Copy()
R.flavor=subject.flavor_text

//Add an implant if needed
var/obj/item/weapon/implant/health/imp = locate(/obj/item/weapon/implant/health, subject)
Expand Down
74 changes: 6 additions & 68 deletions code/modules/client/preference_setup/general/06_flavor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,14 @@
sort_order = 6

/datum/category_item/player_setup_item/general/flavor/load_character(var/savefile/S)
S["flavor_texts_general"] >> pref.flavor_texts["general"]
S["flavor_texts_head"] >> pref.flavor_texts["head"]
S["flavor_texts_face"] >> pref.flavor_texts["face"]
S["flavor_texts_eyes"] >> pref.flavor_texts["eyes"]
S["flavor_texts_torso"] >> pref.flavor_texts["torso"]
S["flavor_texts_arms"] >> pref.flavor_texts["arms"]
S["flavor_texts_hands"] >> pref.flavor_texts["hands"]
S["flavor_texts_legs"] >> pref.flavor_texts["legs"]
S["flavor_texts_feet"] >> pref.flavor_texts["feet"]
S["flavor_text"] >> pref.flavor_text

//Flavour text for robots.
S["flavour_texts_robot_Default"] >> pref.flavour_texts_robot["Default"]
for(var/module in robot_module_types)
S["flavour_texts_robot_[module]"] >> pref.flavour_texts_robot[module]

/datum/category_item/player_setup_item/general/flavor/save_character(var/savefile/S)
S["flavor_texts_general"] << pref.flavor_texts["general"]
S["flavor_texts_head"] << pref.flavor_texts["head"]
S["flavor_texts_face"] << pref.flavor_texts["face"]
S["flavor_texts_eyes"] << pref.flavor_texts["eyes"]
S["flavor_texts_torso"] << pref.flavor_texts["torso"]
S["flavor_texts_arms"] << pref.flavor_texts["arms"]
S["flavor_texts_hands"] << pref.flavor_texts["hands"]
S["flavor_texts_legs"] << pref.flavor_texts["legs"]
S["flavor_texts_feet"] << pref.flavor_texts["feet"]
S["flavor_text"] << pref.flavor_text

S["flavour_texts_robot_Default"] << pref.flavour_texts_robot["Default"]
for(var/module in robot_module_types)
Expand All @@ -42,18 +25,10 @@
. += "<a href='?src=\ref[src];flavour_text_robot=open'>Set Robot Flavor Text</a><br/>"

/datum/category_item/player_setup_item/general/flavor/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["flavor_text"])
switch(href_list["flavor_text"])
if("open")
if("general")
var/msg = sanitize(input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(pref.flavor_texts[href_list["flavor_text"]])) as message, extra = 0)
if(CanUseTopic(user))
pref.flavor_texts[href_list["flavor_text"]] = msg
else
var/msg = sanitize(input(usr,"Set the flavor text for your [href_list["flavor_text"]].","Flavor Text",html_decode(pref.flavor_texts[href_list["flavor_text"]])) as message, extra = 0)
if(CanUseTopic(user))
pref.flavor_texts[href_list["flavor_text"]] = msg
SetFlavorText(user)
if(href_list["flavor_text"] && href_list["flavor_text"] == "open")
var/msg = sanitize(input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(pref.flavor_text)) as message, extra = 0)
if(CanUseTopic(user))
pref.flavor_text = msg
return TOPIC_HANDLED

else if(href_list["flavour_text_robot"])
Expand All @@ -69,45 +44,8 @@
pref.flavour_texts_robot[href_list["flavour_text_robot"]] = msg
SetFlavourTextRobot(user)
return TOPIC_HANDLED

return ..()

/datum/category_item/player_setup_item/general/flavor/proc/SetFlavorText(mob/user)
var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Set Flavour Text</b> <hr />"
HTML += "<br></center>"
HTML += "<a href='?src=\ref[src];flavor_text=general'>General:</a> "
HTML += TextPreview(pref.flavor_texts["general"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=head'>Head:</a> "
HTML += TextPreview(pref.flavor_texts["head"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=face'>Face:</a> "
HTML += TextPreview(pref.flavor_texts["face"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=eyes'>Eyes:</a> "
HTML += TextPreview(pref.flavor_texts["eyes"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=torso'>Body:</a> "
HTML += TextPreview(pref.flavor_texts["torso"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=arms'>Arms:</a> "
HTML += TextPreview(pref.flavor_texts["arms"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=hands'>Hands:</a> "
HTML += TextPreview(pref.flavor_texts["hands"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=legs'>Legs:</a> "
HTML += TextPreview(pref.flavor_texts["legs"])
HTML += "<br>"
HTML += "<a href='?src=\ref[src];flavor_text=feet'>Feet:</a> "
HTML += TextPreview(pref.flavor_texts["feet"])
HTML += "<br>"
HTML += "<hr />"
HTML += "<tt>"
user << browse(HTML, "window=flavor_text;size=430x300")
return

/datum/category_item/player_setup_item/general/flavor/proc/SetFlavourTextRobot(mob/user)
var/HTML = "<body>"
Expand Down
12 changes: 2 additions & 10 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ datum/preferences
var/list/rlimb_data = list()
var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor"

var/list/flavor_texts = list()
var/flavor_text = ""
var/list/flavour_texts_robot = list()

var/med_record = ""
Expand Down Expand Up @@ -216,15 +216,7 @@ datum/preferences
if(character.dna)
character.dna.real_name = character.real_name

character.flavor_texts["general"] = flavor_texts["general"]
character.flavor_texts["head"] = flavor_texts["head"]
character.flavor_texts["face"] = flavor_texts["face"]
character.flavor_texts["eyes"] = flavor_texts["eyes"]
character.flavor_texts["torso"] = flavor_texts["torso"]
character.flavor_texts["arms"] = flavor_texts["arms"]
character.flavor_texts["hands"] = flavor_texts["hands"]
character.flavor_texts["legs"] = flavor_texts["legs"]
character.flavor_texts["feet"] = flavor_texts["feet"]
character.flavor_text = flavor_text

character.body_build = get_body_build(gender, body_build)

Expand Down
41 changes: 0 additions & 41 deletions code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -578,44 +578,3 @@ wink, yawn, swish, sway/wag, fastsway/qwag, stopsway/swag"}
set category = "IC"

pose = sanitize(input(usr, "This is [src]. [get_visible_gender() == MALE ? "He" : get_visible_gender() == FEMALE ? "She" : "They"] [get_visible_gender() == NEUTER ? "are" : "is"]...", "Pose", null) as text)

/mob/living/carbon/human/verb/set_flavor()
set name = "Set Flavour Text"
set desc = "Sets an extended description of your character's features."
set category = "IC"

var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Update Flavour Text</b> <hr />"
HTML += "<br></center>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=general'>General:</a> "
HTML += TextPreview(flavor_texts["general"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=head'>Head:</a> "
HTML += TextPreview(flavor_texts["head"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=face'>Face:</a> "
HTML += TextPreview(flavor_texts["face"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=eyes'>Eyes:</a> "
HTML += TextPreview(flavor_texts["eyes"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=torso'>Body:</a> "
HTML += TextPreview(flavor_texts["torso"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=arms'>Arms:</a> "
HTML += TextPreview(flavor_texts["arms"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=hands'>Hands:</a> "
HTML += TextPreview(flavor_texts["hands"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=legs'>Legs:</a> "
HTML += TextPreview(flavor_texts["legs"])
HTML += "<br>"
HTML += "<a href='byond://?src=\ref[src];flavor_change=feet'>Feet:</a> "
HTML += TextPreview(flavor_texts["feet"])
HTML += "<br>"
HTML += "<hr />"
HTML +="<a href='?src=\ref[src];flavor_change=done'>\[Done\]</a>"
HTML += "<tt>"
src << browse(HTML, "window=flavor_changes;size=430x300")
67 changes: 12 additions & 55 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -685,20 +685,6 @@ var/list/rank_prefix = list(\
var/mob/M = locate(href_list["lookmob"])
src.examinate(M)

if (href_list["flavor_change"])
switch(href_list["flavor_change"])
if("done")
src << browse(null, "window=flavor_changes")
return
if("general")
var/msg = sanitize(input(usr,"Update the general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message, extra = 0)
flavor_texts[href_list["flavor_change"]] = msg
return
else
var/msg = sanitize(input(usr,"Update the flavor text for your [href_list["flavor_change"]].","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message, extra = 0)
flavor_texts[href_list["flavor_change"]] = msg
set_flavor()
return
..()
return

Expand Down Expand Up @@ -1294,51 +1280,22 @@ var/list/rank_prefix = list(\

/mob/living/carbon/human/print_flavor_text(var/shrink = 1)
var/list/equipment = list(src.head,src.wear_mask,src.glasses,src.w_uniform,src.wear_suit,src.gloves,src.shoes)
var/list/exposed = list( \
"head" = 1,\
"face" = 1,\
"eyes" = 1,\
"torso" = 1,\
"arms" = 1,\
"legs" = 1,\
"hands" = 1,\
"feet" = 1\
)

for(var/obj/item/clothing/C in equipment)
if(C.body_parts_covered & HEAD)
exposed["head"] = 0
if(C.body_parts_covered & FACE)
exposed["face"] = 0
if(C.body_parts_covered & EYES)
exposed["eyes"] = 0
exposed["mech_eyes"] = 0
// Do not show flavor if face is hidden
return

flavor_text = src.flavor_text

if (flavor_text && flavor_text != "" && !shrink)
var/msg = trim(replacetext(flavor_text, "\n", " "))
if(!msg) return ""
if(lentext(msg) <= 40)
return "\blue [msg]"
else
var/obj/item/organ/eyes/E = src.internal_organs_by_name["eyes"]
if( E && E.robotic >= 2 ) exposed["eyes"] = 0
else exposed["mech_eyes"] = 0
if(C.body_parts_covered & UPPER_TORSO)
exposed["torso"] = 0
if(C.body_parts_covered & ARMS)
exposed["arms"] = 0
if(C.body_parts_covered & HANDS)
exposed["hands"] = 0
if(C.body_parts_covered & LEGS)
exposed["legs"] = 0
if(C.body_parts_covered & FEET)
exposed["feet"] = 0

flavor_text = flavor_texts["general"]
flavor_text += "\n\n"
for (var/T in flavor_texts)
if(flavor_texts[T] && flavor_texts[T] != "")
if( exposed[T] )
flavor_text += flavor_texts[T]
flavor_text += "\n\n"
if(!shrink)
return flavor_text
else
return ..()
return "\blue [copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a>"
return ..()

/mob/living/carbon/human/getDNA()
if(species.flags & NO_SCAN)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/human/human_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
var/mob/remoteview_target = null
var/hand_blood_color

var/list/flavor_texts = list()
var/gunshot_residue
var/pulling_punches // Are you trying not to hurt your opponent?

Expand Down
5 changes: 0 additions & 5 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,6 @@
if(msg != null)
flavor_text = msg

/mob/proc/warn_flavor_changed()
if(flavor_text && flavor_text != "") // don't spam people that don't use it!
src << "<h2 class='alert'>OOC Warning:</h2>"
src << "<span class='alert'>Your flavor text is likely out of date! <a href='byond://?src=\ref[src];flavor_change=1'>Change</a></span>"

/mob/proc/print_flavor_text()
if (flavor_text && flavor_text != "")
var/msg = trim(replacetext(flavor_text, "\n", " "))
Expand Down

0 comments on commit abb36d7

Please sign in to comment.