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
+9 -9
View File
@@ -91,7 +91,7 @@
if(.)
return
if(!allowed(usr))
to_chat(usr, "<span class='danger'>Access denied.</span>")
to_chat(usr, span_danger("Access denied."))
return
switch(action)
@@ -100,14 +100,14 @@
return
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId)
if(M.launch_status == ENDGAME_LAUNCHED)
to_chat(usr, "<span class='warning'>You've already escaped. Never going back to that place again!</span>")
to_chat(usr, span_warning("You've already escaped. Never going back to that place again!"))
return
if(no_destination_swap)
if(M.mode == SHUTTLE_RECHARGING)
to_chat(usr, "<span class='warning'>Shuttle engines are not ready for use.</span>")
to_chat(usr, span_warning("Shuttle engines are not ready for use."))
return
if(M.mode != SHUTTLE_IDLE)
to_chat(usr, "<span class='warning'>Shuttle already in transit.</span>")
to_chat(usr, span_warning("Shuttle already in transit."))
return
var/list/options = params2list(possible_destinations)
var/obj/docking_port/stationary/S = SSshuttle.getDock(params["shuttle_id"])
@@ -121,9 +121,9 @@
log_shuttle("[key_name(usr)] has sent shuttle \"[M]\" towards \"[params["shuttle_id"]]\", using [src].")
return TRUE
if(1)
to_chat(usr, "<span class='warning'>Invalid shuttle requested.</span>")
to_chat(usr, span_warning("Invalid shuttle requested."))
else
to_chat(usr, "<span class='warning'>Unable to comply.</span>")
to_chat(usr, span_warning("Unable to comply."))
if("set_destination")
var/target_destination = params["destination"]
if(target_destination)
@@ -131,10 +131,10 @@
return TRUE
if("request")
if(!COOLDOWN_FINISHED(src, request_cooldown))
to_chat(usr, "<span class='warning'>CentCom is still processing last authorization request!</span>")
to_chat(usr, span_warning("CentCom is still processing last authorization request!"))
return
COOLDOWN_START(src, request_cooldown, 1 MINUTES)
to_chat(usr, "<span class='notice'>Your request has been received by CentCom.</span>")
to_chat(usr, span_notice("Your request has been received by CentCom."))
to_chat(GLOB.admins, "<b>SHUTTLE: <font color='#3d5bc3'>[ADMIN_LOOKUPFLW(usr)] (<A HREF='?_src_=holder;[HrefToken()];move_shuttle=[shuttleId]'>Move Shuttle</a>)(<A HREF='?_src_=holder;[HrefToken()];unlock_shuttle=[REF(src)]'>Lock/Unlock Shuttle</a>)</b> is requesting to move or unlock the shuttle.</font>")
return TRUE
@@ -143,7 +143,7 @@
return
req_access = list()
obj_flags |= EMAGGED
to_chat(user, "<span class='notice'>You fried the consoles ID checking system.</span>")
to_chat(user, span_notice("You fried the consoles ID checking system."))
/obj/machinery/computer/shuttle/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
if(port)