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

Adds a 'slot nickname' field for easily ID'ing chara slots #436

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 14 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ var/const/MAX_SAVE_SLOTS = 20

//character preferences
var/real_name //our character's name
var/slot_label //the nickname for the saveslot
var/be_random_name = FALSE //whether we are a random name every round
var/human_name_ban = FALSE

Expand Down Expand Up @@ -327,6 +328,8 @@ var/const/MAX_SAVE_SLOTS = 20
dat += "<h1><u><b>Name:</b></u> "
dat += "<a href='?_src_=prefs;preference=name;task=input'><b>[real_name]</b></a>"
dat += "<a href='?_src_=prefs;preference=name;task=random'>&reg</A></h1>"
dat += "<u><b>Slot label:</b></u> "
dat += "<a href='?_src_=prefs;preference=slot_label;task=input'><b>[slot_label ? "[slot_label]" : "---"]</b></a><br> "
dat += "<b>Always Pick Random Name:</b> <a href='?_src_=prefs;preference=rand_name'><b>[be_random_name ? "Yes" : "No"]</b></a><br>"
dat += "<b>Always Pick Random Appearance:</b> <a href='?_src_=prefs;preference=rand_body'><b>[be_random_body ? "Yes" : "No"]</b></a><br><br>"

Expand Down Expand Up @@ -1246,6 +1249,15 @@ var/const/MAX_SAVE_SLOTS = 20
else
to_chat(user, "<font color='red'>Invalid name. Your name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>")

if("slot_label")
var/raw_name = input(user, "Choose a short label or identifier for this character slot. This is not an in-character nickname:", "Character Preference") as text|null
if (raw_name) // Check to ensure that the user entered text (rather than cancel.)
var/new_name = reject_bad_name(raw_name)
if(new_name)
slot_label = new_name
else
to_chat(user, "<font color='red'>Invalid name. Your slot name should be at least 2 and at most [MAX_NAME_LEN] characters long. It may only contain the characters A-Z, a-z, -, ' and .</font>")

if("xeno_vision_level_pref")
var/static/list/vision_level_choices = list(XENO_VISION_LEVEL_NO_NVG, XENO_VISION_LEVEL_MID_NVG, XENO_VISION_LEVEL_FULL_NVG)
var/choice = tgui_input_list(user, "Choose your default xeno vision level", "Vision level", vision_level_choices, theme="hive_status")
Expand Down Expand Up @@ -2224,10 +2236,11 @@ var/const/MAX_SAVE_SLOTS = 20
for(var/i=1, i<=MAX_SAVE_SLOTS, i++)
S.cd = "/character[i]"
S["real_name"] >> name
S["slot_label"] >> slot_label
if(!name) name = "Character[i]"
if(i==default_slot)
name = "<b>[name]</b>"
dat += "<a href='?_src_=prefs;preference=changeslot;num=[i];'>[name]</a><br>"
dat += "<a href='?_src_=prefs;preference=changeslot;num=[i];'>[name] ([slot_label])</a><br>"

dat += "<hr>"
dat += "<a href='byond://?src=\ref[user];preference=close_load_dialog'>Close</a><br>"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@
//Character
S["OOC_Notes"] >> metadata
S["real_name"] >> real_name
S["slot_label"] >> slot_label
S["name_is_always_random"] >> be_random_name
S["body_is_always_random"] >> be_random_body
S["gender"] >> gender
Expand Down Expand Up @@ -673,6 +674,7 @@
//Character
S["OOC_Notes"] << metadata
S["real_name"] << real_name
S["slot_label"] << slot_label
S["name_is_always_random"] << be_random_name
S["body_is_always_random"] << be_random_body
S["gender"] << gender
Expand Down
Loading