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
@@ -32,10 +32,10 @@
if (!area_constraint)
return TRUE
if(!istype(build_area, area_constraint))
to_chat(owner, "<span class='warning'>You can only build within [area_constraint]!</span>")
to_chat(owner, span_warning("You can only build within [area_constraint]!"))
return FALSE
if(only_station_z && !is_station_level(build_target.z))
to_chat(owner, "<span class='warning'>[area_constraint] has launched and can no longer be modified.</span>")
to_chat(owner, span_warning("[area_constraint] has launched and can no longer be modified."))
return FALSE
return TRUE
@@ -104,17 +104,17 @@
return
var/turf/place_turf = get_turf(remote_eye)
if(!base_console.structures[structure_name])
to_chat(owner, "<span class='warning'>[base_console] is out of [structure_name]!</span>")
to_chat(owner, span_warning("[base_console] is out of [structure_name]!"))
return
if(!check_spot())
return
//Can't place inside a closed turf
if(place_turf.density)
to_chat(owner, "<span class='warning'>[structure_name] may only be placed on a floor.</span>")
to_chat(owner, span_warning("[structure_name] may only be placed on a floor."))
return
//Can't place two dense objects inside eachother
if(initial(structure_path.density) && place_turf.is_blocked_turf())
to_chat(owner, "<span class='warning'>Location is obstructed by something. Please clear the location and try again.</span>")
to_chat(owner, span_warning("Location is obstructed by something. Please clear the location and try again."))
return
var/obj/placed_structure = new structure_path(place_turf)
base_console.structures[structure_name]--
@@ -134,7 +134,7 @@
place_sound = 'sound/machines/click.ogg'
/datum/action/innate/construction/place_structure/turret/after_place(obj/placed_structure, remaining)
to_chat(owner, "<span class='notice'>Tiny fan placed. [remaining] fans remaining.</span>")
to_chat(owner, span_notice("Tiny fan placed. [remaining] fans remaining."))
/datum/action/innate/construction/place_structure/turret
name = "Install Plasma Anti-Wildlife Turret"
@@ -146,7 +146,7 @@
/datum/action/innate/construction/place_structure/turret/after_place(obj/placed_structure, remaining)
var/obj/machinery/computer/auxiliary_base/turret_controller = locate() in get_area(placed_structure)
if(!turret_controller)
to_chat(owner, "<span class='notice'><b>Warning:</b> Aux base controller not found. Turrets might not work properly.</span>")
to_chat(owner, span_notice("<b>Warning:</b> Aux base controller not found. Turrets might not work properly."))
return
turret_controller.turrets += placed_structure
to_chat(owner, "<span class='notice'>You've constructed an additional turret. [remaining] turrets remaining.</span>")
to_chat(owner, span_notice("You've constructed an additional turret. [remaining] turrets remaining."))