Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flavor Text returns #575

Merged
merged 6 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions code/modules/client/preferences/flavortext.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@
savefile_identifier = PREFERENCE_CHARACTER
savefile_key = "flavor_text"

explanation = "Flavor Text"

/datum/preference/text/flavor_text/get_button(datum/preferences/prefs)
return button_element(prefs, "Set Examine Text", "pref_act=[type]")

/datum/preference/text/flavor_text/user_edit(mob/user, datum/preferences/prefs)
var/input = tgui_input_text(user, "Describe your character in greater detail.",, serialize(prefs.read_preference(type)))
Copy link
Member

@Kapu1178 Kapu1178 Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a sensible length limit. You also might want to make this a multi-line input and strip out the newline characters after.

if(!input)
return
. = prefs.update_preference(src, input)

if(istype(user, /mob/dead/new_player))
var/mob/dead/new_player/player = user
player.new_player_panel()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather odd, what's it for?


return .

/datum/preference/text/flavor_text/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["flavor_text"] = value
1 change: 1 addition & 0 deletions code/modules/client/preferences/html_prefs/modules/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/datum/preference/choiced/gender,
/datum/preference/choiced/body_type = TRUE,
/datum/preference/choiced/species,
/datum/preference/text/flavor_text,
)

var/list/clothing = list(
Expand Down
13 changes: 13 additions & 0 deletions code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@
else if(isobserver(user))
. += span_info("<b>Traits:</b> [get_quirk_string(FALSE, CAT_QUIRK_ALL)]")

var/flavor_text_link
/// The first 1-FLAVOR_PREVIEW_LIMIT characters in the mob's "flavor_text" DNA feature. FLAVOR_PREVIEW_LIMIT is defined in flavor_defines.dm.
var/preview_text = copytext_char((dna.features["flavor_text"]), 1, FLAVOR_PREVIEW_LIMIT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really not a fan of this being stored in DNA.features.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as storing it elsewhere does not replicate the problem I have seen in other servers where when the client disconnects, their flavor text doesnt go with the client which causes weird issues. @Kapu1178

Copy link
Contributor

@RimiNosha RimiNosha Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be best to store it in mind instead.

Actually that's a stupid idea due to that being transferred with the brain IIRC, just write it to a var on the mob. Maybe it could be reused for giving other mobs extra examine info too, though that might be out of scope.

// What examine_tgui.dm uses to determine if flavor text appears as "Obscured".
var/face_obscured = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
Cenrus marked this conversation as resolved.
Show resolved Hide resolved
if(preview_text)
if (!(face_obscured))
flavor_text_link = span_notice("[preview_text]... <a href='?src=[REF(src)];open_examine_panel=1'>Look closer?</a>")
Cenrus marked this conversation as resolved.
Show resolved Hide resolved
else
flavor_text_link = span_notice("...?")
if (flavor_text_link)
. += flavor_text_link

SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)

/**
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
if(check_obscured_slots(TRUE) & slot)
to_chat(usr, span_warning("You can't reach that! Something is covering it."))
return
if(href_list["open_examine_panel"])
var/content = dna.features["flavor_text"]
usr << browse("<HTML><HEAD><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><TITLE>[name]</TITLE></HEAD><BODY><TT>[replacetext(content, "\n", "<BR>")]</TT></BODY></HTML>", "window=[name];size=500x200")
onclose(usr, "[name]")
Cenrus marked this conversation as resolved.
Show resolved Hide resolved

///////HUDs///////
if(href_list["hud"])
Expand Down
61 changes: 0 additions & 61 deletions tgui/packages/tgui/interfaces/ExaminePanel.js

This file was deleted.

Loading