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
+23 -23
View File
@@ -130,7 +130,7 @@
*/
/obj/machinery/computer/auxiliary_base/proc/launch_check(mob/user)
if(!is_station_level(z) && shuttleId == "colony_drop")
to_chat(user, "<span class='warning'>You can't move the base again!</span>")
to_chat(user, span_warning("You can't move the base again!"))
return FALSE
return TRUE
@@ -139,7 +139,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)
@@ -148,7 +148,7 @@
return
var/shuttle_error = SSshuttle.moveShuttle(shuttleId, params["shuttle_id"], 1)
if(launch_warning)
say("<span class='danger'>Launch sequence activated! Prepare for drop!!</span>")
say(span_danger("Launch sequence activated! Prepare for drop!!"))
playsound(loc, 'sound/machines/warning-buzzer.ogg', 70, FALSE)
launch_warning = FALSE
blind_drop_ready = FALSE
@@ -168,10 +168,10 @@
var/turf/LZ = pick(all_mining_turfs) //Pick a random mining Z-level turf
if(!ismineralturf(LZ) && !istype(LZ, /turf/open/floor/plating/asteroid))
//Find a suitable mining turf. Reduces chance of landing in a bad area
to_chat(usr, "<span class='warning'>Landing zone scan failed. Please try again.</span>")
to_chat(usr, span_warning("Landing zone scan failed. Please try again."))
return
if(set_landing_zone(LZ, usr) != ZONE_SET)
to_chat(usr, "<span class='warning'>Landing zone unsuitable. Please recalculate.</span>")
to_chat(usr, span_warning("Landing zone unsuitable. Please recalculate."))
return
blind_drop_ready = FALSE
return TRUE
@@ -201,7 +201,7 @@
/obj/machinery/computer/auxiliary_base/proc/set_landing_zone(turf/T, mob/user, no_restrictions)
var/obj/docking_port/mobile/auxiliary_base/base_dock = locate(/obj/docking_port/mobile/auxiliary_base) in SSshuttle.mobile
if(!base_dock) //Not all maps have an Aux base. This object is useless in that case.
to_chat(user, "<span class='warning'>This station is not equipped with an auxiliary base. Please contact your Nanotrasen contractor.</span>")
to_chat(user, span_warning("This station is not equipped with an auxiliary base. Please contact your Nanotrasen contractor."))
return
if(!no_restrictions)
var/static/list/disallowed_turf_types = typecacheof(list(
@@ -245,7 +245,7 @@
//Serves as a nice mechanic to people get ready for the launch.
minor_announce("Auxiliary base landing zone coordinates locked in for [A]. Launch command now available!")
to_chat(user, "<span class='notice'>Landing zone set.</span>")
to_chat(user, span_notice("Landing zone set."))
return ZONE_SET
@@ -265,7 +265,7 @@
if(setting)
return
to_chat(user, "<span class='notice'>You begin setting the landing zone parameters...</span>")
to_chat(user, span_notice("You begin setting the landing zone parameters..."))
setting = TRUE
if(!do_after(user, 50, target = user)) //You get a few seconds to cancel if you do not want to drop there.
setting = FALSE
@@ -280,20 +280,20 @@
AB = A
break
if(!AB)
to_chat(user, "<span class='warning'>No auxiliary base console detected.</span>")
to_chat(user, span_warning("No auxiliary base console detected."))
return
switch(AB.set_landing_zone(T, user, no_restrictions))
if(ZONE_SET)
qdel(src)
if(BAD_ZLEVEL)
to_chat(user, "<span class='warning'>This uplink can only be used in a designed mining zone.</span>")
to_chat(user, span_warning("This uplink can only be used in a designed mining zone."))
if(BAD_AREA)
to_chat(user, "<span class='warning'>Unable to acquire a targeting lock. Find an area clear of structures or entirely within one.</span>")
to_chat(user, span_warning("Unable to acquire a targeting lock. Find an area clear of structures or entirely within one."))
if(BAD_COORDS)
to_chat(user, "<span class='warning'>Location is too close to the edge of the station's scanning range. Move several paces away and try again.</span>")
to_chat(user, span_warning("Location is too close to the edge of the station's scanning range. Move several paces away and try again."))
if(BAD_TURF)
to_chat(user, "<span class='warning'>The landing zone contains turfs unsuitable for a base. Make sure you've removed all walls and dangerous terrain from the landing zone.</span>")
to_chat(user, span_warning("The landing zone contains turfs unsuitable for a base. Make sure you've removed all walls and dangerous terrain from the landing zone."))
/obj/item/assault_pod/mining/unrestricted
name = "omni-locational landing field designator"
@@ -344,11 +344,11 @@
if(.)
return
if(anchored)
to_chat(user, "<span class='warning'>Landing zone already set.</span>")
to_chat(user, span_warning("Landing zone already set."))
return
if(anti_spam_cd)
to_chat(user, "<span class='warning'>[src] is currently recalibrating. Please wait.</span>")
to_chat(user, span_warning("[src] is currently recalibrating. Please wait."))
return
anti_spam_cd = 1
@@ -357,7 +357,7 @@
var/turf/landing_spot = get_turf(src)
if(!is_mining_level(landing_spot.z))
to_chat(user, "<span class='warning'>This device is only to be used in a mining zone.</span>")
to_chat(user, span_warning("This device is only to be used in a mining zone."))
return
var/obj/machinery/computer/auxiliary_base/aux_base_console
for(var/obj/machinery/computer/auxiliary_base/ABC in GLOB.machines)
@@ -365,7 +365,7 @@
aux_base_console = ABC
break
if(!aux_base_console) //Needs to be near the base to serve as its dock and configure it to control the mining shuttle.
to_chat(user, "<span class='warning'>The auxiliary base's console must be within [console_range] meters in order to interface.</span>")
to_chat(user, span_warning("The auxiliary base's console must be within [console_range] meters in order to interface."))
return
//Mining shuttles may not be created equal, so we find the map's shuttle dock and size accordingly.
@@ -388,7 +388,7 @@
break
if(!Mport)
to_chat(user, "<span class='warning'>This station is not equipped with an appropriate mining shuttle. Please contact Nanotrasen Support.</span>")
to_chat(user, span_warning("This station is not equipped with an appropriate mining shuttle. Please contact Nanotrasen Support."))
return
var/obj/docking_port/mobile/mining_shuttle
@@ -402,7 +402,7 @@
break
if(!mining_shuttle) //Not having a mining shuttle is a map issue
to_chat(user, "<span class='warning'>No mining shuttle signal detected. Please contact Nanotrasen Support.</span>")
to_chat(user, span_warning("No mining shuttle signal detected. Please contact Nanotrasen Support."))
SSshuttle.stationary.Remove(Mport)
qdel(Mport)
return
@@ -410,24 +410,24 @@
for(var/i in 1 to landing_turfs.len) //You land NEAR the base, not IN it.
var/turf/L = landing_turfs[i]
if(!L) //This happens at map edges
to_chat(user, "<span class='warning'>Unable to secure a valid docking zone. Please try again in an open area near, but not within the auxiliary mining base.</span>")
to_chat(user, span_warning("Unable to secure a valid docking zone. Please try again in an open area near, but not within the auxiliary mining base."))
SSshuttle.stationary.Remove(Mport)
qdel(Mport)
return
if(istype(get_area(L), /area/shuttle/auxiliary_base))
to_chat(user, "<span class='warning'>The mining shuttle must not land within the mining base itself.</span>")
to_chat(user, span_warning("The mining shuttle must not land within the mining base itself."))
SSshuttle.stationary.Remove(Mport)
qdel(Mport)
return
if(mining_shuttle.canDock(Mport) != SHUTTLE_CAN_DOCK)
to_chat(user, "<span class='warning'>Unable to secure a valid docking zone. Please try again in an open area near, but not within the auxiliary mining base.</span>")
to_chat(user, span_warning("Unable to secure a valid docking zone. Please try again in an open area near, but not within the auxiliary mining base."))
SSshuttle.stationary.Remove(Mport)
qdel(Mport)
return
aux_base_console.set_mining_mode() //Lets the colony park the shuttle there, now that it has a dock.
to_chat(user, "<span class='notice'>Mining shuttle calibration successful! Shuttle interface available at base console.</span>")
to_chat(user, span_notice("Mining shuttle calibration successful! Shuttle interface available at base console."))
set_anchored(TRUE) //Locks in place to mark the landing zone.
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
log_shuttle("[key_name(usr)] has registered the mining shuttle beacon at [COORD(landing_spot)].")