Merge pull request #10813 from Ghommie/Ghommie-cit540

Unicode support updates from tgstation.
This commit is contained in:
kevinz000
2020-02-02 01:47:24 -07:00
committed by GitHub
143 changed files with 891 additions and 903 deletions
+3 -3
View File
@@ -135,10 +135,10 @@ GLOBAL_PROTECT(protected_ranks)
var/previous_rights = 0
//load text from file and process each line separately
for(var/line in world.file2list("[global.config.directory]/admin_ranks.txt"))
if(!line || findtextEx(line,"#",1,2))
if(!line || findtextEx_char(line,"#",1,2))
continue
var/next = findtext(line, "=")
var/datum/admin_rank/R = new(ckeyEx(copytext(line, 1, next)))
var/datum/admin_rank/R = new(ckeyEx(copytext(line, 1, line[next])))
if(!R)
continue
GLOB.admin_ranks += R
@@ -146,7 +146,7 @@ GLOBAL_PROTECT(protected_ranks)
var/prev = findchar(line, "+-*", next, 0)
while(prev)
next = findchar(line, "+-*", prev + 1, 0)
R.process_keyword(copytext(line, prev, next), previous_rights)
R.process_keyword(copytext_char(line, prev, next), previous_rights)
prev = next
previous_rights = R.rights
if(!CONFIG_GET(flag/admin_legacy_system) || dbfail)
+3 -5
View File
@@ -448,11 +448,9 @@ GLOBAL_PROTECT(admin_verbs_hideable)
mob.name = initial(mob.name)
mob.mouse_opacity = initial(mob.mouse_opacity)
else
var/new_key = ckeyEx(input("Enter your desired display name.", "Fake Key", key) as text|null)
var/new_key = ckeyEx(stripped_input(usr, "Enter your desired display name.", "Fake Key", key, 26))
if(!new_key)
return
if(length(new_key) >= 26)
new_key = copytext(new_key, 1, 26)
holder.fakekey = new_key
createStealthKey()
if(isobserver(mob))
@@ -559,9 +557,9 @@ GLOBAL_PROTECT(admin_verbs_hideable)
set desc = "Gives a spell to a mob."
var/list/spell_list = list()
var/type_length = length("/obj/effect/proc_holder/spell") + 2
var/type_length = length_char("/obj/effect/proc_holder/spell") + 2
for(var/A in GLOB.spells)
spell_list[copytext("[A]", type_length)] = A
spell_list[copytext_char("[A]", type_length)] = A
var/obj/effect/proc_holder/spell/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spell_list
if(!S)
return
+2 -2
View File
@@ -149,10 +149,10 @@
else
var/timeleft = SSshuttle.emergency.timeLeft()
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
dat += "ETA: <a href='?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
dat += "ETA: <a href='?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_leading(num2text(timeleft % 60), 2, "0")]</a><BR>"
dat += "<a href='?_src_=holder;[HrefToken()];call_shuttle=2'>Send Back</a><br>"
else
dat += "ETA: <a href='?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
dat += "ETA: <a href='?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_leading(num2text(timeleft % 60), 2, "0")]</a><BR>"
dat += "<B>Continuous Round Status</B><BR>"
dat += "<a href='?_src_=holder;[HrefToken()];toggle_continuous=1'>[CONFIG_GET(keyed_list/continuous)[SSticker.mode.config_tag] ? "Continue if antagonists die" : "End on antagonist death"]</a>"
if(CONFIG_GET(keyed_list/continuous)[SSticker.mode.config_tag])
+1 -1
View File
@@ -345,7 +345,7 @@
if(!SSticker.HasRoundStarted())
alert("The game hasn't started yet!")
return
var/objective = copytext(sanitize(input("Enter an objective")),1,MAX_MESSAGE_LEN)
var/objective = stripped_input(usr, "Enter an objective")
if(!objective)
return
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Traitor All", "[objective]"))
+3 -11
View File
@@ -2469,8 +2469,6 @@
if(!check_rights(R_ADMIN))
return
src.admincaster_feed_channel.channel_name = stripped_input(usr, "Provide a Feed Channel Name.", "Network Channel Handler", "")
while (findtext(src.admincaster_feed_channel.channel_name," ") == 1)
src.admincaster_feed_channel.channel_name = copytext(src.admincaster_feed_channel.channel_name,2,length(src.admincaster_feed_channel.channel_name)+1)
src.access_news_network()
else if(href_list["ac_set_channel_lock"])
@@ -2510,9 +2508,7 @@
else if(href_list["ac_set_new_message"])
if(!check_rights(R_ADMIN))
return
src.admincaster_feed_message.body = adminscrub(input(usr, "Write your Feed story.", "Network Channel Handler", ""))
while (findtext(src.admincaster_feed_message.returnBody(-1)," ") == 1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.returnBody(-1),2,length(src.admincaster_feed_message.returnBody(-1))+1)
src.admincaster_feed_message.body = adminscrub(stripped_input(usr, "Write your Feed story.", "Network Channel Handler", ""))
src.access_news_network()
else if(href_list["ac_submit_new_message"])
@@ -2571,17 +2567,13 @@
else if(href_list["ac_set_wanted_name"])
if(!check_rights(R_ADMIN))
return
src.admincaster_wanted_message.criminal = adminscrub(input(usr, "Provide the name of the Wanted person.", "Network Security Handler", ""))
while(findtext(src.admincaster_wanted_message.criminal," ") == 1)
src.admincaster_wanted_message.criminal = copytext(admincaster_wanted_message.criminal,2,length(admincaster_wanted_message.criminal)+1)
src.admincaster_wanted_message.criminal = adminscrub(stripped_input(usr, "Provide the name of the Wanted person.", "Network Security Handler", ""))
src.access_news_network()
else if(href_list["ac_set_wanted_desc"])
if(!check_rights(R_ADMIN))
return
src.admincaster_wanted_message.body = adminscrub(input(usr, "Provide the a description of the Wanted person and any other details you deem important.", "Network Security Handler", ""))
while (findtext(src.admincaster_wanted_message.body," ") == 1)
src.admincaster_wanted_message.body = copytext(src.admincaster_wanted_message.body,2,length(src.admincaster_wanted_message.body)+1)
src.admincaster_wanted_message.body = adminscrub(stripped_input(usr, "Provide the a description of the Wanted person and any other details you deem important.", "Network Security Handler", ""))
src.access_news_network()
else if(href_list["ac_submit_wanted"])
+16 -15
View File
@@ -869,8 +869,8 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
else if(ispath(expression[i]))
val = expression[i]
else if(copytext(expression[i], 1, 2) in list("'", "\""))
val = copytext(expression[i], 2, length(expression[i]))
else if(expression[i][1] in list("'", "\""))
val = copytext_char(expression[i], 2, -1)
else if(expression[i] == "\[")
var/list/expressions_list = expression[++i]
@@ -961,11 +961,11 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
if(is_proper_datum(object))
D = object
if (object == world && (!long || expression[start + 1] == ".") && !(expression[start] in exclude))
if (object == world && (!long || expression[start + 1] == ".") && !(expression[start] in exclude)) //3 == length("SS") + 1
to_chat(usr, "<span class='danger'>World variables are not allowed to be accessed. Use global.</span>")
return null
else if(expression [start] == "{" && long)
else if(expression [start] == "{" && long) //3 == length("0x") + 1
if(lowertext(copytext(expression[start + 1], 1, 3)) != "0x")
to_chat(usr, "<span class='danger'>Invalid pointer syntax: [expression[start + 1]]</span>")
return null
@@ -1070,9 +1070,10 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
var/word = ""
var/list/query_list = list()
var/len = length(query_text)
var/char = ""
for(var/i = 1, i <= len, i++)
var/char = copytext(query_text, i, i + 1)
for(var/i = 1, i <= len, i += length(char))
char = query_text[i]
if(char in whitespace)
if(word != "")
@@ -1091,7 +1092,7 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
query_list += word
word = ""
var/char2 = copytext(query_text, i + 1, i + 2)
var/char2 = query_text[i + length(char)]
if(char2 in multi[char])
query_list += "[char][char2]"
@@ -1107,13 +1108,13 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
word = "'"
for(i++, i <= len, i++)
char = copytext(query_text, i, i + 1)
for(i += length(char), i <= len, i += length(char))
char = query_text[i]
if(char == "'")
if(copytext(query_text, i + 1, i + 2) == "'")
if(query_text[i + length(char)] == "'")
word += "'"
i++
i += length(query_text[i + length(char)])
else
break
@@ -1135,13 +1136,13 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null
word = "\""
for(i++, i <= len, i++)
char = copytext(query_text, i, i + 1)
for(i += length(char), i <= len, i += length(char))
char = query_text[i]
if(char == "\"")
if(copytext(query_text, i + 1, i + 2) == "'")
if(query_text[i + length(char)] == "'")
word += "\""
i++
i += length(query_text[i + length(char)])
else
break
@@ -256,7 +256,7 @@
node += "*"
i++
else if (copytext(token(i), 1, 2) == "/")
else if(token(i)[1] == "/")
i = object_type(i, node)
else
@@ -377,7 +377,7 @@
//object_type: <type path>
/datum/SDQL_parser/proc/object_type(i, list/node)
if (copytext(token(i), 1, 2) != "/")
if(token(i)[1] != "/")
return parse_error("Expected type, but it didn't begin with /")
var/path = text2path(token(i))
@@ -416,7 +416,7 @@
//string: ''' <some text> ''' | '"' <some text > '"'
/datum/SDQL_parser/proc/string(i, list/node)
if(copytext(token(i), 1, 2) in list("'", "\""))
if(token(i)[1] in list("'", "\""))
node += token(i)
else
@@ -427,7 +427,7 @@
//array: '[' expression, expression, ... ']'
/datum/SDQL_parser/proc/array(var/i, var/list/node)
// Arrays get turned into this: list("[", list(exp_1a = exp_1b, ...), ...), "[" is to mark the next node as an array.
if(copytext(token(i), 1, 2) != "\[")
if(token(i)[1] != "\[")
parse_error("Expected an array but found '[token(i)]'")
return i + 1
@@ -613,7 +613,7 @@
node += "null"
i++
else if(lowertext(copytext(token(i), 1, 3)) == "0x" && isnum(hex2num(copytext(token(i), 3))))
else if(lowertext(copytext(token(i), 1, 3)) == "0x" && isnum(hex2num(copytext(token(i), 3))))//3 == length("0x") + 1
node += hex2num(copytext(token(i), 3))
i++
@@ -621,12 +621,12 @@
node += text2num(token(i))
i++
else if(copytext(token(i), 1, 2) in list("'", "\""))
else if(token(i)[1] in list("'", "\""))
i = string(i, node)
else if(copytext(token(i), 1, 2) == "\[") // Start a list.
else if(token(i)[1] == "\[") // Start a list.
i = array(i, node)
else if(copytext(token(i), 1, 2) == "/")
else if(token(i)[1] == "/")
i = object_type(i, node)
else
i = variable(i, node)
+1 -1
View File
@@ -165,7 +165,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
//is_bwoink is TRUE if this ticket was started by an admin PM
/datum/admin_help/New(msg, client/C, is_bwoink)
//clean the input msg
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
msg = sanitize(copytext_char(msg,1,MAX_MESSAGE_LEN))
if(!msg || !C || !C.mob)
qdel(src)
return
+4 -4
View File
@@ -41,7 +41,7 @@
return
var/client/C
if(istext(whom))
if(cmptext(copytext(whom,1,2),"@"))
if(whom[1] == "@")
whom = findStealthKey(whom)
C = GLOB.directory[whom]
else if(istype(whom, /client))
@@ -76,7 +76,7 @@
var/client/recipient
var/irc = 0
if(istext(whom))
if(cmptext(copytext(whom,1,2),"@"))
if(whom[1] == "@")
whom = findStealthKey(whom)
if(whom == "IRCKEY")
irc = 1
@@ -133,7 +133,7 @@
//clean the message if it's not sent by a high-rank admin
if(!check_rights(R_SERVER|R_DEBUG,0)||irc)//no sending html to the poor bots
msg = trim(sanitize(copytext(msg,1,MAX_MESSAGE_LEN)))
msg = trim(sanitize(msg), MAX_MESSAGE_LEN)
if(!msg)
return
@@ -287,7 +287,7 @@
if(!stealthkey)
stealthkey = GenIrcStealthKey()
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
if(!msg)
return "Error: No message"
+1 -1
View File
@@ -5,7 +5,7 @@
if(!check_rights(0))
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg)
return
msg = emoji_parse(msg)
+1 -1
View File
@@ -14,7 +14,7 @@
if (src.handle_spam_prevention(msg,MUTE_DEADCHAT))
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
mob.log_talk(msg, LOG_DSAY)
if (!msg)
@@ -33,7 +33,7 @@
var/map = input(src, "Choose a Map Template to upload to template storage","Upload Map Template") as null|file
if(!map)
return
if(copytext("[map]",-4) != ".dmm")
if(copytext("[map]", -4) != ".dmm")//4 == length(".dmm")
to_chat(src, "<span class='warning'>Filename must end in '.dmm': [map]</span>")
return
var/datum/map_template/M
+3 -3
View File
@@ -307,9 +307,9 @@ GLOBAL_PROTECT(VVpixelmovement)
// the type with the base type removed from the begaining
var/fancytype = types[D.type]
if (findtext(fancytype, types[type]))
fancytype = copytext(fancytype, length(types[type])+1)
var/shorttype = copytext("[D.type]", length("[type]")+1)
if (length(shorttype) > length(fancytype))
fancytype = copytext(fancytype, length(types[type]) + 1)
var/shorttype = copytext("[D.type]", length("[type]") + 1)
if (length_char(shorttype) > length_char(fancytype))
shorttype = fancytype
if (!length(shorttype))
shorttype = "/"
+4 -4
View File
@@ -6,7 +6,7 @@
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg)
return
log_prayer("[src.key]/([src.name]): [msg]")
@@ -54,21 +54,21 @@
//log_admin("HELP: [key_name(src)]: [msg]")
/proc/CentCom_announce(text , mob/Sender)
var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=orange>CENTCOM:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_CENTCOM_REPLY(Sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
C.overrideCooldown()
/proc/Syndicate_announce(text , mob/Sender)
var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=crimson>SYNDICATE:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_SYNDICATE_REPLY(Sender)]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
C.overrideCooldown()
/proc/Nuke_request(text , mob/Sender)
var/msg = copytext(sanitize(text), 1, MAX_MESSAGE_LEN)
var/msg = copytext_char(sanitize(text), 1, MAX_MESSAGE_LEN)
msg = "<span class='adminnotice'><b><font color=orange>NUKE CODE REQUEST:</font>[ADMIN_FULLMONTY(Sender)] [ADMIN_CENTCOM_REPLY(Sender)] [ADMIN_SET_SD_CODE]:</b> [msg]</span>"
to_chat(GLOB.admins, msg)
for(var/obj/machinery/computer/communications/C in GLOB.machines)
@@ -210,7 +210,7 @@ GLOBAL_LIST_EMPTY(antagonists)
return
/datum/antagonist/proc/edit_memory(mob/user)
var/new_memo = copytext(trim(input(user,"Write new memory", "Memory", antag_memory) as null|message),1,MAX_MESSAGE_LEN)
var/new_memo = stripped_multiline_input(user, "Write new memory", "Memory", antag_memory, MAX_MESSAGE_LEN)
if (isnull(new_memo))
return
antag_memory = new_memo
@@ -203,7 +203,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
/mob/camera/blob/proc/blob_talk(message)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if (!message)
return
@@ -283,8 +283,8 @@
streak = ""
restraining = 0
streak = streak+element
if(length(streak) > max_streak_length)
streak = copytext(streak,2)
if(length_char(streak) > max_streak_length)
streak = streak[1]
return
@@ -83,7 +83,7 @@
return
if(client.handle_spam_prevention(message,MUTE_IC))
return
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if(!message)
return
src.log_talk(message, LOG_SAY, tag="clockwork eminence")
+1 -1
View File
@@ -109,7 +109,7 @@
var/wizard_name_second = pick(GLOB.wizard_second)
var/randomname = "[wizard_name_first] [wizard_name_second]"
var/mob/living/wiz_mob = owner.current
var/newname = copytext(sanitize(input(wiz_mob, "You are the [name]. Would you like to change your name to something else?", "Name change", randomname) as null|text),1,MAX_NAME_LEN)
var/newname = reject_bad_name(stripped_input(wiz_mob, "You are the [name]. Would you like to change your name to something else?", "Name change", randomname, MAX_NAME_LEN))
if (!newname)
newname = randomname
+1 -1
View File
@@ -43,7 +43,7 @@ GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.con
t = trim(t)
if (length(t) == 0)
continue
else if (copytext(t, 1, 2) == "#")
else if (t[1] == "#")
continue
var/pos = findtext(t, " ")
+1 -1
View File
@@ -411,7 +411,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
winset(src, "[child]", "[entries[child]]")
if (!ispath(child, /datum/verbs/menu))
var/procpath/verbpath = child
if (copytext(verbpath.name,1,2) != "@")
if (verbpath.name[1] != "@")
new child(src)
for (var/thing in prefs.menuoptions)
+6 -6
View File
@@ -199,7 +199,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/auto_fit_viewport = TRUE
var/uplink_spawn_loc = UPLINK_PDA
var/sprint_spacebar = FALSE
var/sprint_toggle = FALSE
@@ -1476,9 +1476,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
age = max(min( round(text2num(new_age)), AGE_MAX),AGE_MIN)
if("flavor_text")
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(features["flavor_text"]), MAX_MESSAGE_LEN*2, TRUE)
if(!isnull(msg))
msg = copytext(msg, 1, MAX_MESSAGE_LEN*2)
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(features["flavor_text"]), MAX_MESSAGE_LEN, TRUE)
if(msg)
msg = msg
features["flavor_text"] = msg
if("hair")
@@ -2230,7 +2230,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("never_hypno")
cit_toggles ^= NEVER_HYPNO
if("aphro")
cit_toggles ^= NO_APHRO
@@ -2239,7 +2239,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("bimbo")
cit_toggles ^= BIMBOFICATION
//END CITADEL EDIT
if("ambientocclusion")
+1 -1
View File
@@ -118,7 +118,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey)
return
path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/[filename]"
path = "data/player_saves/[ckey[1]]/[ckey]/[filename]"
/datum/preferences/proc/load_preferences()
if(!path)
+1 -1
View File
@@ -31,7 +31,7 @@ GLOBAL_VAR_INIT(normal_aooc_colour, "#ce254f")
if(QDELETED(src))
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
var/raw_msg = msg
if(!msg)
+1 -1
View File
@@ -13,7 +13,7 @@ GLOBAL_VAR_INIT(normal_looc_colour, "#6699CC")
if(!mob)
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg)
return
+2 -2
View File
@@ -28,7 +28,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(QDELETED(src))
return
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
var/raw_msg = msg
if(!msg)
@@ -36,7 +36,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
msg = emoji_parse(msg)
if((copytext(msg, 1, 2) in list(".",";",":","#")) || (findtext(lowertext(copytext(msg, 1, 5)), "say")))
if((msg[1] in list(".",";",":","#")) || findtext_char(msg, "say", 1, 5))
if(alert("Your message \"[raw_msg]\" looks like it was meant for in game communication, say it in OOC?", "Meant for OOC?", "No", "Yes") != "Yes")
return
+1 -1
View File
@@ -189,7 +189,7 @@
var/tagname = null
/obj/item/clothing/neck/petcollar/attack_self(mob/user)
tagname = copytext(sanitize(input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot") as null|text),1,MAX_NAME_LEN)
tagname = stripped_input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot", MAX_NAME_LEN)
name = "[initial(name)] - [tagname]"
/obj/item/clothing/neck/petcollar/worn_overlays(isinhands, icon_file, style_flags = NONE)
+7 -7
View File
@@ -12,14 +12,14 @@
parsed += copytext(text, pos, search)
if(search)
pos = search
search = findtext(text, ":", pos+1)
search = findtext(text, ":", pos + length(text[pos]))
if(search)
emoji = lowertext(copytext(text, pos+1, search))
emoji = lowertext(copytext(text, pos + length(text[pos]), search))
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/goonchat)
var/tag = sheet.icon_tag("emoji-[emoji]")
if(tag)
parsed += tag
pos = search + 1
pos = search + length(text[pos])
else
parsed += copytext(text, pos, search)
pos = search
@@ -42,12 +42,12 @@
search = findtext(text, ":", pos)
if(search)
pos = search
search = findtext(text, ":", pos+1)
search = findtext(text, ":", pos + length(text[pos]))
if(search)
var/word = lowertext(copytext(text, pos+1, search))
var/word = lowertext(copytext(text, pos + length(text[pos]), search))
if(word in emojis)
final += lowertext(copytext(text, pos, search+1))
pos = search + 1
final += lowertext(copytext(text, pos, search + length(text[search])))
pos = search + length(text[search])
continue
break
return final
+2 -2
View File
@@ -12,7 +12,7 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0)
return ..()
//this is snowflake because of a byond bug (ID:2306577), do not attempt to call non-builtin procs in this if
if(copytext(E.name,1,32) == "Maximum recursion level reached")
if(copytext(E.name, 1, 32) == "Maximum recursion level reached")//32 == length() of that string + 1
//log to world while intentionally triggering the byond bug.
log_world("runtime error: [E.name]\n[E.desc]")
//if we got to here without silently ending, the byond bug has been fixed.
@@ -102,7 +102,7 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0)
usrinfo = null
continue // Our usr info is better, replace it
if(copytext(line, 1, 3) != " ")
if(copytext(line, 1, 3) != " ")//3 == length(" ") + 1
desclines += (" " + line) // Pad any unpadded lines, so they look pretty
else
desclines += line
+2 -2
View File
@@ -61,8 +61,8 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("tmp/iconCache.sav")) //Cache of ico
// Arguments are in the form "param[paramname]=thing"
var/list/params = list()
for(var/key in href_list)
if(length(key) > 7 && findtext(key, "param")) // 7 is the amount of characters in the basic param key template.
var/param_name = copytext(key, 7, -1)
if(length_char(key) > 7 && findtext(key, "param")) // 7 is the amount of characters in the basic param key template.
var/param_name = copytext_char(key, 7, -1)
var/item = href_list[key]
params[param_name] = item
+2 -2
View File
@@ -23,8 +23,8 @@
// Returns special prefixes for the station name on certain days. You wind up with names like "Christmas Object Epsilon". See new_station_name()
/datum/holiday/proc/getStationPrefix()
//get the first word of the Holiday and use that
var/i = findtext(name," ",1,0)
return copytext(name,1,i)
var/i = findtext(name," ")
return copytext(name, 1, i)
// Return 1 if this holidy should be celebrated today
/datum/holiday/proc/shouldCelebrate(dd, mm, yy, ww, ddd)
+1 -1
View File
@@ -401,7 +401,7 @@
/obj/machinery/plantgenes/proc/repaint_seed()
if(!seed)
return
if(copytext(seed.name, 1, 13) == "experimental")
if(copytext(seed.name, 1, 13) == "experimental")//13 == length("experimental") + 1
return // Already modded name and icon
seed.name = "experimental " + seed.name
seed.icon_state = "seed-x"
@@ -15,11 +15,11 @@
new_data = uppertext(new_data)
if(length(new_data) != 7) // We can hex if we want to, we can leave your strings behind
return // Cause your strings don't hex and if they don't hex
var/friends = copytext(new_data, 2, 8) // Well they're are no strings of mine
var/friends = copytext_char(new_data, 2, 8) // Well they're are no strings of mine
// I say, we can go where we want to, a place where they will never find
var/safety_dance = 1
while(safety_dance >= 7) // And we can act like we come from out of this world.log
var/hex = copytext(friends, safety_dance, safety_dance+1)
var/hex = copytext_char(friends, safety_dance, safety_dance+1)
if(!(hex in list("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")))
return // Leave the fake one far behind,
safety_dance++
@@ -224,8 +224,8 @@
var/split = min(index+1, length(text))
var/before_text = copytext(text, 1, split)
var/after_text = copytext(text, split, 0)
var/before_text = copytext_char(text, 1, split)
var/after_text = copytext_char(text, split)
set_pin_data(IC_OUTPUT, 1, before_text)
set_pin_data(IC_OUTPUT, 2, after_text)
@@ -331,7 +331,7 @@
var/strin = get_pin_data(IC_INPUT, 1)
var/delimiter = get_pin_data(IC_INPUT, 2)
if(delimiter == null)
set_pin_data(IC_OUTPUT, 1, string2charlist(strin))
set_pin_data(IC_OUTPUT, 1, text2charlist(strin))
else
set_pin_data(IC_OUTPUT, 1, splittext(strin, delimiter))
push_data()
+2 -2
View File
@@ -13,13 +13,13 @@
. = ""
var/list/words = list()
while(length(.) < length(input))
while(length_char(.) < length_char(input))
words += generate_code_phrase(return_list=TRUE)
. = jointext(words, ", ")
. = capitalize(.)
var/input_ending = copytext(input, length(input))
var/input_ending = copytext_char(input, -1)
var/static/list/endings
if(!endings)
+5 -5
View File
@@ -80,11 +80,11 @@
if(lookup)
return lookup
var/input_size = length(input)
var/input_size = length_char(input)
var/scrambled_text = ""
var/capitalize = TRUE
while(length(scrambled_text) < input_size)
while(length_char(scrambled_text) < input_size)
var/next = pick(syllables)
if(capitalize)
next = capitalize(next)
@@ -98,10 +98,10 @@
scrambled_text += " "
scrambled_text = trim(scrambled_text)
var/ending = copytext(scrambled_text, length(scrambled_text))
var/ending = copytext_char(scrambled_text, -1)
if(ending == ".")
scrambled_text = copytext(scrambled_text,1,length(scrambled_text)-1)
var/input_ending = copytext(input, input_size)
scrambled_text = copytext_char(scrambled_text, 1, -2)
var/input_ending = copytext_char(input, -1)
if(input_ending in list("!","?","."))
scrambled_text += input_ending
+3 -3
View File
@@ -387,9 +387,9 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
if(checkoutperiod < 1)
checkoutperiod = 1
if(href_list["editbook"])
buffer_book = copytext(sanitize(input("Enter the book's title:") as text|null),1,MAX_MESSAGE_LEN)
buffer_book = stripped_input(usr, "Enter the book's title:")
if(href_list["editmob"])
buffer_mob = copytext(sanitize(input("Enter the recipient's name:") as text|null),1,MAX_NAME_LEN)
buffer_mob = stripped_input(usr, "Enter the recipient's name:", max_length = MAX_NAME_LEN)
if(href_list["checkout"])
var/datum/borrowbook/b = new /datum/borrowbook
b.bookname = sanitize(buffer_book)
@@ -406,7 +406,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
if(b && istype(b))
inventory.Remove(b)
if(href_list["setauthor"])
var/newauthor = copytext(sanitize(input("Enter the author's name: ") as text|null),1,MAX_MESSAGE_LEN)
var/newauthor = stripped_input(usr, "Enter the author's name: ")
if(newauthor)
scanner.cache.author = newauthor
if(href_list["setcategory"])
+1 -1
View File
@@ -151,7 +151,7 @@
/obj/structure/chisel_message/update_icon()
..()
var/hash = md5(hidden_message)
var/newcolor = copytext(hash, 1, 7)
var/newcolor = copytext_char(hash, 1, 7)
add_atom_colour("#[newcolor]", FIXED_COLOUR_PRIORITY)
light_color = "#[newcolor]"
set_light(1)
+12 -10
View File
@@ -241,7 +241,8 @@
var/variables_start = findtext(full_def, "{")
var/path_text = trim_text(copytext(full_def, 1, variables_start))
var/atom_def = text2path(path_text) //path definition, e.g /obj/foo/bar
old_position = dpos + 1
if(dpos)
old_position = dpos + length(model[dpos])
if(!ispath(atom_def, /atom)) // Skip the item if the path does not exist. Fix your crap, mappers!
if(bad_paths)
@@ -253,7 +254,7 @@
var/list/fields = list()
if(variables_start)//if there's any variable
full_def = copytext(full_def,variables_start+1,length(full_def))//removing the last '}'
full_def = copytext(full_def, variables_start + length(full_def[variables_start]), -length(copytext_char(full_def, -1))) //removing the last '}'
fields = readlist(full_def, ";")
if(fields.len)
if(!trim(fields[fields.len]))
@@ -423,12 +424,13 @@
var/trim_left = trim_text(copytext(text,old_position,(equal_position ? equal_position : position)))
var/left_constant = delimiter == ";" ? trim_left : parse_constant(trim_left)
old_position = position + 1
if(position)
old_position = position + length(text[position])
if(equal_position && !isnum(left_constant))
// Associative var, so do the association.
// Note that numbers cannot be keys - the RHS is dropped if so.
var/trim_right = trim_text(copytext(text,equal_position+1,position))
var/trim_right = trim_text(copytext(text, equal_position + length(text[equal_position]), position))
var/right_constant = parse_constant(trim_right)
.[left_constant] = right_constant
@@ -442,12 +444,12 @@
return num
// string
if(findtext(text,"\"",1,2))
return copytext(text,2,findtext(text,"\"",3,0))
if(text[1] == "\"")
return copytext(text, length(text[1]) + 1, findtext(text, "\"", length(text[1]) + 1))
// list
if(copytext(text,1,6) == "list(")
return readlist(copytext(text,6,length(text)))
if(copytext(text, 1, 6) == "list(")//6 == length("list(") + 1
return readlist(copytext(text, 6, -1))
// typepath
var/path = text2path(text)
@@ -455,8 +457,8 @@
return path
// file
if(copytext(text,1,2) == "'")
return file(copytext(text,2,length(text)))
if(text[1] == "'")
return file(copytext_char(text, 2, -1))
// null
if(text == "null")
+2 -1
View File
@@ -60,8 +60,9 @@
// build_cache will check bad paths for us
var/list/modelCache = build_cache(TRUE, report.bad_paths)
var/static/regex/area_or_turf = regex(@"/(turf|area)/")
for(var/path in report.bad_paths)
if(copytext(path, 1, 7) == "/turf/" || copytext(path, 1, 7) == "/area/")
if(area_or_turf.Find("[path]", 1, 1))
report.loadable = FALSE
// check for tiles with the wrong number of turfs or areas
+31 -21
View File
@@ -157,20 +157,23 @@
var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text
if(user.canUseTopic(src, BE_CLOSE))
var/list/sanitised = list()
var/sanitycheck = 1
for(var/i=1,i<=length(input),i++) //put the guess into a list
sanitised += text2num(copytext(input,i,i+1))
for(var/i=1,i<=(length(input)-1),i++) //compare each digit in the guess to all those following it
for(var/j=(i+1),j<=length(input),j++)
var/sanitycheck = TRUE
var/char = ""
var/length_input = length(input)
for(var/i = 1, i <= length_input, i += length(char)) //put the guess into a list
char = input[i]
sanitised += text2num(char)
for(var/i = 1, i <= length(sanitised) - 1, i++) //compare each digit in the guess to all those following it
for(var/j = i + 1, j <= length(sanitised), j++)
if(sanitised[i] == sanitised[j])
sanitycheck = null //if a digit is repeated, reject the input
if (input == code)
sanitycheck = FALSE //if a digit is repeated, reject the input
if(input == code)
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
locked = FALSE
cut_overlays()
add_overlay("securecrateg")
tamperproof = 0 // set explosion chance to zero, so we dont accidently hit it with a multitool and instantly die
else if (input == null || sanitycheck == null || length(input) != codelen)
else if(!input || !sanitycheck || length(sanitised) != codelen)
to_chat(user, "<span class='notice'>You leave the crate alone.</span>")
else
to_chat(user, "<span class='warning'>A red light flashes.</span>")
@@ -196,20 +199,27 @@
else
to_chat(user, "<span class='notice'>* Anti-Tamper Bomb will activate after [attempts] failed access attempts.</span>")
if(lastattempt != null)
var/list/guess = list()
var/list/answer = list()
var/bulls = 0
var/cows = 0
for(var/i=1,i<=length(lastattempt),i++)
guess += text2num(copytext(lastattempt,i,i+1))
for(var/i=1,i<=length(lastattempt),i++)
answer += text2num(copytext(code,i,i+1))
for(var/i = 1, i < codelen + 1, i++) // Go through list and count matches
if( answer.Find(guess[i],1,codelen+1))
++cows
if( answer[i] == guess[i])
var/bulls = 0 //right position, right number
var/cows = 0 //wrong position but in the puzzle
var/lastattempt_char = ""
var/length_lastattempt = length(lastattempt)
var/lastattempt_it = 1
var/code_char = ""
var/length_code = length(code)
var/code_it = 1
while(lastattempt_it <= length_lastattempt && code_it <= length_code) // Go through list and count matches
lastattempt_char = lastattempt[lastattempt_it]
code_char = code[code_it]
if(lastattempt_char == code_char)
++bulls
--cows
else if(findtext(code, lastattempt_char))
++cows
lastattempt_it += length(lastattempt_char)
code_it += length(code_char)
to_chat(user, "<span class='notice'>Last code attempt, [lastattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>")
return
+1 -1
View File
@@ -230,5 +230,5 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
var/val = round(materials[key]) / MINERAL_MATERIAL_AMOUNT
msg += sep
sep = ", "
msg += "[amount < 0 ? "-" : "+"][val] [copytext(key, 2)]"
msg += "[amount < 0 ? "-" : "+"][val] [copytext(key, length(key[1]) + 1)]"
formatted = msg.Join()
+9 -7
View File
@@ -232,14 +232,16 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/b_val
var/g_val
var/color_format = length(input_color)
if(color_format != length_char(input_color))
return 0
if(color_format == 3)
r_val = hex2num(copytext(input_color, 1, 2))*16
g_val = hex2num(copytext(input_color, 2, 3))*16
b_val = hex2num(copytext(input_color, 3, 0))*16
r_val = hex2num(copytext(input_color, 1, 2)) * 16
g_val = hex2num(copytext(input_color, 2, 3)) * 16
b_val = hex2num(copytext(input_color, 3, 0)) * 16
else if(color_format == 6)
r_val = hex2num(copytext(input_color, 1, 3))
g_val = hex2num(copytext(input_color, 3, 5))
b_val = hex2num(copytext(input_color, 5, 0))
b_val = hex2num(copytext(input_color, 5, 7))
else
return 0 //If the color format is not 3 or 6, you're using an unexpected way to represent a color.
@@ -253,7 +255,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
if(b_val > 255)
b_val = 255
return num2hex(r_val, 2) + num2hex(g_val, 2) + num2hex(b_val, 2)
return copytext(rgb(r_val, g_val, b_val), 2)
/*
Transfer_mind is there to check if mob is being deleted/not going to have a body.
@@ -263,7 +265,7 @@ Works together with spawning an observer, noted above.
/mob/proc/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE, voluntary = FALSE)
penalize = suiciding || penalize // suicide squad.
voluntary_ghosted = voluntary
if(!key || cmptext(copytext(key,1,2),"@") || (SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize) & COMPONENT_BLOCK_GHOSTING))
if(!key || key[1] == "@" || (SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize) & COMPONENT_BLOCK_GHOSTING))
return //mob has no key, is an aghost or some component hijacked.
stop_sound_channel(CHANNEL_HEARTBEAT) //Stop heartbeat sounds because You Are A Ghost Now
var/mob/dead/observer/ghost = new(src) // Transfer safety to observer spawning proc.
@@ -365,7 +367,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!can_reenter_corpse)
to_chat(src, "<span class='warning'>You cannot re-enter your body.</span>")
return
if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients
if(mind.current.key && mind.current.key[1] != "@") //makes sure we don't accidentally kick any clients
to_chat(usr, "<span class='warning'>Another consciousness is in your body...It is resisting you.</span>")
return
client.change_view(CONFIG_GET(string/default_view))
+3 -4
View File
@@ -1,13 +1,12 @@
/mob/dead/observer/say(message, bubble_type, var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if (!message)
return
var/message_mode = get_message_mode(message)
if(client && (message_mode == MODE_ADMIN || message_mode == MODE_DEADMIN))
message = copytext(message, 3)
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = copytext_char(message, 3)
message = trim_left(message)
if(message_mode == MODE_ADMIN)
client.cmd_admin_say(message)
+1 -1
View File
@@ -4,7 +4,7 @@
var/param = message
var/custom_param = findchar(act, " ")
if(custom_param)
param = copytext(act, custom_param + 1, length(act) + 1)
param = copytext(act, custom_param + length(act[custom_param]))
act = copytext(act, 1, custom_param)
var/datum/emote/E
+2 -2
View File
@@ -185,7 +185,7 @@
var/datum/disease/D = thing
blood_data["viruses"] += D.Copy()
blood_data["blood_DNA"] = copytext(dna.unique_enzymes,1,0)
blood_data["blood_DNA"] = dna.unique_enzymes
blood_data["bloodcolor"] = bloodtype_to_color(dna.blood_type)
if(disease_resistances && disease_resistances.len)
blood_data["resistances"] = disease_resistances.Copy()
@@ -204,7 +204,7 @@
if(!suiciding)
blood_data["cloneable"] = 1
blood_data["blood_type"] = copytext(dna.blood_type,1,0)
blood_data["blood_type"] = dna.blood_type
blood_data["gender"] = gender
blood_data["real_name"] = real_name
blood_data["features"] = dna.features
@@ -120,7 +120,8 @@ Des: Removes all infected images from the alien.
/mob/living/carbon/alien/proc/RemoveInfectionImages()
if (client)
for(var/image/I in client.images)
if(dd_hasprefix_case(I.icon_state, "infected"))
var/searchfor = "infected"
if(findtext(I.icon_state, searchfor, 1, length(searchfor) + 1))
qdel(I)
return
@@ -135,5 +135,6 @@ Des: Removes all images from the mob infected by this embryo
for(var/mob/living/carbon/alien/alien in GLOB.player_list)
if(alien.client)
for(var/image/I in alien.client.images)
if(dd_hasprefix_case(I.icon_state, "infected") && I.loc == C)
var/searchfor = "infected"
if(I.loc == owner && findtext(I.icon_state, searchfor, 1, length(searchfor) + 1))
qdel(I)
+9 -17
View File
@@ -87,30 +87,22 @@
/mob/living/carbon/human/proc/forcesay(list/append) //this proc is at the bottom of the file because quote fuckery makes notepad++ cri
if(stat == CONSCIOUS)
if(client)
var/virgin = 1 //has the text been modified yet?
var/temp = winget(client, "input", "text")
if(findtextEx(temp, "Say \"", 1, 7) && length(temp) > 5) //"case sensitive means
var/say_starter = "Say \"" //"
if(findtextEx(temp, say_starter, 1, length(say_starter) + 1) && length(temp) > length(say_starter)) //case sensitive means
temp = replacetext(temp, ";", "") //general radio
temp = trim_left(copytext(temp, length(say_starter + 1)))
temp = replacetext(temp, ";", "", 1, 2) //general radio
while(trim_left(temp)[1] == ":") //dept radio again (necessary)
temp = copytext_char(trim_left(temp), 3)
if(findtext(trim_left(temp), ":", 6, 7)) //dept radio
temp = copytext(trim_left(temp), 8)
virgin = 0
if(virgin)
temp = copytext(trim_left(temp), 6) //normal speech
virgin = 0
while(findtext(trim_left(temp), ":", 1, 2)) //dept radio again (necessary)
temp = copytext(trim_left(temp), 3)
if(findtext(temp, "*", 1, 2)) //emotes
if(temp[1] == "*") //emotes
return
var/trimmed = trim_left(temp)
if(length(trimmed))
if(append)
temp += pick(append)
trimmed += pick(append)
say(temp)
say(trimmed)
winset(client, "input", "text=[null]")
+4 -11
View File
@@ -426,17 +426,10 @@
message = null
/datum/emote/living/custom/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/custom/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -448,7 +441,7 @@
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/custom_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN) //CIT CHANGE - expands emote textbox
var/custom_emote = stripped_multiline_input("Choose an emote to display.", "Custom Emote", null, MAX_MESSAGE_LEN)
if(custom_emote && !check_invalid(user, custom_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)
+12 -14
View File
@@ -89,7 +89,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
var/static/list/one_character_prefix = list(MODE_HEADSET = TRUE, MODE_ROBOT = TRUE, MODE_WHISPER = TRUE)
if(sanitize)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
if(!message || message == "")
return
@@ -99,11 +99,10 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
var/in_critical = InCritical()
if(one_character_prefix[message_mode])
message = copytext(message, 2)
message = copytext_char(message, 2)
else if(message_mode || saymode)
message = copytext(message, 3)
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = copytext_char(message, 3)
message = trim_left(message)
if(message_mode == MODE_ADMIN)
if(client)
@@ -135,11 +134,10 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
// No, you cannot speak in xenocommon just because you know the key
if(can_speak_in_language(message_language))
language = message_language
message = copytext(message, 3)
message = copytext_char(message, 3)
// Trim the space if they said ",0 I LOVE LANGUAGES"
if(findtext(message, " ", 1, 2))
message = copytext(message, 2)
message = trim_left(message)
if(!language)
language = get_default_language()
@@ -167,8 +165,8 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
if(fullcrit)
var/health_diff = round(-HEALTH_THRESHOLD_DEAD + health)
// If we cut our message short, abruptly end it with a-..
var/message_len = length(message)
message = copytext(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]"
var/message_len = length_char(message)
message = copytext_char(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]"
message = Ellipsis(message, 10, 1)
message_mode = MODE_WHISPER_CRIT
succumbed = TRUE
@@ -326,13 +324,13 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
return 1
/mob/living/proc/get_key(message)
var/key = copytext(message, 1, 2)
var/key = message[1]
if(key in GLOB.department_radio_prefixes)
return lowertext(copytext(message, 2, 3))
return lowertext(message[1 + length(key)])
/mob/living/proc/get_message_language(message)
if(copytext(message, 1, 2) == ",")
var/key = copytext(message, 2, 3)
if(message[1] == ",")
var/key = message[1 + length(message[1])]
for(var/ld in GLOB.all_languages)
var/datum/language/LD = ld
if(initial(LD.key) == key)
+2 -1
View File
@@ -26,7 +26,8 @@
..()
/mob/living/silicon/ai/get_message_mode(message)
if(copytext(message, 1, 3) in list(":h", ":H", ".h", ".H", "#h", "#H"))
var/static/regex/holopad_finder = regex(@"[:.#][hH]")
if(holopad_finder.Find(message, 1, 1))
return MODE_HOLOPAD
else
return ..()
@@ -8,7 +8,7 @@
*/
/datum/paiCandidate/proc/savefile_path(mob/user)
return "data/player_saves/[copytext(user.ckey, 1, 2)]/[user.ckey]/pai.sav"
return "data/player_saves/[user.ckey[1]]/[user.ckey]/pai.sav"
/datum/paiCandidate/proc/savefile_save(mob/user)
if(IsGuestKey(user.key))
@@ -208,8 +208,8 @@
ears.forceMove(drop_location())
ears = null
for(var/possible_phrase in speak)
if(copytext(possible_phrase,1,3) in GLOB.department_radio_keys)
possible_phrase = copytext(possible_phrase,3)
if(copytext_char(possible_phrase, 2, 3) in GLOB.department_radio_keys)
possible_phrase = copytext_char(possible_phrase, 3)
//Adding things to inventory
else if(href_list["add_inv"])
@@ -419,8 +419,8 @@
if(prob(50))
useradio = 1
if((copytext(possible_phrase,1,2) in GLOB.department_radio_prefixes) && (copytext(possible_phrase,2,3) in GLOB.department_radio_keys))
possible_phrase = "[useradio?pick(available_channels):""][copytext(possible_phrase,3)]" //crop out the channel prefix
if((possible_phrase[1] in GLOB.department_radio_prefixes) && (copytext_char(possible_phrase, 2, 3) in GLOB.department_radio_keys))
possible_phrase = "[useradio?pick(available_channels):""][copytext_char(possible_phrase, 3)]" //crop out the channel prefix
else
possible_phrase = "[useradio?pick(available_channels):""][possible_phrase]"
@@ -428,8 +428,8 @@
else //If we have no headset or channels to use, dont try to use any!
for(var/possible_phrase in speak)
if((copytext(possible_phrase,1,2) in GLOB.department_radio_prefixes) && (copytext(possible_phrase,2,3) in GLOB.department_radio_keys))
possible_phrase = copytext(possible_phrase,3) //crop out the channel prefix
if((possible_phrase[1] in GLOB.department_radio_prefixes) && (copytext_char(possible_phrase, 2, 3) in GLOB.department_radio_keys))
possible_phrase = copytext_char(possible_phrase, 3) //crop out the channel prefix
newspeak.Add(possible_phrase)
speak = newspeak
+3 -3
View File
@@ -82,7 +82,7 @@
if(!client)
return
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
if(type)
if(type & MSG_VISUAL && eye_blind )//Vision related
@@ -414,7 +414,7 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
set name = "Add Note"
set category = "IC"
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
msg = sanitize(msg)
if(mind)
@@ -513,7 +513,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
if(href_list["flavor2_more"])
usr << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", name, replacetext(flavor_text_2, "\n", "<BR>")), text("window=[];size=500x200", name))
onclose(usr, "[name]")
if(href_list["flavor_change"])
update_flavor_text()
+141 -148
View File
@@ -42,128 +42,131 @@
else
return 0
/proc/stars(n, pr)
n = html_encode(n)
if (pr == null)
pr = 25
if (pr <= 0)
return null
else
if (pr >= 100)
return n
var/te = n
var/t = ""
n = length(n)
var/p = null
p = 1
while(p <= n)
if ((copytext(te, p, p + 1) == " " || prob(pr)))
t = text("[][]", t, copytext(te, p, p + 1))
/**
* Convert random parts of a passed in message to stars
*
* * phrase - the string to convert
* * probability - probability any character gets changed
*
* This proc is dangerously laggy, avoid it or die
*/
/proc/stars(phrase, probability = 25)
if(probability <= 0)
return phrase
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/char = ""
for(var/i = 1, i <= leng, i += length(char))
char = phrase[i]
if(char == " " || !prob(probability))
. += char
else
t = text("[]*", t)
p++
return sanitize(t)
. += "*"
return sanitize(.)
/proc/slur(n,var/strength=50)
strength = min(strength,50)
var/phrase = html_decode(n)
/**
* Makes you speak like you're drunk
*/
/proc/slur(phrase, strength = 50)
strength = min(50, strength)
phrase = html_decode(phrase)
var/leng = length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
newletter=copytext(phrase,(leng-counter)+1,(leng-counter)+2)
if(rand(1,100)<=strength*0.5)
if(lowertext(newletter)=="o")
newletter="u"
if(lowertext(newletter)=="s")
newletter="ch"
if(lowertext(newletter)=="a")
newletter="ah"
if(lowertext(newletter)=="u")
newletter="oo"
if(lowertext(newletter)=="c")
newletter="k"
if(rand(1,100) <= strength*0.25)
if(newletter==" ")
newletter="...huuuhhh..."
if(newletter==".")
newletter=" BURP!"
if(rand(1,100) <= strength*0.5)
if(rand(1,5) == 1)
newletter+="'"
if(rand(1,5) == 1)
newletter+="[newletter]"
if(rand(1,5) == 1)
newletter+="[newletter][newletter]"
newphrase+="[newletter]";counter-=1
return newphrase
/proc/cultslur(n) // Inflicted on victims of a stun talisman
var/phrase = html_decode(n)
var/leng = length(phrase)
var/counter=length(phrase)
var/newphrase=""
var/newletter=""
while(counter>=1)
newletter=copytext(phrase,(leng-counter)+1,(leng-counter)+2)
if(rand(1,2)==2)
if(lowertext(newletter)=="o")
newletter="u"
if(lowertext(newletter)=="t")
newletter="ch"
if(lowertext(newletter)=="a")
newletter="ah"
if(lowertext(newletter)=="u")
newletter="oo"
if(lowertext(newletter)=="c")
newletter=" NAR "
if(lowertext(newletter)=="s")
newletter=" SIE "
if(rand(1,4)==4)
if(newletter==" ")
newletter=" no hope... "
if(newletter=="H")
newletter=" IT COMES... "
switch(rand(1,15))
. = ""
var/newletter = ""
var/rawchar = ""
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(rand(1,100)<=strength * 0.5)
var/lowerletter = lowertext(newletter)
if(lowerletter == "o")
newletter = "u"
else if(lowerletter == "s")
newletter = "ch"
else if(lowerletter == "a")
newletter = "ah"
else if(lowerletter == "u")
newletter = "oo"
else if(lowerletter == "c")
newletter = "k"
if(rand(1,100) <= strength * 0.25)
if(newletter == " ")
newletter = "...huuuhhh..."
else if(newletter == ".")
newletter = " *BURP*."
switch(rand(1,100) <= strength * 0.5)
if(1)
newletter="'"
newletter += "'"
if(10)
newletter += "[newletter]"
if(20)
newletter += "[newletter][newletter]"
. += "[newletter]"
return sanitize(.)
/// Makes you talk like you got cult stunned, which is slurring but with some dark messages
/proc/cultslur(phrase) // Inflicted on victims of a stun talisman
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/newletter = ""
var/rawchar = ""
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(rand(1, 2) == 2)
var/lowerletter = lowertext(newletter)
if(lowerletter == "o")
newletter = "u"
else if(lowerletter == "t")
newletter = "ch"
else if(lowerletter == "a")
newletter = "ah"
else if(lowerletter == "u")
newletter = "oo"
else if(lowerletter == "c")
newletter = " NAR "
else if(lowerletter == "s")
newletter = " SIE "
if(rand(1, 4) == 4)
if(newletter == " ")
newletter = " no hope... "
else if(newletter == "H")
newletter = " IT COMES... "
switch(rand(1, 15))
if(1)
newletter = "'"
if(2)
newletter+="agn"
newletter += "agn"
if(3)
newletter="fth"
newletter = "fth"
if(4)
newletter="nglu"
newletter = "nglu"
if(5)
newletter="glor"
newphrase+="[newletter]";counter-=1
return newphrase
newletter = "glor"
. += newletter
return sanitize(.)
/proc/stutter(n)
var/te = html_decode(n)
var/t = ""//placed before the message. Not really sure what it's for.
n = length(n)//length of the entire word
var/p = null
p = 1//1 is the start of any word
while(p <= n)//while P, which starts at 1 is less or equal to N which is the length.
var/n_letter = copytext(te, p, p + 1)//copies text from a certain distance. In this case, only one letter at a time.
if (prob(80) && (ckey(n_letter) in list("b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z")))
if (prob(10))
n_letter = text("[n_letter]-[n_letter]-[n_letter]-[n_letter]")//replaces the current letter with this instead.
///Adds stuttering to the message passed in
/proc/stutter(phrase)
phrase = html_decode(phrase)
var/leng = length(phrase)
. = ""
var/newletter = ""
var/rawchar
for(var/i = 1, i <= leng, i += length(rawchar))
rawchar = newletter = phrase[i]
if(prob(80) && !(lowertext(newletter) in list("a", "e", "i", "o", "u", " ")))
if(prob(10))
newletter = "[newletter]-[newletter]-[newletter]-[newletter]"
else if(prob(20))
newletter = "[newletter]-[newletter]-[newletter]"
else if (prob(5))
newletter = ""
else
if (prob(20))
n_letter = text("[n_letter]-[n_letter]-[n_letter]")
else
if (prob(5))
n_letter = null
else
n_letter = text("[n_letter]-[n_letter]")
t = text("[t][n_letter]")//since the above is ran through for each letter, the text just adds up back to the original word.
p++//for each letter p is increased to find where the next letter will be.
return copytext(sanitize(t),1,MAX_MESSAGE_LEN)
newletter = "[newletter]-[newletter]"
. += newletter
return sanitize(.)
/proc/derpspeech(message, stuttering)
message = replacetext(message, " am ", " ")
@@ -183,52 +186,42 @@
return message
/proc/Gibberish(t, p)//t is the inputted message, and any value higher than 70 for p will cause letters to be replaced instead of added
/* Turn text into complete gibberish! */
var/returntext = ""
for(var/i = 1, i <= length(t), i++)
var/letter = copytext(t, i, i+1)
if(prob(50))
if(p >= 70)
/proc/Gibberish(text, replace_characters = FALSE, chance = 50)
text = html_decode(text)
. = ""
var/rawchar = ""
var/letter = ""
var/lentext = length(text)
for(var/i = 1, i <= lentext, i += length(rawchar))
rawchar = letter = text[i]
if(prob(chance))
if(replace_characters)
letter = ""
for(var/j in 1 to rand(0, 2))
letter += pick("#", "@", "*", "&", "%", "$", "/", "<", ">", ";", "*", "*", "*", "*", "*", "*", "*")
. += letter
return sanitize(.)
for(var/j = 1, j <= rand(0, 2), j++)
letter += pick("#","@","*","&","%","$","/", "<", ">", ";","*","*","*","*","*","*","*")
returntext += letter
return returntext
/proc/ninjaspeak(n) //NINJACODE
/*
The difference with stutter is that this proc can stutter more than 1 letter
The issue here is that anything that does not have a space is treated as one word (in many instances). For instance, "LOOKING," is a word, including the comma.
It's fairly easy to fix if dealing with single letters but not so much with compounds of letters./N
*/
var/te = html_decode(n)
var/t = ""
n = length(n)
var/p = 1
while(p <= n)
var/n_letter
var/n_mod = rand(1,4)
if(p+n_mod>n+1)
n_letter = copytext(te, p, n+1)
else
n_letter = copytext(te, p, p+n_mod)
/proc/ninjaspeak(phrase) //NINJACODE
. = ""
var/lentext = length_char(phrase)
var/rawchars = ""
var/letter = ""
for(var/i = 1, i <= lentext, i += length_char(rawchars))
var/end = i + rand(1,4)
letter = rawchars = copytext_char(phrase, i, end > lentext ? 0 : end)
if (prob(50))
if (prob(30))
n_letter = text("[n_letter]-[n_letter]-[n_letter]")
letter = "[letter]-[letter]-[letter]"
else
n_letter = text("[n_letter]-[n_letter]")
else
n_letter = text("[n_letter]")
t = text("[t][n_letter]")
p=p+n_mod
return copytext(sanitize(t),1,MAX_MESSAGE_LEN)
letter = "[letter]-[letter]"
. += letter
return copytext_char(sanitize(.),1,MAX_MESSAGE_LEN)
/proc/shake_camera(mob/M, duration, strength=1)
if(!M || !M.client || duration < 1)
+8 -8
View File
@@ -12,7 +12,7 @@
var/customsayverb = findtext(input, "*")
if(customsayverb && message_mode != MODE_WHISPER_CRIT)
message_mode = MODE_CUSTOM_SAY
return lowertext(copytext(input, 1, customsayverb))
return lowertext(copytext_char(input, 1, customsayverb))
else
return ..()
@@ -35,7 +35,7 @@
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
return
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
usr.emote("me",1,message,TRUE)
@@ -83,9 +83,9 @@
deadchat_broadcast(rendered, follow_target = src, speaker_key = key)
/mob/proc/check_emote(message)
if(copytext(message, 1, 2) == "*")
emote(copytext(message, 2), intentional = TRUE)
return 1
if(message[1] == "*")
emote(copytext(message, length(message[1]) + 1), intentional = TRUE)
return TRUE
/mob/proc/hivecheck()
return 0
@@ -94,11 +94,11 @@
return LINGHIVE_NONE
/mob/proc/get_message_mode(message)
var/key = copytext(message, 1, 2)
var/key = message[1]
if(key == "#")
return MODE_WHISPER
else if(key == ";")
return MODE_HEADSET
else if(length(message) > 2 && (key in GLOB.department_radio_prefixes))
var/key_symbol = lowertext(copytext(message, 2, 3))
else if((length(message) > (length(key) + 1)) && (key in GLOB.department_radio_prefixes))
var/key_symbol = lowertext(message[length(key) + 1])
return GLOB.department_radio_keys[key_symbol]
+18 -38
View File
@@ -9,25 +9,19 @@
set src in usr
if(usr != src)
to_chat(usr, "No.")
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(flavor_text), MAX_MESSAGE_LEN*2, TRUE)
var/msg = stripped_multiline_input(usr, "Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!", "Flavor Text", html_decode(flavor_text), MAX_MESSAGE_LEN, TRUE)
if(!isnull(msg))
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
flavor_text = msg
if(msg)
flavor_text = html_encode(msg)
/mob/proc/update_flavor_text_2()
set src in usr
if(usr != src)
to_chat(usr, "No.")
var/msg = stripped_multiline_input(usr, "Set the temporary flavor text in your 'examine' verb. This should be used only for things pertaining to the current round!", "Short-Term Flavor Text", html_decode(flavor_text_2), MAX_MESSAGE_LEN*2, TRUE)
var/msg = stripped_multiline_input(usr, "Set the temporary flavor text in your 'examine' verb. This should be used only for things pertaining to the current round!", "Short-Term Flavor Text", html_decode(flavor_text_2), MAX_MESSAGE_LEN, TRUE)
if(!isnull(msg))
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
flavor_text_2 = msg
if(msg)
flavor_text_2 = html_encode(msg)
/mob/proc/warn_flavor_changed()
@@ -39,19 +33,19 @@
if(flavor_text && flavor_text != "")
// We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown.
var/msg = html_decode(replacetext(flavor_text, "\n", " "))
if(length(msg) <= 40)
if(length_char(msg) <= 40)
return "<span class='notice'>[html_encode(msg)]</span>"
else
return "<span class='notice'>[html_encode(copytext(msg, 1, 37))]... <a href='?src=[REF(src)];flavor_more=1'>More...</span></a>"
return "<span class='notice'>[html_encode(copytext_char(msg, 1, 37))]... <a href='?src=[REF(src)];flavor_more=1'>More...</span></a>"
/mob/proc/print_flavor_text_2()
if(flavor_text && flavor_text != "")
// We are decoding and then encoding to not only get correct amount of characters, but also to prevent partial escaping characters being shown.
var/msg = html_decode(replacetext(flavor_text_2, "\n", " "))
if(length(msg) <= 40)
if(length_char(msg) <= 40)
return "<span class='notice'>[html_encode(msg)]</span>"
else
return "<span class='notice'>[html_encode(copytext(msg, 1, 37))]... <a href='?src=[REF(src)];flavor2_more=1'>More...</span></a>"
return "<span class='notice'>[html_encode(copytext_char(msg, 1, 37))]... <a href='?src=[REF(src)];flavor2_more=1'>More...</span></a>"
/mob/proc/get_top_level_mob()
@@ -80,17 +74,10 @@ proc/get_top_level_mob(var/mob/S)
/datum/emote/living/subtle/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/subtle/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -100,7 +87,7 @@ proc/get_top_level_mob(var/mob/S)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/subtle_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN)
var/subtle_emote = stripped_multiline_input("Choose an emote to display.", "Subtle", null, MAX_MESSAGE_LEN)
if(subtle_emote && !check_invalid(user, subtle_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)
@@ -151,17 +138,10 @@ proc/get_top_level_mob(var/mob/S)
/datum/emote/living/subtler/proc/check_invalid(mob/user, input)
. = TRUE
if(copytext(input,1,5) == "says")
if(stop_bad_mime.Find(input, 1, 1))
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,9) == "exclaims")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,6) == "yells")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else if(copytext(input,1,5) == "asks")
to_chat(user, "<span class='danger'>Invalid emote.</span>")
else
. = FALSE
return TRUE
return FALSE
/datum/emote/living/subtler/run_emote(mob/user, params, type_override = null)
if(jobban_isbanned(user, "emote"))
@@ -171,7 +151,7 @@ proc/get_top_level_mob(var/mob/S)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
var/subtle_emote = copytext(sanitize(input("Choose an emote to display.") as message|null), 1, MAX_MESSAGE_LEN)
var/subtle_emote = stripped_multiline_input(user, "Choose an emote to display.", "Subtler" , null, MAX_MESSAGE_LEN)
if(subtle_emote && !check_invalid(user, subtle_emote))
var/type = input("Is this a visible or hearable emote?") as null|anything in list("Visible", "Hearable")
switch(type)
+3 -3
View File
@@ -42,8 +42,8 @@
// hash the original name?
if(tr_flags & TR_HASHNAME)
O.name = "monkey ([copytext(md5(real_name), 2, 6)])"
O.real_name = "monkey ([copytext(md5(real_name), 2, 6)])"
O.name = "monkey ([copytext_char(md5(real_name), 2, 6)])"
O.real_name = "monkey ([copytext_char(md5(real_name), 2, 6)])"
//handle DNA and other attributes
dna.transfer_identity(O)
@@ -202,7 +202,7 @@
dna.transfer_identity(O)
O.updateappearance(mutcolor_update=1)
if(cmptext("monkey",copytext(O.dna.real_name,1,7)))
if(findtext(O.dna.real_name, "monkey", 1, 7)) //7 == length("monkey") + 1
O.real_name = random_unique_name(O.gender)
O.dna.generate_unique_enzymes(O)
else
+4 -2
View File
@@ -44,9 +44,11 @@
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the cover of [src]!</span>")
return
var/n_name = copytext(sanitize(input(user, "What would you like to label the folder?", "Folder Labelling", null) as text), 1, MAX_NAME_LEN)
var/inputvalue = stripped_input(user, "What would you like to label the folder?", "Folder Labelling", "", MAX_NAME_LEN)
if(!inputvalue)
return
if(user.canUseTopic(src, BE_CLOSE))
name = "folder[(n_name ? " - '[n_name]'" : null)]"
name = "folder - '[inputvalue]'"
/obj/item/folder/attack_self(mob/user)
+1 -1
View File
@@ -70,7 +70,7 @@
if(mode)
to_chat(user, "<span class='notice'>You turn on [src].</span>")
//Now let them chose the text.
var/str = copytext(reject_bad_text(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
var/str = reject_bad_text(stripped_input(user, "Label text?", "Set label","", MAX_NAME_LEN))
if(!str || !length(str))
to_chat(user, "<span class='warning'>Invalid text!</span>")
return
+4 -1
View File
@@ -152,7 +152,10 @@
if(istart == 0)
return //No field found with matching id
laststart = istart+1
if(links)
laststart = istart + length(info_links[istart])
else
laststart = istart + length(info[istart])
locid++
if(locid == id)
var/iend = 1
+3 -3
View File
@@ -111,9 +111,9 @@
if(data.len < 5)
return null
var/timestamp = data[2]
var/year = copytext(timestamp, 1, 5)
var/month = copytext(timestamp, 5, 7)
var/day = copytext(timestamp, 7, 9)
var/year = copytext_char(timestamp, 1, 5)
var/month = copytext_char(timestamp, 5, 7)
var/day = copytext_char(timestamp, 7, 9)
var/round = data[4]
. += "[year]/[month]/[day]/round-[round]"
if("O")
+4 -5
View File
@@ -55,9 +55,8 @@
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on [src]!</span>")
return
var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text)
txt = copytext(txt, 1, 128)
if(user.canUseTopic(src, BE_CLOSE))
var/txt = stripped_input(user, "What would you like to write on the back?", "Photo Writing", "", 128)
if(txt && user.canUseTopic(src, BE_CLOSE))
scribble = txt
..()
@@ -85,8 +84,8 @@
set category = "Object"
set src in usr
var/n_name = copytext(sanitize(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text), 1, MAX_NAME_LEN)
var/n_name = stripped_input(usr, "What would you like to label the photo?", "Photo Labelling", "", MAX_NAME_LEN)
//loc.loc check is for making possible renaming photos in clipboards
if((loc == usr || loc.loc && loc.loc == usr) && usr.stat == CONSCIOUS && usr.canmove && !usr.restrained())
if(n_name && (loc == usr || loc.loc && loc.loc == usr) && usr.stat == CONSCIOUS && usr.canmove && !usr.restrained())
name = "photo[(n_name ? text("- '[n_name]'") : null)]"
add_fingerprint(usr)
+2 -2
View File
@@ -85,8 +85,8 @@ By design, d1 is the smallest direction and d2 is the highest
if(isnull(_d1) || isnull(_d2))
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
var/dash = findtext(icon_state, "-")
d1 = text2num( copytext( icon_state, 1, dash ) )
d2 = text2num( copytext( icon_state, dash+1 ) )
d1 = text2num(copytext(icon_state, 1, dash))
d2 = text2num(copytext(icon_state, dash + length(icon_state[dash])))
else
d1 = _d1
d2 = _d2
+1 -1
View File
@@ -79,7 +79,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
return main_part.attackby(I, user)
/obj/machinery/gravity_generator/part/get_status()
return main_part.get_status()
return main_part?.get_status()
/obj/machinery/gravity_generator/part/attack_hand(mob/user)
return main_part.attack_hand(user)
@@ -30,7 +30,7 @@
/datum/mapGenerator/New()
..()
if(buildmode_name == "Undocumented")
buildmode_name = copytext("[type]", 20) // / d a t u m / m a p g e n e r a t o r / = 20 characters.
buildmode_name = copytext_char("[type]", 20) // / d a t u m / m a p g e n e r a t o r / = 20 characters.
initialiseModules()
//Defines the region the map represents, sets map
+1 -1
View File
@@ -196,7 +196,7 @@
return ""
var/outstring = "|<a href=\"#[R.name]\"><h5 id=\"[R.name]\">!\[[R.color]\](https://placehold.it/15/[copytext(R.color, 2, 8)]/000000?text=+)[R.name]</h5></a> pH: [R.pH] | "
var/outstring = "|<a href=\"#[R.name]\"><h5 id=\"[R.name]\">!\[[R.color]\](https://placehold.it/15/[copytext_char(R.color, 2, 8)]/000000?text=+)[R.name]</h5></a> pH: [R.pH] | "
var/datum/reagent/R3
if(CR)
outstring += "<ul>"
@@ -540,9 +540,13 @@
if(MUTCOLORS in N.dna.species.species_traits) //take current alien color and darken it slightly
var/newcolor = ""
var/len = length(N.dna.features["mcolor"])
for(var/i=1, i<=len, i+=1)
var/ascii = text2ascii(N.dna.features["mcolor"],i)
var/string = N.dna.features["mcolor"]
var/len = length(string)
var/char = ""
var/ascii = 0
for(var/i=1, i<=len, i += length(char))
char = string[i]
ascii = text2ascii(char)
switch(ascii)
if(48)
newcolor += "0"
@@ -553,7 +557,7 @@
if(98 to 102)
newcolor += ascii2text(ascii-1) //letters b to f lowercase
if(65)
newcolor +="9"
newcolor += "9"
if(66 to 70)
newcolor += ascii2text(ascii+31) //letters B to F - translates to lowercase
else
+2 -2
View File
@@ -36,7 +36,7 @@
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
@@ -122,7 +122,7 @@
if(!user.is_literate())
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
return
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!str || !length(str))
@@ -142,7 +142,7 @@
var/new_sentence = stripped_input(user, "Choose the sentence that the host will be forced to say.", "Sentence", sentence, MAX_MESSAGE_LEN)
if(!new_sentence)
return
if(copytext(new_sentence, 1, 2) == "*") //emotes are abusable, like surrender
if(new_sentence[1] == "*") //emotes are abusable, like surrender
return
sentence = new_sentence
if(setting == "Comm Code")
+1 -1
View File
@@ -52,7 +52,7 @@ Nothing else in the console has ID requirements.
research_control = FALSE
/proc/CallMaterialName(ID)
if (copytext(ID, 1, 2) == "$" && GLOB.materials_list[ID])
if (ID[1] == "$" && GLOB.materials_list[ID])
var/datum/material/material = GLOB.materials_list[ID]
return material.name
@@ -134,7 +134,7 @@ Stabilized extracts:
saved_mind = null
START_PROCESSING(SSobj, src)
if(choice == "Familiar Name")
var/newname = copytext(sanitize(input(user, "Would you like to change the name of [mob_name]", "Name change", mob_name) as null|text),1,MAX_NAME_LEN)
var/newname = reject_bad_name(stripped_input(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN), TRUE)
if(newname)
mob_name = newname
to_chat(user, "<span class='notice'>You speak softly into [src], and it shakes slightly in response.</span>")
@@ -486,7 +486,7 @@
if(!(upgradetier & XENOBIO_UPGRADE_MONKEYS)) // CIT CHANGE - makes monkey-related actions require XENOBIO_UPGRADE_MONKEYS
to_chat(user, "<span class='warning'>This console does not have the monkey upgrade.</span>")
return
if(!GLOB.cameranet.checkTurfVis(M.loc))
if(!isturf(M.loc) || !GLOB.cameranet.checkTurfVis(M.loc))
to_chat(user, "<span class='warning'>Target is not near a camera. Cannot proceed.</span>")
return
var/mob/living/C = user
@@ -644,7 +644,7 @@
M.nutrition = 700
to_chat(M, "<span class='warning'>You absorb the potion and feel your intense desire to feed melt away.</span>")
to_chat(user, "<span class='notice'>You feed the slime the potion, removing its hunger and calming it.</span>")
var/newname = copytext(sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text),1,MAX_NAME_LEN)
var/newname = reject_bad_name(stripped_input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime", MAX_NAME_LEN), TRUE)
if (!newname)
newname = "pet slime"
+1 -1
View File
@@ -660,7 +660,7 @@
if(timeleft > 1 HOURS)
return "--:--"
else if(timeleft > 0)
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
return "[add_leading(num2text((timeleft / 60) % 60), 2, "0")]:[add_leading(num2text(timeleft % 60), 2, " ")]"
else
return "00:00"
+1 -1
View File
@@ -171,7 +171,7 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, typecacheof(list(
msg += "[value] credits: received [ex.reagents_volume[chem]]u of [chem].\n"
SSshuttle.points += value
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = copytext_char(msg, 1, MAX_MESSAGE_LEN)
SSshuttle.centcom_message = msg
investigate_log("Shuttle contents sold for [SSshuttle.points - presale_points] credits. Contents: [ex.exported_atoms || "none."] Message: [SSshuttle.centcom_message || "none."]", INVESTIGATE_CARGO)
@@ -61,7 +61,7 @@ Also, you never added distance checking after target is selected. I've went ahea
return
var/datum/mind/TM = target.mind
if((target.anti_magic_check(TRUE, FALSE) || TM.has_antag_datum(/datum/antagonist/wizard) || TM.has_antag_datum(/datum/antagonist/cult) || TM.has_antag_datum(/datum/antagonist/clockcult) || TM.has_antag_datum(/datum/antagonist/changeling) || TM.has_antag_datum(/datum/antagonist/rev)) || cmptext(copytext(target.key,1,2),"@"))
if(target.anti_magic_check(TRUE, FALSE) || TM.has_antag_datum(/datum/antagonist/wizard) || TM.has_antag_datum(/datum/antagonist/cult) || TM.has_antag_datum(/datum/antagonist/clockcult) || TM.has_antag_datum(/datum/antagonist/changeling) || TM.has_antag_datum(/datum/antagonist/rev) || target.key[1] == "@")
if(!silent)
to_chat(user, "<span class='warning'>[target.p_their(TRUE)] mind is resisting your spell!</span>")
return
+1 -1
View File
@@ -202,7 +202,7 @@
/obj/item/organ/eyes/robotic/shield/emp_act(severity)
return
#define RGB2EYECOLORSTRING(definitionvar) ("[copytext(definitionvar,2,3)][copytext(definitionvar,4,5)][copytext(definitionvar,6,7)]")
#define RGB2EYECOLORSTRING(definitionvar) ("[copytext_char(definitionvar, 2, 3)][copytext_char(definitionvar, 4, 5)][copytext_char(definitionvar, 6, 7)]")
/obj/item/organ/eyes/robotic/glow
name = "High Luminosity Eyes"
+2 -2
View File
@@ -189,7 +189,7 @@
var/insertpos = rand(1, message_list.len - 1)
var/inserttext = message_list[insertpos]
if(!(copytext(inserttext, length(inserttext) - 2) == "..."))
if(!(copytext(inserttext, -3) == "..."))//3 == length("...")
message_list[insertpos] = inserttext + "..."
if(prob(20) && message_list.len > 3)
@@ -290,7 +290,7 @@
/obj/item/organ/tongue/fluffy/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(copytext(message, 1, 2) != "*")
if(message[1] != "*")
message = replacetext(message, "ne", "nye")
message = replacetext(message, "nu", "nyu")
message = replacetext(message, "na", "nya")
+10 -10
View File
@@ -189,19 +189,19 @@
listeners = list(L) //Devil names are unique.
power_multiplier *= 5 //if you're a devil and god himself addressed you, you fucked up
//Cut out the name so it doesn't trigger commands
message = copytext(message, 0, start)+copytext(message, start + length(devilinfo.truename), length(message) + 1)
message = copytext(message, 1, start) + copytext(message, start + length(devilinfo.truename))
break
else if(dd_hasprefix(message, L.real_name))
else if(findtext(message, L.real_name, 1, length(L.real_name) + 1))
specific_listeners += L //focus on those with the specified name
//Cut out the name so it doesn't trigger commands
found_string = L.real_name
else if(dd_hasprefix(message, L.first_name()))
else if(findtext(message, L.first_name(), 1, length(L.first_name()) + 1))
specific_listeners += L //focus on those with the specified name
//Cut out the name so it doesn't trigger commands
found_string = L.first_name()
else if(L.mind && L.mind.assigned_role && dd_hasprefix(message, L.mind.assigned_role))
else if(L.mind && L.mind.assigned_role && findtext(message, L.mind.assigned_role, 1, length(L.mind.assigned_role) + 1))
specific_listeners += L //focus on those with the specified job
//Cut out the job so it doesn't trigger commands
found_string = L.mind.assigned_role
@@ -209,7 +209,7 @@
if(specific_listeners.len)
listeners = specific_listeners
power_multiplier *= (1 + (1/specific_listeners.len)) //2x on a single guy, 1.5x on two and so on
message = copytext(message, 0, 1)+copytext(message, 1 + length(found_string), length(message) + 1)
message = copytext(message, length(found_string) + 1)
var/static/regex/stun_words = regex("stop|wait|stand still|hold on|halt")
var/static/regex/knockdown_words = regex("drop|fall|trip|knockdown")
@@ -578,7 +578,7 @@
cooldown = COOLDOWN_MEME
for(var/V in listeners)
var/mob/living/carbon/human/H = V
if(H.client && H.client.prefs && H.client.prefs.cit_toggles & HYPNO) // probably a redundant check but for good measure
H.mob_climax(forced_climax=TRUE)
@@ -719,19 +719,19 @@
for(var/V in listeners)
var/mob/living/L = V
if(dd_hasprefix(message, L.real_name))
if(findtext(message, L.real_name, 1, length(L.real_name) + 1))
specific_listeners += L //focus on those with the specified name
//Cut out the name so it doesn't trigger commands
found_string = L.real_name
power_multiplier += 0.5
else if(dd_hasprefix(message, L.first_name()))
else if(findtext(message, L.first_name(), 1, length(L.first_name()) + 1))
specific_listeners += L //focus on those with the specified name
//Cut out the name so it doesn't trigger commands
found_string = L.first_name()
power_multiplier += 0.5
else if(L.mind && L.mind.assigned_role && dd_hasprefix(message, L.mind.assigned_role))
else if(L.mind && L.mind.assigned_role && findtext(message, L.mind.assigned_role, 1, length(L.mind.assigned_role) + 1))
specific_listeners += L //focus on those with the specified job
//Cut out the job so it doesn't trigger commands
found_string = L.mind.assigned_role
@@ -740,7 +740,7 @@
if(specific_listeners.len)
listeners = specific_listeners
//power_multiplier *= (1 + (1/specific_listeners.len)) //Put this is if it becomes OP, power is judged internally on a thrall, so shouldn't be nessicary.
message = copytext(message, 0, 1)+copytext(message, 1 + length(found_string), length(message) + 1)//I have no idea what this does
message = copytext(message, length(found_string) + 1)//I have no idea what this does
var/obj/item/organ/tongue/T = user.getorganslot(ORGAN_SLOT_TONGUE)
if (T.name == "fluffy tongue") //If you sound hillarious, it's hard to take you seriously. This is a way for other players to combat/reduce their effectiveness.
+1 -1
View File
@@ -80,7 +80,7 @@ GLOBAL_LIST_EMPTY(vore_preferences_datums)
//
/datum/vore_preferences/proc/load_path(ckey,slot,filename="character",ext="json")
if(!ckey || !slot) return
path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/vore/[filename][slot].[ext]"
path = "data/player_saves/[ckey[1]]/[ckey]/vore/[filename][slot].[ext]"
/datum/vore_preferences/proc/load_vore()
if(!client || !client_ckey)