TG: - pAI names now have a character limit and are sanitized

- Removed duplicate drink checks
Revision: r3446
Author: 	 johnsonmt88
This commit is contained in:
Ren Erthilo
2012-05-03 02:28:43 +01:00
parent 39f6da4c59
commit 28df960bf1
2 changed files with 26 additions and 13 deletions

View File

@@ -3350,14 +3350,6 @@
icon_state = "cubalibreglass"
name = "Cuba Libre"
desc = "A classic mix of rum and cola."
if("irishcream")
icon_state = "irishcreamglass"
name = "Irish Cream"
desc = "It's cream, mixed with whiskey. What else would you expect from the Irish?"
if("cubalibre")
icon_state = "cubalibreglass"
name = "Cuba Libre"
desc = "A classic mix of rum and cola."
if("b52")
icon_state = "b52glass"
name = "B-52"

View File

@@ -11,6 +11,8 @@ var/datum/paiController/paiController // Global handler for pAI candidates
comments
ready = 0
/datum/paiController
var/list/pai_candidates = list()
var/list/asked = list()
@@ -42,20 +44,39 @@ var/datum/paiController/paiController // Global handler for pAI candidates
if(href_list["new"])
var/datum/paiCandidate/candidate = locate(href_list["candidate"])
var/option = href_list["option"]
var/t = ""
var/maxNameLen = 26
switch(option)
if("name")
candidate.name = input("Enter a name for your pAI", "pAI Name", candidate.name) as text
t = input("Enter a name for your pAI", "pAI Name", candidate.name) as text
if(t)
candidate.name = copytext(sanitize(t),1,maxNameLen)
if("desc")
candidate.description = input("Enter a description for your pAI", "pAI Description", candidate.description) as message
t = input("Enter a description for your pAI", "pAI Description", candidate.description) as message
if(t)
candidate.description = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
if("role")
candidate.role = input("Enter a role for your pAI", "pAI Role", candidate.role) as text
t = input("Enter a role for your pAI", "pAI Role", candidate.role) as text
if(t)
candidate.role = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
if("ooc")
candidate.comments = input("Enter any OOC comments", "pAI OOC Comments", candidate.comments) as message
t = input("Enter any OOC comments", "pAI OOC Comments", candidate.comments) as message
if(t)
candidate.comments = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
if("save")
candidate.savefile_save(usr)
if("load")
candidate.savefile_load(usr)
//In case people have saved unsanitized stuff.
if(candidate.name)
candidate.name = copytext(sanitize(candidate.name),1,maxNameLen)
if(candidate.description)
candidate.description = copytext(sanitize(candidate.description),1,MAX_MESSAGE_LEN)
if(candidate.role)
candidate.role = copytext(sanitize(candidate.role),1,MAX_MESSAGE_LEN)
if(candidate.comments)
candidate.comments = copytext(sanitize(candidate.comments),1,MAX_MESSAGE_LEN)
if("submit")
if(candidate)