mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 23:58:07 +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:
@@ -33,7 +33,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
source = /datum/robot_energy_storage/glass
|
||||
|
||||
/obj/item/stack/sheet/glass/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins to slice [user.p_their()] neck with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] begins to slice [user.p_their()] neck with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/stack/sheet/glass/fifty
|
||||
@@ -52,7 +52,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
return
|
||||
CC.use(5)
|
||||
use(1)
|
||||
to_chat(user, "<span class='notice'>You attach wire to the [name].</span>")
|
||||
to_chat(user, span_notice("You attach wire to the [name]."))
|
||||
var/obj/item/stack/light_w/new_tile = new(user.loc)
|
||||
new_tile.add_fingerprint(user)
|
||||
return
|
||||
@@ -67,7 +67,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
if(QDELETED(src) && replace)
|
||||
user.put_in_hands(RG)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one rod and one sheet of glass to make reinforced glass!</span>")
|
||||
to_chat(user, span_warning("You need one rod and one sheet of glass to make reinforced glass!"))
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -112,7 +112,7 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( \
|
||||
if(QDELETED(src) && replace)
|
||||
user.put_in_hands(RG)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one rod and one sheet of plasma glass to make reinforced plasma glass!</span>")
|
||||
to_chat(user, span_warning("You need one rod and one sheet of plasma glass to make reinforced plasma glass!"))
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
@@ -267,7 +267,7 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
|
||||
|
||||
|
||||
/obj/item/shard/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is slitting [user.p_their()] [pick("wrists", "throat")] with the shard of glass! It looks like [user.p_theyre()] trying to commit suicide.</span>")
|
||||
user.visible_message(span_suicide("[user] is slitting [user.p_their()] [pick("wrists", "throat")] with the shard of glass! It looks like [user.p_theyre()] trying to commit suicide."))
|
||||
return (BRUTELOSS)
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(!H.gloves && !HAS_TRAIT(H, TRAIT_PIERCEIMMUNE)) // golems, etc
|
||||
to_chat(H, "<span class='warning'>[src] cuts into your hand!</span>")
|
||||
to_chat(H, span_warning("[src] cuts into your hand!"))
|
||||
H.apply_damage(force*0.5, BRUTE, hit_hand)
|
||||
|
||||
/obj/item/shard/attackby(obj/item/I, mob/user, params)
|
||||
@@ -325,11 +325,11 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
|
||||
L.attackby(src, user)
|
||||
else if(istype(I, /obj/item/stack/sheet/cloth))
|
||||
var/obj/item/stack/sheet/cloth/C = I
|
||||
to_chat(user, "<span class='notice'>You begin to wrap the [C] around the [src]...</span>")
|
||||
to_chat(user, span_notice("You begin to wrap the [C] around the [src]..."))
|
||||
if(do_after(user, 35, target = src))
|
||||
var/obj/item/kitchen/knife/shiv/S = new /obj/item/kitchen/knife/shiv
|
||||
C.use(1)
|
||||
to_chat(user, "<span class='notice'>You wrap the [C] around the [src] forming a makeshift weapon.</span>")
|
||||
to_chat(user, span_notice("You wrap the [C] around the [src] forming a makeshift weapon."))
|
||||
remove_item_from_storage(src)
|
||||
qdel(src)
|
||||
user.put_in_hands(S)
|
||||
@@ -347,7 +347,7 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
|
||||
if(G.amount >= G.max_amount)
|
||||
continue
|
||||
G.attackby(NG, user)
|
||||
to_chat(user, "<span class='notice'>You add the newly-formed [NG.name] to the stack. It now contains [NG.amount] sheet\s.</span>")
|
||||
to_chat(user, span_notice("You add the newly-formed [NG.name] to the stack. It now contains [NG.amount] sheet\s."))
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
merge_type = /obj/item/stack/sheet/hot_ice
|
||||
|
||||
/obj/item/stack/sheet/hot_ice/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins licking \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] begins licking \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return FIRELOSS//dont you kids know that stuff is toxic?
|
||||
|
||||
@@ -251,9 +251,9 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \
|
||||
/obj/item/stack/sheet/animalhide/attackby(obj/item/W, mob/user, params)
|
||||
if(W.get_sharpness())
|
||||
playsound(loc, 'sound/weapons/slice.ogg', 50, TRUE, -1)
|
||||
user.visible_message("<span class='notice'>[user] starts cutting hair off \the [src].</span>", "<span class='notice'>You start cutting the hair off \the [src]...</span>", "<span class='hear'>You hear the sound of a knife rubbing against flesh.</span>")
|
||||
user.visible_message(span_notice("[user] starts cutting hair off \the [src]."), span_notice("You start cutting the hair off \the [src]..."), span_hear("You hear the sound of a knife rubbing against flesh."))
|
||||
if(do_after(user, 50, target = src))
|
||||
to_chat(user, "<span class='notice'>You cut the hair from this [src.singular_name].</span>")
|
||||
to_chat(user, span_notice("You cut the hair from this [src.singular_name]."))
|
||||
new /obj/item/stack/sheet/hairlesshide(user.drop_location(), 1)
|
||||
use(1)
|
||||
else
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
var/obj/item/stack/sheet/iron/M = O
|
||||
if (M.use(1))
|
||||
var/obj/item/L = new /obj/item/stack/tile/light(user.drop_location())
|
||||
to_chat(user, "<span class='notice'>You make a light tile.</span>")
|
||||
to_chat(user, span_notice("You make a light tile."))
|
||||
L.add_fingerprint(user)
|
||||
use(1)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one iron sheet to finish the light tile!</span>")
|
||||
to_chat(user, span_warning("You need one iron sheet to finish the light tile!"))
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \
|
||||
/obj/item/emptysandbag/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/stack/ore/glass))
|
||||
var/obj/item/stack/ore/glass/G = W
|
||||
to_chat(user, "<span class='notice'>You fill the sandbag.</span>")
|
||||
to_chat(user, span_notice("You fill the sandbag."))
|
||||
var/obj/item/stack/sheet/mineral/sandbags/I = new /obj/item/stack/sheet/mineral/sandbags(drop_location())
|
||||
qdel(src)
|
||||
if (Adjacent(user) && !issilicon(user))
|
||||
@@ -163,7 +163,7 @@ GLOBAL_LIST_INIT(uranium_recipes, list ( \
|
||||
walltype = /turf/closed/wall/mineral/plasma
|
||||
|
||||
/obj/item/stack/sheet/mineral/plasma/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins licking \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] begins licking \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return TOXLOSS//dont you kids know that stuff is toxic?
|
||||
|
||||
GLOBAL_LIST_INIT(plasma_recipes, list ( \
|
||||
|
||||
@@ -154,7 +154,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
|
||||
. += GLOB.metal_recipes
|
||||
|
||||
/obj/item/stack/sheet/iron/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins whacking [user.p_them()]self over the head with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] begins whacking [user.p_them()]self over the head with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return BRUTELOSS
|
||||
|
||||
/*
|
||||
@@ -489,13 +489,13 @@ GLOBAL_LIST_INIT(cardboard_recipes, list ( \
|
||||
var/atom/droploc = drop_location()
|
||||
if(use(1))
|
||||
playsound(I, 'sound/items/bikehorn.ogg', 50, TRUE, -1)
|
||||
to_chat(user, "<span class='notice'>You stamp the cardboard! It's a clown box! Honk!</span>")
|
||||
to_chat(user, span_notice("You stamp the cardboard! It's a clown box! Honk!"))
|
||||
if (amount >= 0)
|
||||
new/obj/item/storage/box/clown(droploc) //bugfix
|
||||
if(istype(I, /obj/item/stamp/chameleon) && !istype(loc, /obj/item/storage))
|
||||
var/atom/droploc = drop_location()
|
||||
if(use(1))
|
||||
to_chat(user, "<span class='notice'>You stamp the cardboard in a sinister way.</span>")
|
||||
to_chat(user, span_notice("You stamp the cardboard in a sinister way."))
|
||||
if (amount >= 0)
|
||||
new/obj/item/storage/box/syndie_kit(droploc)
|
||||
else
|
||||
@@ -532,12 +532,12 @@ GLOBAL_LIST_INIT(runed_metal_recipes, list ( \
|
||||
|
||||
/obj/item/stack/sheet/runed_metal/attack_self(mob/living/user)
|
||||
if(!IS_CULTIST(user))
|
||||
to_chat(user, "<span class='warning'>Only one with forbidden knowledge could hope to work this metal...</span>")
|
||||
to_chat(user, span_warning("Only one with forbidden knowledge could hope to work this metal..."))
|
||||
return
|
||||
var/turf/T = get_turf(user) //we may have moved. adjust as needed...
|
||||
var/area/A = get_area(user)
|
||||
if((!is_station_level(T.z) && !is_mining_level(T.z)) || (A && !(A.area_flags & CULT_PERMITTED)))
|
||||
to_chat(user, "<span class='warning'>The veil is not weak enough here.</span>")
|
||||
to_chat(user, span_warning("The veil is not weak enough here."))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -42,6 +42,6 @@
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_BOOP)
|
||||
playsound(src, "shatter", 70, TRUE)
|
||||
use(1)
|
||||
user.visible_message("<span class='notice'>[user] shatters the sheet of [name] on the floor, leaving [english_list(shards)].</span>", \
|
||||
"<span class='notice'>You shatter the sheet of [name] on the floor, leaving [english_list(shards)].</span>")
|
||||
user.visible_message(span_notice("[user] shatters the sheet of [name] on the floor, leaving [english_list(shards)]."), \
|
||||
span_notice("You shatter the sheet of [name] on the floor, leaving [english_list(shards)]."))
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user