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
+1 -1
View File
@@ -190,7 +190,7 @@
Launch(TRUE)
to_chat(user, "<span class='notice'>Calling your shuttle. One moment...</span>")
to_chat(user, span_notice("Calling your shuttle. One moment..."))
while(mode != SHUTTLE_CALL && !damaged)
stoplag()
+1 -1
View File
@@ -60,6 +60,6 @@
if(S.shuttleId == shuttle_id)
S.possible_destinations = "[landing_zone.id]"
to_chat(user, "<span class='notice'>Landing zone set.</span>")
to_chat(user, span_notice("Landing zone set."))
qdel(src)
+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)
+12 -12
View File
@@ -31,12 +31,12 @@
/obj/machinery/computer/emergency_shuttle/examine(mob/user)
. = ..()
if(hijack_announce)
. += "<span class='danger'>Security systems present on console. Any unauthorized tampering will result in an emergency announcement.</span>"
. += span_danger("Security systems present on console. Any unauthorized tampering will result in an emergency announcement.")
if(user?.mind?.get_hijack_speed())
. += "<span class='danger'>Alt click on this to attempt to hijack the shuttle. This will take multiple tries (current: stage [SSshuttle.emergency.hijack_status]/[HIJACKED]).</span>"
. += "<span class='notice'>It will take you [(hijack_stage_time * user.mind.get_hijack_speed()) / 10] seconds to reprogram a stage of the shuttle's navigational firmware, and the console will undergo automated timed lockout for [hijack_stage_cooldown/10] seconds after each stage.</span>"
. += span_danger("Alt click on this to attempt to hijack the shuttle. This will take multiple tries (current: stage [SSshuttle.emergency.hijack_status]/[HIJACKED]).")
. += span_notice("It will take you [(hijack_stage_time * user.mind.get_hijack_speed()) / 10] seconds to reprogram a stage of the shuttle's navigational firmware, and the console will undergo automated timed lockout for [hijack_stage_cooldown/10] seconds after each stage.")
if(hijack_announce)
. += "<span class='warning'>It is probably best to fortify your position as to be uninterrupted during the attempt, given the automatic announcements..</span>"
. += span_warning("It is probably best to fortify your position as to be uninterrupted during the attempt, given the automatic announcements..")
/obj/machinery/computer/emergency_shuttle/attackby(obj/item/I, mob/user,params)
if(istype(I, /obj/item/card/id))
@@ -93,11 +93,11 @@
var/obj/item/card/id/ID = user.get_idcard(TRUE)
if(!ID)
to_chat(user, "<span class='warning'>You don't have an ID.</span>")
to_chat(user, span_warning("You don't have an ID."))
return
if(!(ACCESS_HEADS in ID.access))
to_chat(user, "<span class='warning'>The access level of your card is not high enough.</span>")
to_chat(user, span_warning("The access level of your card is not high enough."))
return
if (user in acted_recently)
@@ -208,13 +208,13 @@
if(hijack_hacking == TRUE)
return
if(SSshuttle.emergency.hijack_status >= HIJACKED)
to_chat(user, "<span class='warning'>The emergency shuttle is already loaded with a corrupt navigational payload. What more do you want from it?</span>")
to_chat(user, span_warning("The emergency shuttle is already loaded with a corrupt navigational payload. What more do you want from it?"))
return
if(hijack_last_stage_increase >= world.time + hijack_stage_cooldown)
say("Error - Catastrophic software error detected. Input is currently on timeout.")
return
hijack_hacking = TRUE
to_chat(user, "<span class='boldwarning'>You [SSshuttle.emergency.hijack_status == NOT_BEGUN? "begin" : "continue"] to override [src]'s navigational protocols.</span>")
to_chat(user, span_boldwarning("You [SSshuttle.emergency.hijack_status == NOT_BEGUN? "begin" : "continue"] to override [src]'s navigational protocols."))
say("Software override initiated.")
var/turf/console_hijack_turf = get_turf(src)
message_admins("[src] is being overriden for hijack by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(console_hijack_turf)]")
@@ -226,7 +226,7 @@
message_admins("[src] has had its hijack stage increased to stage [SSshuttle.emergency.hijack_status] out of [HIJACKED] by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(console_hijack_turf)]")
log_game("[src] has had its hijack stage increased to stage [SSshuttle.emergency.hijack_status] out of [HIJACKED] by [key_name(user)] at [AREACOORD(src)]")
. = TRUE
to_chat(user, "<span class='notice'>You reprogram some of [src]'s programming, putting it on timeout for [hijack_stage_cooldown/10] seconds.</span>")
to_chat(user, span_notice("You reprogram some of [src]'s programming, putting it on timeout for [hijack_stage_cooldown/10] seconds."))
hijack_hacking = FALSE
/obj/machinery/computer/emergency_shuttle/proc/announce_hijack_stage()
@@ -254,7 +254,7 @@
return
if((obj_flags & EMAGGED) || ENGINES_STARTED) //SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LA-SYSTEM ERROR: THE SHUTTLE WILL LAUNCH IN 10 SECONDS
to_chat(user, "<span class='warning'>The shuttle is already about to launch!</span>")
to_chat(user, span_warning("The shuttle is already about to launch!"))
return
var/time = TIME_LEFT
@@ -573,7 +573,7 @@
launch_status = EARLY_LAUNCHED
return ..()
else
to_chat(usr, "<span class='warning'>Escape pods will only launch during \"Code Red\" security alert.</span>")
to_chat(usr, span_warning("Escape pods will only launch during \"Code Red\" security alert."))
return TRUE
/obj/docking_port/mobile/pod/cancel()
@@ -601,7 +601,7 @@
return
obj_flags |= EMAGGED
locked = FALSE
to_chat(user, "<span class='warning'>You fry the pod's alert level checking system.</span>")
to_chat(user, span_warning("You fry the pod's alert level checking system."))
/obj/machinery/computer/shuttle/pod/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
. = ..()
+1 -1
View File
@@ -10,7 +10,7 @@
/obj/machinery/computer/shuttle/ferry/emag_act(mob/user)
if(!allow_emag)
to_chat(user, "<span class='warning'>[src]'s security firewall is far too powerful for you to bypass.</span>")
to_chat(user, span_warning("[src]'s security firewall is far too powerful for you to bypass."))
return FALSE
return ..()
+8 -8
View File
@@ -60,10 +60,10 @@
/obj/machinery/computer/camera_advanced/shuttle_docker/attack_hand(mob/user, list/modifiers)
if(jammed)
to_chat(user, "<span class='warning'>The Syndicate is jamming the console!</span>")
to_chat(user, span_warning("The Syndicate is jamming the console!"))
return
if(!shuttle_port && !SSshuttle.getShuttle(shuttleId))
to_chat(user,"<span class='warning'>Warning: Shuttle connection severed!</span>")
to_chat(user,span_warning("Warning: Shuttle connection severed!"))
return
return ..()
@@ -139,23 +139,23 @@
var/mob/camera/ai_eye/remote/shuttle_docker/the_eye = eyeobj
var/landing_clear = checkLandingSpot()
if(designate_time && (landing_clear != SHUTTLE_DOCKER_BLOCKED))
to_chat(current_user, "<span class='warning'>Targeting transit location, please wait [DisplayTimeText(designate_time)]...</span>")
to_chat(current_user, span_warning("Targeting transit location, please wait [DisplayTimeText(designate_time)]..."))
designating_target_loc = the_eye.loc
var/wait_completed = do_after(current_user, designate_time, designating_target_loc, timed_action_flags = IGNORE_HELD_ITEM, extra_checks = CALLBACK(src, /obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget))
designating_target_loc = null
if(!current_user)
return
if(!wait_completed)
to_chat(current_user, "<span class='warning'>Operation aborted.</span>")
to_chat(current_user, span_warning("Operation aborted."))
return
landing_clear = checkLandingSpot()
if(landing_clear != SHUTTLE_DOCKER_LANDING_CLEAR)
switch(landing_clear)
if(SHUTTLE_DOCKER_BLOCKED)
to_chat(current_user, "<span class='warning'>Invalid transit location.</span>")
to_chat(current_user, span_warning("Invalid transit location."))
if(SHUTTLE_DOCKER_BLOCKED_BY_HIDDEN_PORT)
to_chat(current_user, "<span class='warning'>Unknown object detected in landing zone. Please designate another location.</span>")
to_chat(current_user, span_warning("Unknown object detected in landing zone. Please designate another location."))
return
///Make one use port that deleted after fly off, to don't lose info that need on to properly fly off.
@@ -196,7 +196,7 @@
if(current_user.client)
current_user.client.images += the_eye.placed_images
to_chat(current_user, "<span class='notice'>Transit location designated.</span>")
to_chat(current_user, span_notice("Transit location designated."))
return TRUE
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/canDesignateTarget()
@@ -388,7 +388,7 @@
if(T)
playsound(console, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE)
remote_eye.setLoc(T)
to_chat(target, "<span class='notice'>Jumped to [selected].</span>")
to_chat(target, span_notice("Jumped to [selected]."))
C.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash/static)
C.clear_fullscreen("flash", 3)
else
+1 -1
View File
@@ -31,7 +31,7 @@ All ShuttleMove procs go here
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
M.visible_message("<span class='warning'>[shuttle] slams into [M]!</span>")
M.visible_message(span_warning("[shuttle] slams into [M]!"))
SSblackbox.record_feedback("tally", "shuttle_gib", 1, M.type)
log_attack("[key_name(M)] was shuttle gibbed by [shuttle].")
M.gib()
@@ -40,10 +40,10 @@
var/new_name = "Beacon_[stripped_input("Enter the custom name for this beacon", "It be Beacon ..your input..")]"
if(new_name && Adjacent(user))
name = new_name
to_chat(user, "<span class='notice'>You change beacon name to [name].</span>")
to_chat(user, span_notice("You change beacon name to [name]."))
else
locked =!locked
to_chat(user, "<span class='notice'>You [locked ? "" : "un"]lock [src].</span>")
to_chat(user, span_notice("You [locked ? "" : "un"]lock [src]."))
return TRUE
/obj/machinery/spaceship_navigation_beacon/examine()
+10 -10
View File
@@ -90,8 +90,8 @@
for(var/i in found - sleepers)
var/mob/living/L = i
L.add_atom_colour("#800080", TEMPORARY_COLOUR_PRIORITY)
L.visible_message("<span class='revennotice'>A strange purple glow wraps itself around [L] as [L.p_they()] suddenly fall[L.p_s()] unconscious.</span>",
"<span class='revendanger'>[desc]</span>")
L.visible_message(span_revennotice("A strange purple glow wraps itself around [L] as [L.p_they()] suddenly fall[L.p_s()] unconscious."),
span_revendanger("[desc]"))
// Don't let them sit suround unconscious forever
addtimer(CALLBACK(src, .proc/sleeper_dreams, L), 100)
@@ -120,7 +120,7 @@
/obj/structure/table/abductor/wabbajack/proc/sleeper_dreams(mob/living/sleeper)
if(sleeper in sleepers)
to_chat(sleeper, "<span class='revennotice'>While you slumber, you have the strangest dream, like you can see yourself from the outside.</span>")
to_chat(sleeper, span_revennotice("While you slumber, you have the strangest dream, like you can see yourself from the outside."))
sleeper.ghostize(TRUE)
/obj/structure/table/abductor/wabbajack/left
@@ -210,7 +210,7 @@
var/throwtarget = get_edge_target_turf(src, boot_dir)
M.Paralyze(40)
M.throw_at(throwtarget, 5, 1)
to_chat(M, "<span class='notice'>No climbing on the bar please.</span>")
to_chat(M, span_notice("No climbing on the bar please."))
/obj/structure/table/wood/bar/proc/is_barstaff(mob/living/user)
. = FALSE
@@ -245,7 +245,7 @@
var/obj/vehicle/vehicle = mover
for(var/mob/living/rat in vehicle.occupants)
if(!(rat in approved_passengers))
say("<span class='robot'>Stowaway detected. Please exit the vehicle first.</span>")
say(span_robot("Stowaway detected. Please exit the vehicle first."))
return FALSE
return TRUE
if(isitem(mover))
@@ -253,7 +253,7 @@
if(isstructure(mover))
var/obj/structure/struct = mover
for(var/mob/living/rat in struct.contents)
say("<span class='robot'>Stowaway detected. Please exit the structure first.</span>")
say(span_robot("Stowaway detected. Please exit the structure first."))
return FALSE
return TRUE
@@ -284,7 +284,7 @@
if(I.registered_account)
account = I.registered_account
else if(!check_times[AM] || check_times[AM] < world.time) //Let's not spam the message
to_chat(AM, "<span class='notice'>This ID card doesn't have an owner associated with it!</span>")
to_chat(AM, span_notice("This ID card doesn't have an owner associated with it!"))
check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN
else if(isliving(AM))
var/mob/living/L = AM
@@ -356,7 +356,7 @@
if(armless)
if(!AM.pulling || !iscash(AM.pulling) && !istype(AM.pulling, /obj/item/card/id))
if(!check_times[AM] || check_times[AM] < world.time) //Let's not spam the message
to_chat(AM, "<span class='notice'>Try pulling a valid ID, space cash, holochip or coin into \the [src]!</span>")
to_chat(AM, span_notice("Try pulling a valid ID, space cash, holochip or coin into \the [src]!"))
check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN
if(payees[AM] >= threshold)
@@ -378,7 +378,7 @@
AM.pulling = HC
payees[AM] -= payees[AM]
say("<span class='robot'>Welcome to first class, [driver_holdout ? "[driver_holdout]" : "[AM]" ]![change ? " Here is your change." : ""]</span>")
say(span_robot("Welcome to first class, [driver_holdout ? "[driver_holdout]" : "[AM]" ]![change ? " Here is your change." : ""]"))
approved_passengers |= AM
if(vehicle)
approved_passengers |= vehicle
@@ -391,7 +391,7 @@
for(var/obj/I in counted_money)
qdel(I)
if(!check_times[AM] || check_times[AM] < world.time) //Let's not spam the message
to_chat(AM, "<span class='notice'>[payees[AM]] cr received. You need [threshold-payees[AM]] cr more.</span>")
to_chat(AM, span_notice("[payees[AM]] cr received. You need [threshold-payees[AM]] cr more."))
check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN
alarm_beep()
return ..()
+2 -2
View File
@@ -24,7 +24,7 @@
return FALSE
var/obj/item/circuitboard/computer/syndicate_shuttle/board = circuit
if(board?.challenge && world.time < SYNDICATE_CHALLENGE_TIMER)
to_chat(user, "<span class='warning'>You've issued a combat challenge to the station! You've got to give them at least [DisplayTimeText(SYNDICATE_CHALLENGE_TIMER - world.time)] more to allow them to prepare.</span>")
to_chat(user, span_warning("You've issued a combat challenge to the station! You've got to give them at least [DisplayTimeText(SYNDICATE_CHALLENGE_TIMER - world.time)] more to allow them to prepare."))
return FALSE
board.moved = TRUE
return TRUE
@@ -49,7 +49,7 @@
if(!.)
return FALSE
if(!is_centcom_level(z))
to_chat(user, "<span class='warning'>Pods are one way!</span>")
to_chat(user, span_warning("Pods are one way!"))
return FALSE
return TRUE