diff --git a/SQL/migrate/V004__Character_signatures.sql b/SQL/migrate/V004__Character_signatures.sql
new file mode 100644
index 00000000000..6e3bb0a295b
--- /dev/null
+++ b/SQL/migrate/V004__Character_signatures.sql
@@ -0,0 +1,8 @@
+--
+-- Implemented in PR #2098.
+-- Adds character signature fields to the database.
+--
+
+ALTER TABLE `ss13_characters_flavour`
+ ADD `signature` TINYTEXT NULL DEFAULT NULL AFTER `char_id`,
+ ADD `signature_font` TINYTEXT TINYTEXT NULL DEFAULT NULL AFTER `signature`;
diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm
index ac0ef764086..d84cde3cd1e 100644
--- a/code/_helpers/text.dm
+++ b/code/_helpers/text.dm
@@ -407,11 +407,7 @@ proc/TextPreview(var/string,var/len=40)
#define strip_improper(input_text) replacetext(replacetext(input_text, "\proper", ""), "\improper", "")
-/proc/pencode2html(t)
- t = replacetext(t, "\n", "
")
- t = replacetext(t, "\[center\]", "
")
- t = replacetext(t, "\[/center\]", "")
- t = replacetext(t, "\[br\]", "
")
+/proc/pencode2html(t, limited = 0)
t = replacetext(t, "\[b\]", "")
t = replacetext(t, "\[/b\]", "")
t = replacetext(t, "\[i\]", "")
@@ -420,6 +416,17 @@ proc/TextPreview(var/string,var/len=40)
t = replacetext(t, "\[/u\]", "")
t = replacetext(t, "\[large\]", "")
t = replacetext(t, "\[/large\]", "")
+ t = replacetext(t, "\[small\]", "")
+ t = replacetext(t, "\[/small\]", "")
+
+ // A break for signature customization code to use this proc as well.
+ if (limited)
+ return t
+
+ t = replacetext(t, "\n", "
")
+ t = replacetext(t, "\[center\]", "")
+ t = replacetext(t, "\[/center\]", "")
+ t = replacetext(t, "\[br\]", "
")
t = replacetext(t, "\[field\]", "")
t = replacetext(t, "\[h1\]", "")
t = replacetext(t, "\[/h1\]", "
")
@@ -429,8 +436,6 @@ proc/TextPreview(var/string,var/len=40)
t = replacetext(t, "\[/h3\]", "")
t = replacetext(t, "\[*\]", "")
t = replacetext(t, "\[hr\]", "
")
- t = replacetext(t, "\[small\]", "")
- t = replacetext(t, "\[/small\]", "")
t = replacetext(t, "\[list\]", "")
t = replacetext(t, "\[/list\]", "
")
t = replacetext(t, "\[table\]", "")
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index d9581a74450..1074527114a 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -62,6 +62,10 @@
// the world.time since the mob has been brigged, or -1 if not at all
var/brigged_since = -1
+ // Custom signature data.
+ var/signature
+ var/signfont
+
//put this here for easier tracking ingame
var/datum/money_account/initial_account
@@ -482,6 +486,11 @@
mind.original = src
SSticker.minds += mind
if(!mind.name) mind.name = real_name
+ if (client)
+ if (client.prefs.signature)
+ mind.signature = client.prefs.signature
+ if (client.prefs.signfont)
+ mind.signfont = client.prefs.signfont
mind.current = src
//HUMAN
diff --git a/code/modules/client/preference_setup/general/06_flavor.dm b/code/modules/client/preference_setup/general/06_flavor.dm
index d9a4956fa58..a3bf412e6e0 100644
--- a/code/modules/client/preference_setup/general/06_flavor.dm
+++ b/code/modules/client/preference_setup/general/06_flavor.dm
@@ -18,6 +18,9 @@
for(var/module in robot_module_types)
S["flavour_texts_robot_[module]"] >> pref.flavour_texts_robot[module]
+ S["signature"] >> pref.signature
+ S["signfont"] >> pref.signfont
+
/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"]
@@ -33,6 +36,9 @@
for(var/module in robot_module_types)
S["flavour_texts_robot_[module]"] << pref.flavour_texts_robot[module]
+ S["signature"] << pref.signature
+ S["signfont"] << pref.signfont
+
/datum/category_item/player_setup_item/general/flavor/gather_load_query()
var/list/var_list = list("flavour_general" = "flavor_texts/general",
"flavour_head" = "flavor_texts/head",
@@ -43,7 +49,9 @@
"flavour_hands" = "flavor_texts/hands",
"flavour_legs" = "flavor_texts/legs",
"flavour_feet" = "flavor_texts/feet",
- "robot_default" = "flavour_texts_robot/default")
+ "robot_default" = "flavour_texts_robot/default",
+ "signature" = "signature",
+ "signature_font" = "signfont")
for (var/module in robot_module_types)
var_list["robot_[module]"] = "flavour_texts_robot/[module]"
@@ -64,6 +72,8 @@
"flavour_legs",
"flavour_feet",
"robot_default",
+ "signature",
+ "signature_font",
"char_id" = 1)
for (var/module in robot_module_types)
@@ -82,20 +92,30 @@
":flavour_hands" = pref.flavor_texts["hands"],
":flavour_legs" = pref.flavor_texts["legs"],
":flavour_feet" = pref.flavor_texts["feet"],
- ":robot_default" = pref.flavour_texts_robot["default"])
+ ":robot_default" = pref.flavour_texts_robot["default"],
+ ":signature" = pref.signature,
+ ":signature_font" = pref.signfont)
for (var/module in robot_module_types)
var_list[":robot_[module]"] += pref.flavour_texts_robot[module]
return var_list
-/datum/category_item/player_setup_item/general/flavor/sanitize_character()
- return
+/datum/category_item/player_setup_item/general/flavor/sanitize_character(var/sql_load = 0)
+ if (!pref.signature)
+ pref.signature = "[pref.real_name]"
+ if (!pref.signfont)
+ pref.signfont = "Verdana"
/datum/category_item/player_setup_item/general/flavor/content(var/mob/user)
. += "Flavor:
"
. += "Set Flavor Text
"
. += "Set Robot Flavor Text
"
+ . += "
"
+ . += "Signature: [pref.signature]
"
+ . += "Edit Text | "
+ . += "Edit Font | "
+ . += "Help
"
/datum/category_item/player_setup_item/general/flavor/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["flavor_text"])
@@ -126,6 +146,48 @@
SetFlavourTextRobot(user)
return TOPIC_HANDLED
+ else if (href_list["edit_signature"])
+ switch (href_list["edit_signature"])
+ if ("text")
+ var/new_sign = input(usr, "Please input the new character signature.", "New signature", pref.signature) as null|text
+ if (!new_sign)
+ to_chat(usr, span("notice", "Cancelled."))
+ if (pref.signature)
+ return TOPIC_NOACTION
+ else
+ pref.signature = "[pref.real_name]"
+ return TOPIC_REFRESH
+ new_sign = sanitize(new_sign, 100)
+ new_sign = pencode2html(new_sign, 1)
+ pref.signature = new_sign
+
+ return TOPIC_REFRESH
+ if ("font")
+ var/new_font = input(usr, "Please select the font to use.", "New font") as null|anything in list("Verdana", "Times New Roman", "Courier New")
+ if (!new_font)
+ to_chat(usr, span("notice", "Cancelled."))
+ if (pref.signfont)
+ return TOPIC_NOACTION
+ else
+ pref.signfont = "Verdana"
+ return TOPIC_REFRESH
+ pref.signfont = new_font
+
+ return TOPIC_REFRESH
+ if ("help")
+ var/html = ""
+ html += "A character's signature can be augmented with the following tags:
"
+ html += "- Italics - \[i\]text\[\\i\]
"
+ html += "- Bold - \[b\]text\[\\b\]
"
+ html += "- Underline - \[u\]text\[\\u\]
"
+ html += "- Large text - \[large\]text\[\\large\]
"
+ html += "- Small text - \[small\]text\[\\small\]
"
+ html += "
Beyond that, a maximum of 100 symbols are allowed for the signature text."
+ html += " Note that this includes mark-up symbols."
+
+ show_browser(usr, html, "window=signaturehelp;size=350x300")
+ return TOPIC_HANDLED
+
return ..()
/datum/category_item/player_setup_item/general/flavor/proc/SetFlavorText(mob/user)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 349ba8bcc24..24c19605d2a 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -131,6 +131,10 @@ datum/preferences
var/list/pai = list() // A list for holding pAI related data.
+ // Signature information
+ var/signature = ""
+ var/signfont = ""
+
var/client/client = null
var/savefile/loaded_preferences
@@ -480,6 +484,8 @@ datum/preferences
gender = pick(MALE, FEMALE)
real_name = random_name(gender,species)
b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")
+ signature = "[real_name]"
+ signfont = "Verdana"
current_character = 0
can_edit_name = 1
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index 795a948d096..2dfd9eaa6ef 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -241,12 +241,25 @@
/obj/item/weapon/paper/proc/get_signature(var/obj/item/weapon/pen/P, mob/user as mob)
if(P && istype(P, /obj/item/weapon/pen))
return P.get_signature(user)
- return (user && user.real_name) ? user.real_name : "Anonymous"
+
+ if (user)
+ if (user.mind && user.mind.signature)
+ return user.mind.signature
+ else if (user.real_name)
+ return "[user.real_name]"
+
+ return "Anonymous"
+
+/obj/item/weapon/paper/proc/get_signfont(var/obj/item/weapon/pen/P, var/mob/user)
+ if (!istype(P, /obj/item/weapon/pen/chameleon))
+ if (user && user.mind && user.mind.signfont)
+ return user.mind.signfont
+
+ return signfont
/obj/item/weapon/paper/proc/parsepencode(t, obj/item/weapon/pen/P, mob/user, iscrayon)
- if(findtext(t, "\[sign\]"))
- t = replacetext(t, "\[sign\]", "[get_signature(P, user)]")
+ t = replacetext(t, "\[sign\]", "[get_signature(P, user)]")
if(iscrayon) // If it is a crayon, and he still tries to use these, make them empty!
t = replacetext(t, "\[*\]", "")
@@ -548,4 +561,4 @@ Please note: Cell timers will \[b\]NOT\[/b\] function without a valid incident f
..()
/obj/item/weapon/paper/sentencing/update_icon()
- return
\ No newline at end of file
+ return
diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm
index bd0310df6df..f5c65f0c2c9 100644
--- a/code/modules/paperwork/pen.dm
+++ b/code/modules/paperwork/pen.dm
@@ -125,24 +125,19 @@
var/signature = ""
/obj/item/weapon/pen/chameleon/attack_self(mob/user as mob)
- /*
- // Limit signatures to official crew members
- var/personnel_list[] = list()
- for(var/datum/data/record/t in data_core.locked) //Look in data core locked.
- personnel_list.Add(t.fields["name"])
- personnel_list.Add("Anonymous")
-
- var/new_signature = input("Enter new signature pattern.", "New Signature") as null|anything in personnel_list
- if(new_signature)
- signature = new_signature
- */
signature = sanitize(input("Enter new signature. Leave blank for 'Anonymous'", "New Signature", signature))
/obj/item/weapon/pen/proc/get_signature(var/mob/user)
- return (user && user.real_name) ? user.real_name : "Anonymous"
+ if (user)
+ if (user.mind && user.mind.signature)
+ return user.mind.signature
+ else if (user.real_name)
+ return "[user.real_name]"
+
+ return "Anonymous"
/obj/item/weapon/pen/chameleon/get_signature(var/mob/user)
- return signature ? signature : "Anonymous"
+ return signature ? "[signature]" : "Anonymous"
/obj/item/weapon/pen/chameleon/verb/set_colour()
set name = "Change Pen Colour"
diff --git a/html/changelogs/skull132-signatures.yml b/html/changelogs/skull132-signatures.yml
new file mode 100644
index 00000000000..5e09803e7ba
--- /dev/null
+++ b/html/changelogs/skull132-signatures.yml
@@ -0,0 +1,6 @@
+author: Skull132
+
+delete-after: True
+
+changes:
+ - rscadd: "Added customized signatures to character customization. Enjoy!"