Refactors most spans into span procs (#59645)

Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
This commit is contained in:
Watermelon914
2021-06-14 21:03:53 +01:00
committed by GitHub
parent b9982f6970
commit 375a20e49b
1676 changed files with 15455 additions and 15226 deletions
+35 -35
View File
@@ -44,7 +44,7 @@
return
var/mob/M = locate(href_list["getplaytimewindow"]) in GLOB.mob_list
if(!M)
to_chat(usr, "<span class='danger'>ERROR: Mob not found.</span>", confidential = TRUE)
to_chat(usr, span_danger("ERROR: Mob not found."), confidential = TRUE)
return
cmd_show_exp_panel(M.client)
else if(href_list["forceevent"])
@@ -104,7 +104,7 @@
return
SSshuttle.emergency.request()
log_admin("[key_name(usr)] called the Emergency Shuttle.")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] called the Emergency Shuttle to the station.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] called the Emergency Shuttle to the station."))
if("2")
if(EMERGENCY_AT_LEAST_DOCKED)
@@ -113,11 +113,11 @@
if(SHUTTLE_CALL)
SSshuttle.emergency.cancel()
log_admin("[key_name(usr)] sent the Emergency Shuttle back.")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] sent the Emergency Shuttle back.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] sent the Emergency Shuttle back."))
else
SSshuttle.emergency.cancel()
log_admin("[key_name(usr)] called the Emergency Shuttle.")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] called the Emergency Shuttle to the station.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] called the Emergency Shuttle to the station."))
@@ -131,7 +131,7 @@
SSshuttle.emergency.setTimer(timer SECONDS)
log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [timer] seconds.")
minor_announce("The emergency shuttle will reach its destination in [DisplayTimeText(timer SECONDS)].")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [timer] seconds.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [timer] seconds."))
else if(href_list["trigger_centcom_recall"])
if(!check_rights(R_ADMIN))
return
@@ -197,16 +197,16 @@
if(!check_rights(R_ADMIN))
return
message_admins("<span class='adminnotice'>[key_name_admin(usr)] is considering ending the round.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] is considering ending the round."))
if(tgui_alert(usr, "This will end the round, are you SURE you want to do this?", "Confirmation", list("Yes", "No")) == "Yes")
if(tgui_alert(usr, "Final Confirmation: End the round NOW?", "Confirmation", list("Yes", "No")) == "Yes")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has ended the round.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] has ended the round."))
SSticker.force_ending = 1 //Yeah there we go APC destroyed mission accomplished
return
else
message_admins("<span class='adminnotice'>[key_name_admin(usr)] decided against ending the round.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] decided against ending the round."))
else
message_admins("<span class='adminnotice'>[key_name_admin(usr)] decided against ending the round.</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] decided against ending the round."))
else if(href_list["simplemake"])
if(!check_rights(R_SPAWN))
@@ -226,7 +226,7 @@
delmob = FALSE
log_admin("[key_name(usr)] has used rudimentary transformation on [key_name(M)]. Transforming to [href_list["simplemake"]].; deletemob=[delmob]")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has used rudimentary transformation on [key_name_admin(M)]. Transforming to [href_list["simplemake"]].; deletemob=[delmob]</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] has used rudimentary transformation on [key_name_admin(M)]. Transforming to [href_list["simplemake"]].; deletemob=[delmob]"))
switch(href_list["simplemake"])
if("observer")
M.change_mob_type( /mob/dead/observer , null, null, delmob )
@@ -292,19 +292,19 @@
var/mob/M = locate(href_list["boot2"])
if(ismob(M))
if(!check_if_greater_rights_than(M.client))
to_chat(usr, "<span class='danger'>Error: They have more rights than you do.</span>", confidential = TRUE)
to_chat(usr, span_danger("Error: They have more rights than you do."), confidential = TRUE)
return
if(tgui_alert(usr, "Kick [key_name(M)]?", "Confirm", list("Yes", "No")) != "Yes")
return
if(!M)
to_chat(usr, "<span class='danger'>Error: [M] no longer exists!</span>", confidential = TRUE)
to_chat(usr, span_danger("Error: [M] no longer exists!"), confidential = TRUE)
return
if(!M.client)
to_chat(usr, "<span class='danger'>Error: [M] no longer has a client!</span>", confidential = TRUE)
to_chat(usr, span_danger("Error: [M] no longer has a client!"), confidential = TRUE)
return
to_chat(M, "<span class='danger'>You have been kicked from the server by [usr.client.holder.fakekey ? "an Administrator" : "[usr.client.key]"].</span>", confidential = TRUE)
to_chat(M, span_danger("You have been kicked from the server by [usr.client.holder.fakekey ? "an Administrator" : "[usr.client.key]"]."), confidential = TRUE)
log_admin("[key_name(usr)] kicked [key_name(M)].")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] kicked [key_name_admin(M)].</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] kicked [key_name_admin(M)]."))
qdel(M.client)
else if(href_list["addmessage"])
@@ -560,7 +560,7 @@
return
log_admin("[key_name(usr)] attempting to monkeyize [key_name(H)].")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] attempting to monkeyize [key_name_admin(H)].</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] attempting to monkeyize [key_name_admin(H)]."))
H.monkeyize()
else if(href_list["humanone"])
@@ -573,7 +573,7 @@
return
log_admin("[key_name(usr)] attempting to humanize [key_name(Mo)].")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] attempting to humanize [key_name_admin(Mo)].</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] attempting to humanize [key_name_admin(Mo)]."))
Mo.humanize()
else if(href_list["corgione"])
@@ -586,7 +586,7 @@
return
log_admin("[key_name(usr)] attempting to corgize [key_name(H)].")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] attempting to corgize [key_name_admin(H)].</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] attempting to corgize [key_name_admin(H)]."))
H.corgize()
@@ -604,7 +604,7 @@
M.say(speech, forced = "admin speech")
speech = sanitize(speech) // Nah, we don't trust them
log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]</span>")
message_admins(span_adminnotice("[key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]"))
else if(href_list["sendtoprison"])
if(!check_rights(R_ADMIN))
@@ -622,7 +622,7 @@
return
M.forceMove(pick(GLOB.prisonwarp))
to_chat(M, "<span class='adminnotice'>You have been sent to Prison!</span>", confidential = TRUE)
to_chat(M, span_adminnotice("You have been sent to Prison!"), confidential = TRUE)
log_admin("[key_name(usr)] has sent [key_name(M)] to Prison!")
message_admins("[key_name_admin(usr)] has sent [key_name_admin(M)] to Prison!")
@@ -634,11 +634,11 @@
var/mob/M = locate(href_list["sendbacktolobby"])
if(!isobserver(M))
to_chat(usr, "<span class='notice'>You can only send ghost players back to the Lobby.</span>", confidential = TRUE)
to_chat(usr, span_notice("You can only send ghost players back to the Lobby."), confidential = TRUE)
return
if(!M.client)
to_chat(usr, "<span class='warning'>[M] doesn't seem to have an active client.</span>", confidential = TRUE)
to_chat(usr, span_warning("[M] doesn't seem to have an active client."), confidential = TRUE)
return
if(tgui_alert(usr, "Send [key_name(M)] back to Lobby?", "Message", list("Yes", "No")) != "Yes")
@@ -673,7 +673,7 @@
L.Unconscious(100)
sleep(5)
L.forceMove(pick(GLOB.tdome1))
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, "<span class='adminnotice'>You have been sent to the Thunderdome.</span>"), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, span_adminnotice("You have been sent to the Thunderdome.")), 5 SECONDS)
log_admin("[key_name(usr)] has sent [key_name(L)] to the thunderdome. (Team 1)")
message_admins("[key_name_admin(usr)] has sent [key_name_admin(L)] to the thunderdome. (Team 1)")
@@ -699,7 +699,7 @@
L.Unconscious(100)
sleep(5)
L.forceMove(pick(GLOB.tdome2))
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, "<span class='adminnotice'>You have been sent to the Thunderdome.</span>"), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, span_adminnotice("You have been sent to the Thunderdome.")), 5 SECONDS)
log_admin("[key_name(usr)] has sent [key_name(L)] to the thunderdome. (Team 2)")
message_admins("[key_name_admin(usr)] has sent [key_name_admin(L)] to the thunderdome. (Team 2)")
@@ -722,7 +722,7 @@
L.Unconscious(100)
sleep(5)
L.forceMove(pick(GLOB.tdomeadmin))
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, "<span class='adminnotice'>You have been sent to the Thunderdome.</span>"), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, span_adminnotice("You have been sent to the Thunderdome.")), 5 SECONDS)
log_admin("[key_name(usr)] has sent [key_name(L)] to the thunderdome. (Admin.)")
message_admins("[key_name_admin(usr)] has sent [key_name_admin(L)] to the thunderdome. (Admin.)")
@@ -752,7 +752,7 @@
L.Unconscious(100)
sleep(5)
L.forceMove(pick(GLOB.tdomeobserve))
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, "<span class='adminnotice'>You have been sent to the Thunderdome.</span>"), 5 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, L, span_adminnotice("You have been sent to the Thunderdome.")), 5 SECONDS)
log_admin("[key_name(usr)] has sent [key_name(L)] to the thunderdome. (Observer.)")
message_admins("[key_name_admin(usr)] has sent [key_name_admin(L)] to the thunderdome. (Observer.)")
@@ -766,7 +766,7 @@
return
L.revive(full_heal = TRUE, admin_revive = TRUE)
message_admins("<span class='danger'>Admin [key_name_admin(usr)] healed / revived [key_name_admin(L)]!</span>")
message_admins(span_danger("Admin [key_name_admin(usr)] healed / revived [key_name_admin(L)]!"))
log_admin("[key_name(usr)] healed / Revived [key_name(L)].")
else if(href_list["makeai"])
@@ -785,9 +785,9 @@
if("No")
move = FALSE
if(QDELETED(H))
to_chat(usr, "<span class='danger'>Subject was deleted already. Transform canceled.</span>")
to_chat(usr, span_danger("Subject was deleted already. Transform canceled."))
return
message_admins("<span class='danger'>Admin [key_name_admin(usr)] AIized [key_name_admin(H)]!</span>")
message_admins(span_danger("Admin [key_name_admin(usr)] AIized [key_name_admin(H)]!"))
log_admin("[key_name(usr)] AIized [key_name(H)].")
H.AIize(TRUE, H.client, move)
@@ -1063,7 +1063,7 @@
log_admin("[key_name(H)] got their [new_item], spawned by [key_name(src.owner)].")
message_admins("[key_name(H)] got their [new_item], spawned by [key_name(src.owner)].")
SSblackbox.record_feedback("amount", "admin_cookies_spawned", 1)
to_chat(H, "<span class='adminnotice'>Your prayers have been answered!! You received the <b>best [new_item.name]!</b></span>", confidential = TRUE)
to_chat(H, span_adminnotice("Your prayers have been answered!! You received the <b>best [new_item.name]!</b>"), confidential = TRUE)
SEND_SOUND(H, sound('sound/effects/pray_chaplain.ogg'))
else if(href_list["adminsmite"])
@@ -1634,7 +1634,7 @@
if(tgui_alert(usr,"Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby??","Message",list("Yes","Cancel")) != "Yes")
to_chat(usr, "Kick clients from lobby aborted", confidential = TRUE)
return
var/list/listkicked = kick_clients_in_lobby("<span class='danger'>You were kicked from the lobby by [usr.client.holder.fakekey ? "an Administrator" : "[usr.client.key]"].</span>", afkonly)
var/list/listkicked = kick_clients_in_lobby(span_danger("You were kicked from the lobby by [usr.client.holder.fakekey ? "an Administrator" : "[usr.client.key]"]."), afkonly)
var/strkicked = ""
for(var/name in listkicked)
@@ -1677,7 +1677,7 @@
else if(href_list["viewruntime"])
var/datum/error_viewer/error_viewer = locate(href_list["viewruntime"])
if(!istype(error_viewer))
to_chat(usr, "<span class='warning'>That runtime viewer no longer exists.</span>", confidential = TRUE)
to_chat(usr, span_warning("That runtime viewer no longer exists."), confidential = TRUE)
return
if(href_list["viewruntime_backto"])
@@ -1707,7 +1707,7 @@
return
if(!CONFIG_GET(string/centcom_ban_db))
to_chat(usr, "<span class='warning'>Centcom Galactic Ban DB is disabled!</span>")
to_chat(usr, span_warning("Centcom Galactic Ban DB is disabled!"))
return
var/ckey = href_list["centcomlookup"]
@@ -1949,11 +1949,11 @@
else if(href_list["admincommend"])
if(!SSticker.IsRoundInProgress())
to_chat(usr, "<span class='warning'>The round must be in progress to use this!</span>")
to_chat(usr, span_warning("The round must be in progress to use this!"))
return
var/mob/heart_recepient = locate(href_list["admincommend"])
if(!heart_recepient?.ckey)
to_chat(usr, "<span class='warning'>This mob either no longer exists or no longer is being controlled by someone!</span>")
to_chat(usr, span_warning("This mob either no longer exists or no longer is being controlled by someone!"))
return
switch(tgui_alert(usr, "Would you like the effects to apply immediately or at the end of the round? Applying them now will make it clear it was an admin commendation.", "<3?", list("Apply now", "Apply at round end", "Cancel")))