[s] Reworks the sanitize_ooccolor proc (#54221)

* Reworks the sanitize_ooccolor proc

* regex

* cleanup

* grammer is herd
This commit is contained in:
Rohesie
2020-10-08 23:23:13 +08:00
committed by GitHub
parent ec2d1a6fb4
commit 5beb871aea
3 changed files with 38 additions and 14 deletions
+2 -2
View File
@@ -1495,12 +1495,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("ooccolor")
var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference",ooccolor) as color|null
if(new_ooccolor)
ooccolor = new_ooccolor
ooccolor = sanitize_ooccolor(new_ooccolor)
if("asaycolor")
var/new_asaycolor = input(user, "Choose your ASAY color:", "Game Preference",asaycolor) as color|null
if(new_asaycolor)
asaycolor = new_asaycolor
asaycolor = sanitize_ooccolor(new_asaycolor)
if("bag")
var/new_backpack = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in GLOB.backpacklist
+33 -6
View File
@@ -104,18 +104,43 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
else
GLOB.dooc_allowed = !GLOB.dooc_allowed
/client/proc/set_ooc(newColor as color)
/client/proc/set_ooc()
set name = "Set Player OOC Color"
set desc = "Modifies player OOC Color"
set category = "Server"
GLOB.OOC_COLOR = sanitize_ooccolor(newColor)
if(IsAdminAdvancedProcCall())
return
var/newColor = input(src, "Please select the new player OOC color.", "OOC color") as color|null
if(isnull(newColor))
return
if(!check_rights(R_FUN))
message_admins("[usr.key] has attempted to use the Set Player OOC Color verb!")
log_admin("[key_name(usr)] tried to set player ooc color without authorization.")
return
var/new_color = sanitize_ooccolor(newColor)
message_admins("[key_name_admin(usr)] has set the players' ooc color to [new_color].")
log_admin("[key_name_admin(usr)] has set the player ooc color to [new_color].")
GLOB.OOC_COLOR = new_color
/client/proc/reset_ooc()
set name = "Reset Player OOC Color"
set desc = "Returns player OOC Color to default"
set category = "Server"
if(IsAdminAdvancedProcCall())
return
if(alert(usr, "Are you sure you want to reset the OOC color of all players?", "Reset Player OOC Color", "Yes", "No") != "Yes")
return
if(!check_rights(R_FUN))
message_admins("[usr.key] has attempted to use the Reset Player OOC Color verb!")
log_admin("[key_name(usr)] tried to reset player ooc color without authorization.")
return
message_admins("[key_name_admin(usr)] has reset the players' ooc color.")
log_admin("[key_name_admin(usr)] has reset player ooc color.")
GLOB.OOC_COLOR = null
/client/verb/colorooc()
set name = "Set Your OOC Color"
set category = "Preferences"
@@ -125,11 +150,13 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
return
var/new_ooccolor = input(src, "Please select your OOC color.", "OOC color", prefs.ooccolor) as color|null
if(new_ooccolor)
prefs.ooccolor = sanitize_ooccolor(new_ooccolor)
prefs.save_preferences()
if(isnull(new_ooccolor))
return
new_ooccolor = sanitize_ooccolor(new_ooccolor)
prefs.ooccolor = new_ooccolor
prefs.save_preferences()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Set OOC Color") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
/client/verb/resetcolorooc()
set name = "Reset Your OOC Color"