mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +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:
@@ -47,15 +47,15 @@
|
||||
|
||||
/obj/item/inducer/proc/cantbeused(mob/user)
|
||||
if(!ISADVANCEDTOOLUSER(user))
|
||||
to_chat(user, "<span class='warning'>You don't have the dexterity to use [src]!</span>")
|
||||
to_chat(user, span_warning("You don't have the dexterity to use [src]!"))
|
||||
return TRUE
|
||||
|
||||
if(!cell)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have a power cell installed!</span>")
|
||||
to_chat(user, span_warning("[src] doesn't have a power cell installed!"))
|
||||
return TRUE
|
||||
|
||||
if(!cell.charge)
|
||||
to_chat(user, "<span class='warning'>[src]'s battery is dead!</span>")
|
||||
to_chat(user, span_warning("[src]'s battery is dead!"))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
W.play_tool_sound(src)
|
||||
if(!opened)
|
||||
to_chat(user, "<span class='notice'>You unscrew the battery compartment.</span>")
|
||||
to_chat(user, span_notice("You unscrew the battery compartment."))
|
||||
opened = TRUE
|
||||
update_appearance()
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You close the battery compartment.</span>")
|
||||
to_chat(user, span_notice("You close the battery compartment."))
|
||||
opened = FALSE
|
||||
update_appearance()
|
||||
return
|
||||
@@ -78,12 +78,12 @@
|
||||
if(!cell)
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You insert [W] into [src].</span>")
|
||||
to_chat(user, span_notice("You insert [W] into [src]."))
|
||||
cell = W
|
||||
update_appearance()
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[src] already has \a [cell] installed!</span>")
|
||||
to_chat(user, span_warning("[src] already has \a [cell] installed!"))
|
||||
return
|
||||
|
||||
if(cantbeused(user))
|
||||
@@ -105,20 +105,20 @@
|
||||
var/obj/O
|
||||
var/coefficient = 1
|
||||
if(istype(A, /obj/item/gun/energy))
|
||||
to_chat(user, "<span class='alert'>Error unable to interface with device.</span>")
|
||||
to_chat(user, span_alert("Error unable to interface with device."))
|
||||
return FALSE
|
||||
if(istype(A, /obj/item/clothing/suit/space))
|
||||
to_chat(user, "<span class='alert'>Error unable to interface with device.</span>")
|
||||
to_chat(user, span_alert("Error unable to interface with device."))
|
||||
return FALSE
|
||||
if(istype(A, /obj))
|
||||
O = A
|
||||
if(C)
|
||||
var/done_any = FALSE
|
||||
if(C.charge >= C.maxcharge)
|
||||
to_chat(user, "<span class='notice'>[A] is fully charged!</span>")
|
||||
to_chat(user, span_notice("[A] is fully charged!"))
|
||||
recharging = FALSE
|
||||
return TRUE
|
||||
user.visible_message("<span class='notice'>[user] starts recharging [A] with [src].</span>", "<span class='notice'>You start recharging [A] with [src].</span>")
|
||||
user.visible_message(span_notice("[user] starts recharging [A] with [src]."), span_notice("You start recharging [A] with [src]."))
|
||||
while(C.charge < C.maxcharge)
|
||||
if(do_after(user, 10, target = user) && cell.charge)
|
||||
done_any = TRUE
|
||||
@@ -129,7 +129,7 @@
|
||||
else
|
||||
break
|
||||
if(done_any) // Only show a message if we succeeded at least once
|
||||
user.visible_message("<span class='notice'>[user] recharged [A]!</span>", "<span class='notice'>You recharged [A]!</span>")
|
||||
user.visible_message(span_notice("[user] recharged [A]!"), span_notice("You recharged [A]!"))
|
||||
recharging = FALSE
|
||||
return TRUE
|
||||
recharging = FALSE
|
||||
@@ -149,7 +149,7 @@
|
||||
|
||||
/obj/item/inducer/attack_self(mob/user)
|
||||
if(opened && cell)
|
||||
user.visible_message("<span class='notice'>[user] removes [cell] from [src]!</span>", "<span class='notice'>You remove [cell].</span>")
|
||||
user.visible_message(span_notice("[user] removes [cell] from [src]!"), span_notice("You remove [cell]."))
|
||||
cell.update_appearance()
|
||||
user.put_in_hands(cell)
|
||||
cell = null
|
||||
@@ -159,11 +159,11 @@
|
||||
/obj/item/inducer/examine(mob/living/M)
|
||||
. = ..()
|
||||
if(cell)
|
||||
. += "<span class='notice'>Its display shows: [DisplayEnergy(cell.charge)].</span>"
|
||||
. += span_notice("Its display shows: [DisplayEnergy(cell.charge)].")
|
||||
else
|
||||
. += "<span class='notice'>Its display is dark.</span>"
|
||||
. += span_notice("Its display is dark.")
|
||||
if(opened)
|
||||
. += "<span class='notice'>Its battery compartment is open.</span>"
|
||||
. += span_notice("Its battery compartment is open.")
|
||||
|
||||
/obj/item/inducer/update_overlays()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user