Makes Ghost Anonsay Persistent by Turning it into its own Preference

By turning it into its own preference. The verb stays in the ghost tab, except it now operates by checking client preferences.

Needs
ALTER TABLE `player` ADD `ghost_anonsay` TINYINT(1) NOT NULL DEFAULT '0' AFTER `lastchangelog`;
to add it to the SQL
This commit is contained in:
KasparoVy
2017-02-01 02:17:28 -05:00
parent a84d4a1b8d
commit 9d30930338
6 changed files with 20 additions and 12 deletions
@@ -95,6 +95,8 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
var/UI_style_alpha = 255
var/windowflashing = TRUE
//ghostly preferences
var/ghost_anonsay = 0
//character preferences
var/real_name //our character's name
@@ -444,6 +446,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
dat += "<b>Ghost ears:</b> <a href='?_src_=prefs;preference=ghost_ears'><b>[(toggles & CHAT_GHOSTEARS) ? "Nearest Creatures" : "All Speech"]</b></a><br>"
dat += "<b>Ghost sight:</b> <a href='?_src_=prefs;preference=ghost_sight'><b>[(toggles & CHAT_GHOSTSIGHT) ? "Nearest Creatures" : "All Emotes"]</b></a><br>"
dat += "<b>Ghost radio:</b> <a href='?_src_=prefs;preference=ghost_radio'><b>[(toggles & CHAT_GHOSTRADIO) ? "Nearest Speakers" : "All Chatter"]</b></a><br>"
dat += "<b>Deadchat anonymity:</b> <a href='?_src_=prefs;preference=ghost_anonsay'><b>[ghost_anonsay ? "Anonymous" : "Not Anonymous"]</b></a><br>"
dat += "</td><td width='300px' height='300px' valign='top'>"
dat += "<h2>Special Role Settings</h2>"
@@ -1994,6 +1997,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("ghost_radio")
toggles ^= CHAT_GHOSTRADIO
if("ghost_anonsay")
ghost_anonsay = !ghost_anonsay
if("save")
save_preferences(user)
save_character(user)
@@ -15,7 +15,8 @@
show_ghostitem_attack,
lastchangelog,
exp,
windowflashing
windowflashing,
ghost_anonsay
FROM [format_table_name("player")]
WHERE ckey='[C.ckey]'"}
)
@@ -44,6 +45,7 @@
lastchangelog = query.item[13]
exp = query.item[14]
windowflashing = text2num(query.item[15])
ghost_anonsay = text2num(query.item[16])
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
@@ -60,6 +62,7 @@
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
exp = sanitize_text(exp, initial(exp))
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
ghost_anonsay = sanitize_integer(ghost_anonsay, 0, 1, initial(ghost_anonsay))
return 1
/datum/preferences/proc/save_preferences(client/C)
@@ -84,7 +87,8 @@
volume='[volume]',
nanoui_fancy='[nanoui_fancy]',
show_ghostitem_attack='[show_ghostitem_attack]',
lastchangelog='[lastchangelog]'
lastchangelog='[lastchangelog]',
ghost_anonsay='[ghost_anonsay]'
WHERE ckey='[C.ckey]'"}
)