Skip to content

Commit

Permalink
Adds a 'slot nickname' field for easily ID'ing chara slots (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
BonniePandora committed Sep 10, 2024
1 parent fce8f94 commit 99303e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,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 @@ -334,6 +335,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 @@ -1260,6 +1263,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 @@ -2250,10 +2262,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 @@ -515,6 +515,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 @@ -680,6 +681,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

0 comments on commit 99303e1

Please sign in to comment.