diff --git a/code/__DEFINES/typeids.dm b/code/__DEFINES/typeids.dm
index b86d9043e1..275f7719f0 100644
--- a/code/__DEFINES/typeids.dm
+++ b/code/__DEFINES/typeids.dm
@@ -2,7 +2,7 @@
#define TYPEID_NULL "0"
#define TYPEID_NORMAL_LIST "f"
//helper macros
-#define GET_TYPEID(ref) ( ( (length(ref) <= 10) ? "TYPEID_NULL" : copytext(ref, 4, -6) ) )
+#define GET_TYPEID(ref) ( ( (length(ref) <= 10) ? "TYPEID_NULL" : copytext(ref, 4, -7) ) )
#define IS_NORMAL_LIST(L) (GET_TYPEID("\ref[L]") == TYPEID_NORMAL_LIST)
diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm
index 8e12ac97d3..29597344cf 100644
--- a/code/modules/mob/living/carbon/human/say.dm
+++ b/code/modules/mob/living/carbon/human/say.dm
@@ -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]")
diff --git a/code/modules/mob/living/silicon/ai/say.dm b/code/modules/mob/living/silicon/ai/say.dm
index d9cc3a0c7b..4a76eafc53 100644
--- a/code/modules/mob/living/silicon/ai/say.dm
+++ b/code/modules/mob/living/silicon/ai/say.dm
@@ -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 ..()
diff --git a/code/modules/mob/living/silicon/pai/personality.dm b/code/modules/mob/living/silicon/pai/personality.dm
index acb2273c41..62f2ed7047 100644
--- a/code/modules/mob/living/silicon/pai/personality.dm
+++ b/code/modules/mob/living/silicon/pai/personality.dm
@@ -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))
diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm
index f6b29b95aa..f386231d7a 100644
--- a/code/modules/mob/living/simple_animal/parrot.dm
+++ b/code/modules/mob/living/simple_animal/parrot.dm
@@ -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
diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm
index 0a4bdf0c1c..4cd44af5ab 100644
--- a/code/modules/paperwork/folders.dm
+++ b/code/modules/paperwork/folders.dm
@@ -44,9 +44,11 @@
if(!user.is_literate())
to_chat(user, "You scribble illegibly on the cover of [src]!")
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)
diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm
index 7c0edf3f0e..d054e5ff12 100644
--- a/code/modules/paperwork/handlabeler.dm
+++ b/code/modules/paperwork/handlabeler.dm
@@ -70,7 +70,7 @@
if(mode)
to_chat(user, "You turn on [src].")
//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, "Invalid text!")
return
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index c9b7fb7b57..20f4ab0c86 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -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
diff --git a/code/modules/photography/_pictures.dm b/code/modules/photography/_pictures.dm
index 62fc01efda..f667e18f47 100644
--- a/code/modules/photography/_pictures.dm
+++ b/code/modules/photography/_pictures.dm
@@ -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")
diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm
index b15aa308a3..d51f569738 100644
--- a/code/modules/photography/photos/photo.dm
+++ b/code/modules/photography/photos/photo.dm
@@ -55,9 +55,8 @@
if(!user.is_literate())
to_chat(user, "You scribble illegibly on [src]!")
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)
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index cee9a17ebf..3c807390a0 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -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
diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm
index 4c9e1dddea..f509c409ce 100644
--- a/code/modules/procedural_mapping/mapGenerator.dm
+++ b/code/modules/procedural_mapping/mapGenerator.dm
@@ -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
diff --git a/code/modules/reagents/chem_wiki_render.dm b/code/modules/reagents/chem_wiki_render.dm
index e24da70d47..018161b075 100644
--- a/code/modules/reagents/chem_wiki_render.dm
+++ b/code/modules/reagents/chem_wiki_render.dm
@@ -196,7 +196,7 @@
return ""
- var/outstring = "|!\[[R.color]\](https://placehold.it/15/[copytext(R.color, 2, 8)]/000000?text=+)[R.name]
pH: [R.pH] | "
+ var/outstring = "|!\[[R.color]\](https://placehold.it/15/[copytext_char(R.color, 2, 8)]/000000?text=+)[R.name]
pH: [R.pH] | "
var/datum/reagent/R3
if(CR)
outstring += "
"
diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm
index 8fb05337f2..d6ad1bf042 100644
--- a/code/modules/recycling/sortingmachinery.dm
+++ b/code/modules/recycling/sortingmachinery.dm
@@ -36,7 +36,7 @@
if(!user.is_literate())
to_chat(user, "You scribble illegibly on the side of [src]!")
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, "You scribble illegibly on the side of [src]!")
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))
diff --git a/code/modules/research/nanites/nanite_programs/suppression.dm b/code/modules/research/nanites/nanite_programs/suppression.dm
index ad5706f88c..e4b250ad61 100644
--- a/code/modules/research/nanites/nanite_programs/suppression.dm
+++ b/code/modules/research/nanites/nanite_programs/suppression.dm
@@ -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")
diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm
index 01b9b1dc41..d33ef29155 100644
--- a/code/modules/research/rdconsole.dm
+++ b/code/modules/research/rdconsole.dm
@@ -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
diff --git a/code/modules/research/xenobiology/crossbreeding/stabilized.dm b/code/modules/research/xenobiology/crossbreeding/stabilized.dm
index 0d589954d9..27caf68396 100644
--- a/code/modules/research/xenobiology/crossbreeding/stabilized.dm
+++ b/code/modules/research/xenobiology/crossbreeding/stabilized.dm
@@ -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 = sanitize_name(stripped_input(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN))
if(newname)
mob_name = newname
to_chat(user, "You speak softly into [src], and it shakes slightly in response.")
diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm
index eddd5b2b0c..267d72c256 100644
--- a/code/modules/research/xenobiology/xenobiology.dm
+++ b/code/modules/research/xenobiology/xenobiology.dm
@@ -644,7 +644,7 @@
M.nutrition = 700
to_chat(M, "You absorb the potion and feel your intense desire to feed melt away.")
to_chat(user, "You feed the slime the potion, removing its hunger and calming it.")
- 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 = sanitize_name(stripped_input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime", MAX_NAME_LEN))
if (!newname)
newname = "pet slime"
diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm
index 0db05cb83d..0e7cba9776 100644
--- a/code/modules/shuttle/supply.dm
+++ b/code/modules/shuttle/supply.dm
@@ -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)
diff --git a/code/modules/spells/spell_types/mind_transfer.dm b/code/modules/spells/spell_types/mind_transfer.dm
index 982bc3dd06..cbc25fb98e 100644
--- a/code/modules/spells/spell_types/mind_transfer.dm
+++ b/code/modules/spells/spell_types/mind_transfer.dm
@@ -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, "[target.p_their(TRUE)] mind is resisting your spell!")
return
diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm
index c09d1ac1fc..0c242a67d3 100644
--- a/code/modules/surgery/organs/eyes.dm
+++ b/code/modules/surgery/organs/eyes.dm
@@ -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"
diff --git a/code/modules/surgery/organs/tongue.dm b/code/modules/surgery/organs/tongue.dm
index 760cd97f08..52bd0d4628 100644
--- a/code/modules/surgery/organs/tongue.dm
+++ b/code/modules/surgery/organs/tongue.dm
@@ -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")
diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm
index 5601bdafa3..c9596e3754 100644
--- a/code/modules/surgery/organs/vocal_cords.dm
+++ b/code/modules/surgery/organs/vocal_cords.dm
@@ -189,7 +189,7 @@
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(findtext(message, L.real_name, 1, length(L.real_name) + 1))
specific_listeners += L //focus on those with the specified name
@@ -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")
@@ -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.
diff --git a/code/modules/vore/eating/vore.dm b/code/modules/vore/eating/vore.dm
index a9b14dcdc8..29391547bd 100644
--- a/code/modules/vore/eating/vore.dm
+++ b/code/modules/vore/eating/vore.dm
@@ -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)
diff --git a/interface/menu.dm b/interface/menu.dm
index 547c2edfc1..3c881656da 100644
--- a/interface/menu.dm
+++ b/interface/menu.dm
@@ -69,8 +69,8 @@ GLOBAL_LIST_EMPTY(menulist)
if (!verbpath || !(verbpath in typesof("[type]/verb")))
return
- if (copytext(verbpath.name,1,2) == "@")
- winset(C, null, list2params(list("command" = copytext(verbpath.name,2))))
+ if (verbpath.name[1] == "@")
+ winset(C, null, list2params(list("command" = copytext(verbpath.name, length(verbpath.name[1]) + 1))))
else
winset(C, null, list2params(list("command" = replacetext(verbpath.name, " ", "-"))))
diff --git a/modular_citadel/code/modules/client/loadout/_loadout.dm b/modular_citadel/code/modules/client/loadout/_loadout.dm
index d48da1b863..d35bede179 100644
--- a/modular_citadel/code/modules/client/loadout/_loadout.dm
+++ b/modular_citadel/code/modules/client/loadout/_loadout.dm
@@ -13,7 +13,7 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
LAZYINITLIST(GLOB.loadout_whitelist_ids)
var/list/file_lines = world.file2list(loadout_config)
for(var/line in file_lines)
- if(!line || findtextEx(line,"#",1,2))
+ if(!line || line[1] == "#")
continue
var/list/lineinfo = splittext(line, "|")
var/lineID = lineinfo[1]
@@ -21,7 +21,7 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
var/sublinetypedef = findtext(subline, "=")
if(sublinetypedef)
var/sublinetype = copytext(subline, 1, sublinetypedef)
- var/list/sublinecontent = splittext(copytext(subline, sublinetypedef+1), ",")
+ var/list/sublinecontent = splittext(copytext(subline, sublinetypedef+ length(sublinetypedef)), ",")
if(sublinetype == "WHITELIST")
GLOB.loadout_whitelist_ids["[lineID]"] = sublinecontent
diff --git a/modular_citadel/code/modules/custom_loadout/read_from_file.dm b/modular_citadel/code/modules/custom_loadout/read_from_file.dm
index 0ed38e8d41..78124b0324 100644
--- a/modular_citadel/code/modules/custom_loadout/read_from_file.dm
+++ b/modular_citadel/code/modules/custom_loadout/read_from_file.dm
@@ -13,18 +13,18 @@ GLOBAL_LIST(custom_item_list)
GLOB.custom_item_list = list()
var/list/file_lines = world.file2list(custom_filelist)
for(var/line in file_lines)
- if(length(line) == 0) //Emptyline, no one cares.
+ if(!length(line)) //Emptyline, no one cares.
continue
- if(copytext(line,1,3) == "//") //Commented line, ignore.
+ if(copytext(line,1,3) == "//") //Commented line, ignore. 3 == length("//") + 1
continue
var/ckey_str_sep = findtext(line, "|") //Process our stuff..
- var/char_str_sep = findtext(line, "|", ckey_str_sep+1)
- var/job_str_sep = findtext(line, "|", char_str_sep+1)
- var/item_str_sep = findtext(line, "|", job_str_sep+1)
+ var/char_str_sep = findtext(line, "|", ckey_str_sep + length(ckey_str_sep))
+ var/job_str_sep = findtext(line, "|", char_str_sep + length(char_str_sep))
+ var/item_str_sep = findtext(line, "|", job_str_sep + length(job_str_sep))
var/ckey_str = ckey(copytext(line, 1, ckey_str_sep))
- var/char_str = copytext(line, ckey_str_sep+1, char_str_sep)
- var/job_str = copytext(line, char_str_sep+1, job_str_sep)
- var/item_str = copytext(line, job_str_sep+1, item_str_sep)
+ var/char_str = copytext(line, ckey_str_sep + length(ckey_str_sep), char_str_sep)
+ var/job_str = copytext(line, char_str_sep + length(char_str_sep), job_str_sep)
+ var/item_str = copytext(line, job_str_sep + length(job_str_sep), item_str_sep)
if(!ckey_str || !char_str || !job_str || !item_str || !length(ckey_str) || !length(char_str) || !length(job_str) || !length(item_str))
log_admin("Errored custom_items_whitelist line: [line] - Component/separator missing!")
if(!islist(GLOB.custom_item_list[ckey_str]))
@@ -42,7 +42,7 @@ GLOBAL_LIST(custom_item_list)
for(var/item_string in item_strings)
var/path_str_sep = findtext(item_string, "=")
var/path = copytext(item_string, 1, path_str_sep) //Path to spawn
- var/amount = copytext(item_string, path_str_sep+1) //Amount to spawn
+ var/amount = copytext(item_string, path_str_sep + length(path_str_sep)) //Amount to spawn
//world << "DEBUG: Item string [item_string] processed"
amount = text2num(amount)
path = text2path(path)
diff --git a/modular_citadel/code/modules/mentor/mentorhelp.dm b/modular_citadel/code/modules/mentor/mentorhelp.dm
index eb2b8546da..d056c03f49 100644
--- a/modular_citadel/code/modules/mentor/mentorhelp.dm
+++ b/modular_citadel/code/modules/mentor/mentorhelp.dm
@@ -10,9 +10,9 @@
spawn(300)
verbs += /client/verb/mentorhelp // 30 second cool-down for mentorhelp
- msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
- if(!msg) return
- if(!mob) return //this doesn't happen
+ msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
+ if(!msg || !mob)
+ return
var/show_char = CONFIG_GET(flag/mentors_mobname_only)
var/mentor_msg = "MENTORHELP: [key_name_mentor(src, 1, 0, 1, show_char)]: [msg]"
diff --git a/modular_citadel/code/modules/mentor/mentorpm.dm b/modular_citadel/code/modules/mentor/mentorpm.dm
index 4c9a4766ec..cb39f02092 100644
--- a/modular_citadel/code/modules/mentor/mentorpm.dm
+++ b/modular_citadel/code/modules/mentor/mentorpm.dm
@@ -53,7 +53,7 @@
if (!C.is_mentor() && !is_mentor())
return
- msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
+ msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
if(!msg && is_mentor(whom))
to_chat(GLOB.admins | GLOB.mentors, "[src] has stopped their reply to [whom]'s mhelp.")
return
diff --git a/modular_citadel/code/modules/mentor/mentorsay.dm b/modular_citadel/code/modules/mentor/mentorsay.dm
index 6baf969251..c13e3c6ef3 100644
--- a/modular_citadel/code/modules/mentor/mentorsay.dm
+++ b/modular_citadel/code/modules/mentor/mentorsay.dm
@@ -5,8 +5,9 @@
if(!is_mentor())
return
- msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
- if(!msg) return
+ msg = copytext_char(sanitize(msg), 1, MAX_MESSAGE_LEN)
+ if(!msg)
+ return
msg = emoji_parse(msg)
log_mentor("MSAY: [key_name(src)] : [msg]")