mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
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:
@@ -93,11 +93,11 @@
|
||||
if(!W.tool_start_check(user, amount=0))
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] disassembles the windoor assembly.</span>",
|
||||
"<span class='notice'>You start to disassemble the windoor assembly...</span>")
|
||||
user.visible_message(span_notice("[user] disassembles the windoor assembly."),
|
||||
span_notice("You start to disassemble the windoor assembly..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=50))
|
||||
to_chat(user, "<span class='notice'>You disassemble the windoor assembly.</span>")
|
||||
to_chat(user, span_notice("You disassemble the windoor assembly."))
|
||||
var/obj/item/stack/sheet/rglass/RG = new (get_turf(src), 5)
|
||||
RG.add_fingerprint(user)
|
||||
if(secure)
|
||||
@@ -110,19 +110,19 @@
|
||||
if(W.tool_behaviour == TOOL_WRENCH && !anchored)
|
||||
for(var/obj/machinery/door/window/WD in loc)
|
||||
if(WD.dir == dir)
|
||||
to_chat(user, "<span class='warning'>There is already a windoor in that location!</span>")
|
||||
to_chat(user, span_warning("There is already a windoor in that location!"))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] secures the windoor assembly to the floor.</span>",
|
||||
"<span class='notice'>You start to secure the windoor assembly to the floor...</span>")
|
||||
user.visible_message(span_notice("[user] secures the windoor assembly to the floor."),
|
||||
span_notice("You start to secure the windoor assembly to the floor..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=100))
|
||||
if(anchored)
|
||||
return
|
||||
for(var/obj/machinery/door/window/WD in loc)
|
||||
if(WD.dir == dir)
|
||||
to_chat(user, "<span class='warning'>There is already a windoor in that location!</span>")
|
||||
to_chat(user, span_warning("There is already a windoor in that location!"))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You secure the windoor assembly.</span>")
|
||||
to_chat(user, span_notice("You secure the windoor assembly."))
|
||||
set_anchored(TRUE)
|
||||
if(secure)
|
||||
name = "secure anchored windoor assembly"
|
||||
@@ -131,13 +131,13 @@
|
||||
|
||||
//Unwrenching an unsecure assembly un-anchors it. Step 4 undone
|
||||
else if(W.tool_behaviour == TOOL_WRENCH && anchored)
|
||||
user.visible_message("<span class='notice'>[user] unsecures the windoor assembly to the floor.</span>",
|
||||
"<span class='notice'>You start to unsecure the windoor assembly to the floor...</span>")
|
||||
user.visible_message(span_notice("[user] unsecures the windoor assembly to the floor."),
|
||||
span_notice("You start to unsecure the windoor assembly to the floor..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=100))
|
||||
if(!anchored)
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You unsecure the windoor assembly.</span>")
|
||||
to_chat(user, span_notice("You unsecure the windoor assembly."))
|
||||
set_anchored(FALSE)
|
||||
if(secure)
|
||||
name = "secure windoor assembly"
|
||||
@@ -148,16 +148,16 @@
|
||||
else if(istype(W, /obj/item/stack/sheet/plasteel) && !secure)
|
||||
var/obj/item/stack/sheet/plasteel/P = W
|
||||
if(P.get_amount() < 2)
|
||||
to_chat(user, "<span class='warning'>You need more plasteel to do this!</span>")
|
||||
to_chat(user, span_warning("You need more plasteel to do this!"))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start to reinforce the windoor with plasteel...</span>")
|
||||
to_chat(user, span_notice("You start to reinforce the windoor with plasteel..."))
|
||||
|
||||
if(do_after(user,40, target = src))
|
||||
if(!src || secure || P.get_amount() < 2)
|
||||
return
|
||||
|
||||
P.use(2)
|
||||
to_chat(user, "<span class='notice'>You reinforce the windoor.</span>")
|
||||
to_chat(user, span_notice("You reinforce the windoor."))
|
||||
secure = TRUE
|
||||
if(anchored)
|
||||
name = "secure anchored windoor assembly"
|
||||
@@ -166,16 +166,16 @@
|
||||
|
||||
//Adding cable to the assembly. Step 5 complete.
|
||||
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
|
||||
user.visible_message("<span class='notice'>[user] wires the windoor assembly.</span>", "<span class='notice'>You start to wire the windoor assembly...</span>")
|
||||
user.visible_message(span_notice("[user] wires the windoor assembly."), span_notice("You start to wire the windoor assembly..."))
|
||||
|
||||
if(do_after(user, 40, target = src))
|
||||
if(!src || !anchored || src.state != "01")
|
||||
return
|
||||
var/obj/item/stack/cable_coil/CC = W
|
||||
if(!CC.use(1))
|
||||
to_chat(user, "<span class='warning'>You need more cable to do this!</span>")
|
||||
to_chat(user, span_warning("You need more cable to do this!"))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You wire the windoor.</span>")
|
||||
to_chat(user, span_notice("You wire the windoor."))
|
||||
state = "02"
|
||||
if(secure)
|
||||
name = "secure wired windoor assembly"
|
||||
@@ -188,13 +188,13 @@
|
||||
|
||||
//Removing wire from the assembly. Step 5 undone.
|
||||
if(W.tool_behaviour == TOOL_WIRECUTTER)
|
||||
user.visible_message("<span class='notice'>[user] cuts the wires from the airlock assembly.</span>", "<span class='notice'>You start to cut the wires from airlock assembly...</span>")
|
||||
user.visible_message(span_notice("[user] cuts the wires from the airlock assembly."), span_notice("You start to cut the wires from airlock assembly..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=100))
|
||||
if(state != "02")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You cut the windoor wires.</span>")
|
||||
to_chat(user, span_notice("You cut the windoor wires."))
|
||||
new/obj/item/stack/cable_coil(get_turf(user), 1)
|
||||
state = "01"
|
||||
if(secure)
|
||||
@@ -207,14 +207,14 @@
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
W.play_tool_sound(src, 100)
|
||||
user.visible_message("<span class='notice'>[user] installs the electronics into the airlock assembly.</span>",
|
||||
"<span class='notice'>You start to install electronics into the airlock assembly...</span>")
|
||||
user.visible_message(span_notice("[user] installs the electronics into the airlock assembly."),
|
||||
span_notice("You start to install electronics into the airlock assembly..."))
|
||||
|
||||
if(do_after(user, 40, target = src))
|
||||
if(!src || electronics)
|
||||
W.forceMove(drop_location())
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You install the airlock electronics.</span>")
|
||||
to_chat(user, span_notice("You install the airlock electronics."))
|
||||
name = "near finished windoor assembly"
|
||||
electronics = W
|
||||
else
|
||||
@@ -225,11 +225,11 @@
|
||||
if(!electronics)
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] removes the electronics from the airlock assembly.</span>",
|
||||
"<span class='notice'>You start to uninstall electronics from the airlock assembly...</span>")
|
||||
user.visible_message(span_notice("[user] removes the electronics from the airlock assembly."),
|
||||
span_notice("You start to uninstall electronics from the airlock assembly..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=100) && electronics)
|
||||
to_chat(user, "<span class='notice'>You remove the airlock electronics.</span>")
|
||||
to_chat(user, span_notice("You remove the airlock electronics."))
|
||||
name = "wired windoor assembly"
|
||||
var/obj/item/electronics/airlock/ae
|
||||
ae = electronics
|
||||
@@ -250,16 +250,16 @@
|
||||
//Crowbar to complete the assembly, Step 7 complete.
|
||||
else if(W.tool_behaviour == TOOL_CROWBAR)
|
||||
if(!electronics)
|
||||
to_chat(usr, "<span class='warning'>The assembly is missing electronics!</span>")
|
||||
to_chat(usr, span_warning("The assembly is missing electronics!"))
|
||||
return
|
||||
user << browse(null, "window=windoor_access")
|
||||
user.visible_message("<span class='notice'>[user] pries the windoor into the frame.</span>",
|
||||
"<span class='notice'>You start prying the windoor into the frame...</span>")
|
||||
user.visible_message(span_notice("[user] pries the windoor into the frame."),
|
||||
span_notice("You start prying the windoor into the frame..."))
|
||||
|
||||
if(W.use_tool(src, user, 40, volume=100) && electronics)
|
||||
|
||||
density = TRUE //Shouldn't matter but just incase
|
||||
to_chat(user, "<span class='notice'>You finish the windoor.</span>")
|
||||
to_chat(user, span_notice("You finish the windoor."))
|
||||
|
||||
if(secure)
|
||||
var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(loc)
|
||||
@@ -322,12 +322,12 @@
|
||||
|
||||
/obj/structure/windoor_assembly/proc/can_be_rotated(mob/user,rotation_type)
|
||||
if(anchored)
|
||||
to_chat(user, "<span class='warning'>[src] cannot be rotated while it is fastened to the floor!</span>")
|
||||
to_chat(user, span_warning("[src] cannot be rotated while it is fastened to the floor!"))
|
||||
return FALSE
|
||||
var/target_dir = turn(dir, rotation_type == ROTATION_CLOCKWISE ? -90 : 90)
|
||||
|
||||
if(!valid_window_location(loc, target_dir, is_fulltile = FALSE))
|
||||
to_chat(user, "<span class='warning'>[src] cannot be rotated in that direction!</span>")
|
||||
to_chat(user, span_warning("[src] cannot be rotated in that direction!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -348,11 +348,11 @@
|
||||
return
|
||||
|
||||
if(facing == "l")
|
||||
to_chat(usr, "<span class='notice'>The windoor will now slide to the right.</span>")
|
||||
to_chat(usr, span_notice("The windoor will now slide to the right."))
|
||||
facing = "r"
|
||||
else
|
||||
facing = "l"
|
||||
to_chat(usr, "<span class='notice'>The windoor will now slide to the left.</span>")
|
||||
to_chat(usr, span_notice("The windoor will now slide to the left."))
|
||||
|
||||
update_appearance()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user