Upgrades SDQL2 and refactors it to a datum (#5793)

* SDQL2
This commit is contained in:
kevinz000
2019-01-09 18:12:12 -08:00
committed by Atermonera
parent d11f189915
commit ae64d73972
36 changed files with 2103 additions and 1599 deletions

View File

@@ -286,7 +286,7 @@ proc/admin_notice(var/message, var/rights)
dat += "<body>"
var/p_age = "unknown"
for(var/client/C in clients)
for(var/client/C in GLOB.clients)
if(C.ckey == key)
p_age = C.player_age
break
@@ -727,28 +727,28 @@ proc/admin_notice(var/message, var/rights)
//Split on pipe or \n
decomposed = splittext(message,regex("\\||$","m"))
decomposed += "0" //Tack on a final 0 sleep to make 3-per-message evenly
//Time to find how they screwed up.
//Wasn't the right length
if((decomposed.len) % 3) //+1 to accomidate the lack of a wait time for the last message
to_chat(usr,"<span class='warning'>You passed [decomposed.len] segments (senders+messages+pauses). You must pass a multiple of 3, minus 1 (no pause after the last message). That means a sender and message on every other line (starting on the first), separated by a pipe character (|), and a number every other line that is a pause in seconds.</span>")
return
//Too long a conversation
if((decomposed.len / 3) > 20)
to_chat(usr,"<span class='warning'>This conversation is too long! 20 messages maximum, please.</span>")
return
//Missed some sleeps, or sanitized to nothing.
for(var/i = 1; i < decomposed.len; i++)
//Sanitize sender
var/clean_sender = sanitize(decomposed[i])
if(!clean_sender)
to_chat(usr,"<span class='warning'>One part of your conversation was not able to be sanitized. It was the sender of the [(i+2)/3]\th message.</span>")
return
decomposed[i] = clean_sender
//Sanitize message
var/clean_message = sanitize(decomposed[++i])
if(!clean_message)