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 13:03:53 -07:00
committed by GitHub
parent b9982f6970
commit 375a20e49b
1676 changed files with 15455 additions and 15226 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
prefs.enable_tips = !prefs.enable_tips
prefs.save_preferences()
to_chat(usr, "<span class='danger'>Examine tooltips [prefs.enable_tips ? "en" : "dis"]abled.</span>")
to_chat(usr, span_danger("Examine tooltips [prefs.enable_tips ? "en" : "dis"]abled."))
/client/verb/change_tip_delay()
set name = "Set Examine Tooltip Delay"
@@ -17,4 +17,4 @@
if(usr)//is this what you mean?
prefs.tip_delay = indelay
prefs.save_preferences()
to_chat(usr, "<span class='danger'>Tooltip delay set to [indelay] milliseconds.</span>")
to_chat(usr, span_danger("Tooltip delay set to [indelay] milliseconds."))
+18 -18
View File
@@ -6,7 +6,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set category = "OOC"
if(GLOB.say_disabled) //This is here to try to identify lag problems
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
to_chat(usr, span_danger("Speech is currently admin-disabled."))
return
if(!mob)
@@ -14,16 +14,16 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(!holder)
if(!GLOB.ooc_allowed)
to_chat(src, "<span class='danger'>OOC is globally muted.</span>")
to_chat(src, span_danger("OOC is globally muted."))
return
if(!GLOB.dooc_allowed && (mob.stat == DEAD))
to_chat(usr, "<span class='danger'>OOC for dead mobs has been turned off.</span>")
to_chat(usr, span_danger("OOC for dead mobs has been turned off."))
return
if(prefs.muted & MUTE_OOC)
to_chat(src, "<span class='danger'>You cannot use OOC (muted).</span>")
to_chat(src, span_danger("You cannot use OOC (muted)."))
return
if(is_banned_from(ckey, "OOC"))
to_chat(src, "<span class='danger'>You have been banned from OOC.</span>")
to_chat(src, span_danger("You have been banned from OOC."))
return
if(QDELETED(src))
return
@@ -44,13 +44,13 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(handle_spam_prevention(msg,MUTE_OOC))
return
if(findtext(msg, "byond://"))
to_chat(src, "<span class='boldannounce'><B>Advertising other servers is not allowed.</B></span>")
to_chat(src, span_boldannounce("<B>Advertising other servers is not allowed.</B>"))
log_admin("[key_name(src)] has attempted to advertise in OOC: [msg]")
message_admins("[key_name_admin(src)] has attempted to advertise in OOC: [msg]")
return
if(!(prefs.chat_toggles & CHAT_OOC))
to_chat(src, "<span class='danger'>You have OOC muted.</span>")
to_chat(src, span_danger("You have OOC muted."))
return
mob.log_talk(raw_msg, LOG_OOC)
@@ -70,20 +70,20 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(holder)
if(!holder.fakekey || C.holder)
if(check_rights_for(src, R_ADMIN))
to_chat(C, "<span class='adminooc'>[CONFIG_GET(flag/allow_admin_ooccolor) && prefs.ooccolor ? "<font color=[prefs.ooccolor]>" :"" ]<span class='prefix'>OOC:</span> <EM>[keyname][holder.fakekey ? "/([holder.fakekey])" : ""]:</EM> <span class='message linkify'>[msg]</span></span>")
to_chat(C, span_adminooc("[CONFIG_GET(flag/allow_admin_ooccolor) && prefs.ooccolor ? "<font color=[prefs.ooccolor]>" :"" ][span_prefix("OOC:")] <EM>[keyname][holder.fakekey ? "/([holder.fakekey])" : ""]:</EM> <span class='message linkify'>[msg]</span>"))
else
to_chat(C, "<span class='adminobserverooc'><span class='prefix'>OOC:</span> <EM>[keyname][holder.fakekey ? "/([holder.fakekey])" : ""]:</EM> <span class='message linkify'>[msg]</span></span>")
to_chat(C, span_adminobserverooc(span_prefix("OOC:</span> <EM>[keyname][holder.fakekey ? "/([holder.fakekey])" : ""]:</EM> <span class='message linkify'>[msg]")))
else
if(GLOB.OOC_COLOR)
to_chat(C, "<span class='oocplain'><font color='[GLOB.OOC_COLOR]'><b><span class='prefix'>OOC:</span> <EM>[holder.fakekey ? holder.fakekey : key]:</EM> <span class='message linkify'>[msg]</span></b></font></span>")
to_chat(C, "<span class='oocplain'><font color='[GLOB.OOC_COLOR]'><b>[span_prefix("OOC:")] <EM>[holder.fakekey ? holder.fakekey : key]:</EM> <span class='message linkify'>[msg]</span></b></font></span>")
else
to_chat(C, "<span class='ooc'><span class='prefix'>OOC:</span> <EM>[holder.fakekey ? holder.fakekey : key]:</EM> <span class='message linkify'>[msg]</span></span>")
to_chat(C, span_ooc(span_prefix("OOC:</span> <EM>[holder.fakekey ? holder.fakekey : key]:</EM> <span class='message linkify'>[msg]")))
else if(!(key in C.prefs.ignoring))
if(GLOB.OOC_COLOR)
to_chat(C, "<span class='oocplain'><font color='[GLOB.OOC_COLOR]'><b><span class='prefix'>OOC:</span> <EM>[keyname]:</EM> <span class='message linkify'>[msg]</span></b></font></span>")
to_chat(C, "<span class='oocplain'><font color='[GLOB.OOC_COLOR]'><b>[span_prefix("OOC:")] <EM>[keyname]:</EM> <span class='message linkify'>[msg]</span></b></font></span>")
else
to_chat(C, "<span class='ooc'><span class='prefix'>OOC:</span> <EM>[keyname]:</EM> <span class='message linkify'>[msg]</span></span>")
to_chat(C, span_ooc(span_prefix("OOC:</span> <EM>[keyname]:</EM> <span class='message linkify'>[msg]")))
/proc/toggle_ooc(toggle = null)
if(toggle != null) //if we're specifically en/disabling ooc
@@ -177,9 +177,9 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set desc ="Check the admin notice if it has been set"
if(GLOB.admin_notice)
to_chat(src, "<span class='boldnotice'>Admin Notice:</span>\n \t [GLOB.admin_notice]")
to_chat(src, "[span_boldnotice("Admin Notice:")]\n \t [GLOB.admin_notice]")
else
to_chat(src, "<span class='notice'>There are no admin notices at the moment.</span>")
to_chat(src, span_notice("There are no admin notices at the moment."))
/client/verb/motd()
set name = "MOTD"
@@ -190,7 +190,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(motd)
to_chat(src, "<span class='infoplain'><div class=\"motd\">[motd]</div></span>", handle_whitespace=FALSE)
else
to_chat(src, "<span class='notice'>The Message of the Day has not been set.</span>")
to_chat(src, span_notice("The Message of the Day has not been set."))
/client/proc/self_notes()
set name = "View Admin Remarks"
@@ -198,7 +198,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set desc = "View the notes that admins have written about you"
if(!CONFIG_GET(flag/see_own_notes))
to_chat(usr, "<span class='notice'>Sorry, that function is not enabled on this server.</span>")
to_chat(usr, span_notice("Sorry, that function is not enabled on this server."))
return
browse_messages(null, usr.ckey, null, TRUE)
@@ -209,7 +209,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set desc = "View the amount of playtime for roles the server has tracked."
if(!CONFIG_GET(flag/use_exp_tracking))
to_chat(usr, "<span class='notice'>Sorry, tracking is currently disabled.</span>")
to_chat(usr, span_notice("Sorry, tracking is currently disabled."))
return
new /datum/job_report_menu(src, usr)
+1 -1
View File
@@ -14,7 +14,7 @@
/client/verb/display_ping(time as num)
set instant = TRUE
set name = ".display_ping"
to_chat(src, "<span class='notice'>Round trip ping took [round(pingfromtime(time),1)]ms</span>")
to_chat(src, span_notice("Round trip ping took [round(pingfromtime(time),1)]ms"))
/client/verb/ping()
set name = "Ping"
+20 -20
View File
@@ -33,7 +33,7 @@
return
if(confirm == "Yes")
if(suiciding)
to_chat(src, "<span class='warning'>You're already trying to commit suicide!</span>")
to_chat(src, span_warning("You're already trying to commit suicide!"))
return
set_suicide(TRUE) //need to be called before calling suicide_act as fuck knows what suicide_act will do with your suicider
var/obj/item/held_item = get_active_held_item()
@@ -103,7 +103,7 @@
"[src] is twisting [p_their()] own neck! It looks like [p_theyre()] trying to commit suicide.", \
"[src] is holding [p_their()] breath! It looks like [p_theyre()] trying to commit suicide.")
visible_message("<span class='danger'>[suicide_message]</span>", "<span class='userdanger'>[suicide_message]</span>")
visible_message(span_danger("[suicide_message]"), span_userdanger("[suicide_message]"))
suicide_log()
@@ -120,8 +120,8 @@
return
if(confirm == "Yes")
set_suicide(TRUE)
visible_message("<span class='danger'>[src]'s brain is growing dull and lifeless. [p_they(TRUE)] look[p_s()] like [p_theyve()] lost the will to live.</span>", \
"<span class='userdanger'>[src]'s brain is growing dull and lifeless. [p_they(TRUE)] look[p_s()] like [p_theyve()] lost the will to live.</span>")
visible_message(span_danger("[src]'s brain is growing dull and lifeless. [p_they(TRUE)] look[p_s()] like [p_theyve()] lost the will to live."), \
span_userdanger("[src]'s brain is growing dull and lifeless. [p_they(TRUE)] look[p_s()] like [p_theyve()] lost the will to live."))
suicide_log()
@@ -137,8 +137,8 @@
return
if(confirm == "Yes")
set_suicide(TRUE)
visible_message("<span class='danger'>[src] is powering down. It looks like [p_theyre()] trying to commit suicide.</span>", \
"<span class='userdanger'>[src] is powering down. It looks like [p_theyre()] trying to commit suicide.</span>")
visible_message(span_danger("[src] is powering down. It looks like [p_theyre()] trying to commit suicide."), \
span_userdanger("[src] is powering down. It looks like [p_theyre()] trying to commit suicide."))
suicide_log()
@@ -156,8 +156,8 @@
return
if(confirm == "Yes")
set_suicide(TRUE)
visible_message("<span class='danger'>[src] is powering down. It looks like [p_theyre()] trying to commit suicide.</span>", \
"<span class='userdanger'>[src] is powering down. It looks like [p_theyre()] trying to commit suicide.</span>")
visible_message(span_danger("[src] is powering down. It looks like [p_theyre()] trying to commit suicide."), \
span_userdanger("[src] is powering down. It looks like [p_theyre()] trying to commit suicide."))
suicide_log()
@@ -171,8 +171,8 @@
var/confirm = tgui_alert(usr,"Are you sure you want to commit suicide?", "Confirm Suicide", list("Yes", "No"))
if(confirm == "Yes")
var/turf/T = get_turf(src.loc)
T.visible_message("<span class='notice'>[src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\"</span>", null, \
"<span class='notice'>[src] bleeps electronically.</span>")
T.visible_message(span_notice("[src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\""), null, \
span_notice("[src] bleeps electronically."))
suicide_log()
@@ -190,9 +190,9 @@
return
if(confirm == "Yes")
set_suicide(TRUE)
visible_message("<span class='danger'>[src] is thrashing wildly! It looks like [p_theyre()] trying to commit suicide.</span>", \
"<span class='userdanger'>[src] is thrashing wildly! It looks like [p_theyre()] trying to commit suicide.</span>", \
"<span class='hear'>You hear thrashing.</span>")
visible_message(span_danger("[src] is thrashing wildly! It looks like [p_theyre()] trying to commit suicide."), \
span_userdanger("[src] is thrashing wildly! It looks like [p_theyre()] trying to commit suicide."), \
span_hear("You hear thrashing."))
suicide_log()
@@ -210,8 +210,8 @@
return
if(confirm == "Yes")
set_suicide(TRUE)
visible_message("<span class='danger'>[src] begins to fall down. It looks like [p_theyve()] lost the will to live.</span>", \
"<span class='userdanger'>[src] begins to fall down. It looks like [p_theyve()] lost the will to live.</span>")
visible_message(span_danger("[src] begins to fall down. It looks like [p_theyve()] lost the will to live."), \
span_userdanger("[src] begins to fall down. It looks like [p_theyve()] lost the will to live."))
suicide_log()
@@ -227,23 +227,23 @@
/mob/living/proc/canSuicide()
var/area/A = get_area(src)
if(A.area_flags & BLOCK_SUICIDE)
to_chat(src, "<span class='warning'>You can't commit suicide here! You can ghost if you'd like.</span>")
to_chat(src, span_warning("You can't commit suicide here! You can ghost if you'd like."))
return
switch(stat)
if(CONSCIOUS)
return TRUE
if(SOFT_CRIT)
to_chat(src, "<span class='warning'>You can't commit suicide while in a critical condition!</span>")
to_chat(src, span_warning("You can't commit suicide while in a critical condition!"))
if(UNCONSCIOUS, HARD_CRIT)
to_chat(src, "<span class='warning'>You need to be conscious to commit suicide!</span>")
to_chat(src, span_warning("You need to be conscious to commit suicide!"))
if(DEAD)
to_chat(src, "<span class='warning'>You're already dead!</span>")
to_chat(src, span_warning("You're already dead!"))
return
/mob/living/carbon/canSuicide()
if(!..())
return
if(!(mobility_flags & MOBILITY_USE)) //just while I finish up the new 'fun' suiciding verb. This is to prevent metagaming via suicide
to_chat(src, "<span class='warning'>You can't commit suicide whilst immobile! ((You can type Ghost instead however.))</span>")
to_chat(src, span_warning("You can't commit suicide whilst immobile! ((You can type Ghost instead however.))"))
return
return TRUE
+1 -1
View File
@@ -96,7 +96,7 @@
continue //Don't show afk admins to adminwho
if(!C.holder.fakekey)
msg += "\t[C] is a [C.holder.rank]\n"
msg += "<span class='info'>Adminhelps are also sent through TGS to services like IRC and Discord. If no admins are available in game adminhelp anyways and an admin will see it and respond.</span>"
msg += span_info("Adminhelps are also sent through TGS to services like IRC and Discord. If no admins are available in game adminhelp anyways and an admin will see it and respond.")
to_chat(src, msg)
#undef DEFAULT_WHO_CELLS_PER_ROW