Skip to content

Commit

Permalink
Update TGS DMAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
tgstation-server committed Sep 26, 2022
1 parent f112042 commit a3f5e31
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions code/modules/tgs/core/tgs_version.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/datum/tgs_version/New(raw_parameter)
src.raw_parameter = raw_parameter
deprefixed_parameter = replacetext_char(raw_parameter, "/tg/station 13 Server v", "")
var/list/version_bits = splittext_char(deprefixed_parameter, ".")
deprefixed_parameter = replacetext(raw_parameter, "/tg/station 13 Server v", "")
var/list/version_bits = splittext(deprefixed_parameter, ".")

suite = text2num(version_bits[1])
if(version_bits.len > 1)
Expand Down
20 changes: 10 additions & 10 deletions code/modules/tgs/v3210/api.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#define SERVICE_RETURN_SUCCESS "SUCCESS"

#define TGS_FILE2LIST(filename) (splittext_char(trim_left(trim_right(file2text(filename))), "\n"))
#define TGS_FILE2LIST(filename) (splittext(trim_left(trim_right(file2text(filename))), "\n"))

/datum/tgs_api/v3210
var/reboot_mode = REBOOT_MODE_NORMAL
Expand All @@ -44,15 +44,15 @@
return new /datum/tgs_version("3.2.1.3")

/datum/tgs_api/v3210/proc/trim_left(text)
for (var/i = 1 to length_char(text))
if (text2ascii_char(text, i) > 32)
return copytext_char(text, i)
for (var/i = 1 to length(text))
if (text2ascii(text, i) > 32)
return copytext(text, i)
return ""

/datum/tgs_api/v3210/proc/trim_right(text)
for (var/i = length_char(text), i > 0, i--)
if (text2ascii_char(text, i) > 32)
return copytext_char(text, 1, i + 1)
for (var/i = length(text), i > 0, i--)
if (text2ascii(text, i) > 32)
return copytext(text, 1, i + 1)
return ""

/datum/tgs_api/v3210/OnWorldNew(minimum_required_security_level)
Expand All @@ -65,15 +65,15 @@

var/list/logs = TGS_FILE2LIST(".git/logs/HEAD")
if(logs.len)
logs = splittext_char(logs[logs.len], " ")
logs = splittext(logs[logs.len], " ")
if (logs.len >= 2)
commit = logs[2]
else
TGS_ERROR_LOG("Error parsing commit logs")

logs = TGS_FILE2LIST(".git/logs/refs/remotes/origin/master220")
logs = TGS_FILE2LIST(".git/logs/refs/remotes/origin/master")
if(logs.len)
logs = splittext_char(logs[logs.len], " ")
logs = splittext(logs[logs.len], " ")
if (logs.len >= 2)
originmastercommit = logs[2]
else
Expand Down
4 changes: 2 additions & 2 deletions code/modules/tgs/v3210/commands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
warned_about_the_dangers_of_robutussin = TRUE
var/datum/tgs_chat_command/stc = I
var/command_name = initial(stc.name)
if(!command_name || findtext_char(command_name, " ") || findtext_char(command_name, "'") || findtext_char(command_name, "\""))
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
if(warnings_only && !warned_command_names[command_name])
TGS_ERROR_LOG("Custom command [command_name] can't be used as it is empty or contains illegal characters!")
warned_command_names[command_name] = TRUE
Expand Down Expand Up @@ -45,7 +45,7 @@

// Discord hack, fix the mention if it's only numbers (fuck you IRC trolls)
var/regex/discord_id_regex = regex(@"^[0-9]+$")
if(findtext_char(sender, discord_id_regex))
if(findtext(sender, discord_id_regex))
sender = "<@[sender]>"

user.mention = sender
Expand Down
2 changes: 1 addition & 1 deletion code/modules/tgs/v4/commands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext_char(command_name, " ") || findtext_char(command_name, "'") || findtext_char(command_name, "\""))
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
TGS_ERROR_LOG("Custom command [command_name] ([I]) can't be used as it is empty or contains illegal characters!")
continue

Expand Down
2 changes: 1 addition & 1 deletion code/modules/tgs/v5/commands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
var/datum/tgs_chat_command/stc = new I
var/command_name = stc.name
if(!command_name || findtext_char(command_name, " ") || findtext_char(command_name, "'") || findtext_char(command_name, "\""))
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
TGS_WARNING_LOG("Custom command [command_name] ([I]) can't be used as it is empty or contains illegal characters!")
continue

Expand Down

0 comments on commit a3f5e31

Please sign in to comment.