mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +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:
@@ -114,7 +114,7 @@
|
||||
|
||||
/obj/item/stack/grind_requirements()
|
||||
if(is_cyborg)
|
||||
to_chat(usr, "<span class='warning'>[src] is electronically synthesized in your chassis and can't be ground up!</span>")
|
||||
to_chat(usr, span_warning("[src] is electronically synthesized in your chassis and can't be ground up!"))
|
||||
return
|
||||
return TRUE
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
. += "There are [get_amount()] in the stack."
|
||||
else
|
||||
. += "There is [get_amount()] in the stack."
|
||||
. += "<span class='notice'><b>Right-click</b> with an empty hand to take a custom amount.</span>"
|
||||
. += span_notice("<b>Right-click</b> with an empty hand to take a custom amount.")
|
||||
|
||||
/obj/item/stack/proc/get_amount()
|
||||
if(is_cyborg)
|
||||
@@ -254,7 +254,7 @@
|
||||
return
|
||||
if(recipe.time)
|
||||
var/adjusted_time = 0
|
||||
usr.visible_message("<span class='notice'>[usr] starts building \a [recipe.title].</span>", "<span class='notice'>You start building \a [recipe.title]...</span>")
|
||||
usr.visible_message(span_notice("[usr] starts building \a [recipe.title]."), span_notice("You start building \a [recipe.title]..."))
|
||||
if(HAS_TRAIT(usr, recipe.trait_booster))
|
||||
adjusted_time = (recipe.time * recipe.trait_modifier)
|
||||
else
|
||||
@@ -312,9 +312,9 @@
|
||||
/obj/item/stack/proc/building_checks(datum/stack_recipe/recipe, multiplier)
|
||||
if (get_amount() < recipe.req_amount*multiplier)
|
||||
if (recipe.req_amount*multiplier>1)
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [recipe.req_amount*multiplier] [recipe.title]\s!</span>")
|
||||
to_chat(usr, span_warning("You haven't got enough [src] to build \the [recipe.req_amount*multiplier] [recipe.title]\s!"))
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [recipe.title]!</span>")
|
||||
to_chat(usr, span_warning("You haven't got enough [src] to build \the [recipe.title]!"))
|
||||
return FALSE
|
||||
var/turf/dest_turf = get_turf(usr)
|
||||
|
||||
@@ -322,16 +322,16 @@
|
||||
if(ispath(recipe.result_type, /obj/structure/window))
|
||||
var/obj/structure/window/result_path = recipe.result_type
|
||||
if(!valid_window_location(dest_turf, usr.dir, is_fulltile = initial(result_path.fulltile)))
|
||||
to_chat(usr, "<span class='warning'>The [recipe.title] won't fit here!</span>")
|
||||
to_chat(usr, span_warning("The [recipe.title] won't fit here!"))
|
||||
return FALSE
|
||||
|
||||
if(recipe.one_per_turf && (locate(recipe.result_type) in dest_turf))
|
||||
to_chat(usr, "<span class='warning'>There is another [recipe.title] here!</span>")
|
||||
to_chat(usr, span_warning("There is another [recipe.title] here!"))
|
||||
return FALSE
|
||||
|
||||
if(recipe.on_floor)
|
||||
if(!isfloorturf(dest_turf))
|
||||
to_chat(usr, "<span class='warning'>\The [recipe.title] must be constructed on the floor!</span>")
|
||||
to_chat(usr, span_warning("\The [recipe.title] must be constructed on the floor!"))
|
||||
return FALSE
|
||||
|
||||
for(var/obj/object in dest_turf)
|
||||
@@ -344,7 +344,7 @@
|
||||
if(!window_structure.fulltile)
|
||||
continue
|
||||
if(object.density || NO_BUILD & object.obj_flags)
|
||||
to_chat(usr, "<span class='warning'>There is \a [object.name] here. You can\'t make \a [recipe.title] here!</span>")
|
||||
to_chat(usr, span_warning("There is \a [object.name] here. You can\'t make \a [recipe.title] here!"))
|
||||
return FALSE
|
||||
if(recipe.placement_checks)
|
||||
switch(recipe.placement_checks)
|
||||
@@ -353,11 +353,11 @@
|
||||
for(var/direction in GLOB.cardinals)
|
||||
step = get_step(dest_turf, direction)
|
||||
if(locate(recipe.result_type) in step)
|
||||
to_chat(usr, "<span class='warning'>\The [recipe.title] must not be built directly adjacent to another!</span>")
|
||||
to_chat(usr, span_warning("\The [recipe.title] must not be built directly adjacent to another!"))
|
||||
return FALSE
|
||||
if(STACK_CHECK_ADJACENT)
|
||||
if(locate(recipe.result_type) in range(1, dest_turf))
|
||||
to_chat(usr, "<span class='warning'>\The [recipe.title] must be constructed at least one tile away from others of its type!</span>")
|
||||
to_chat(usr, span_warning("\The [recipe.title] must be constructed at least one tile away from others of its type!"))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -381,11 +381,11 @@
|
||||
if(get_amount() < amount)
|
||||
if(singular_name)
|
||||
if(amount > 1)
|
||||
to_chat(user, "<span class='warning'>You need at least [amount] [singular_name]\s to do this!</span>")
|
||||
to_chat(user, span_warning("You need at least [amount] [singular_name]\s to do this!"))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need at least [amount] [singular_name] to do this!</span>")
|
||||
to_chat(user, span_warning("You need at least [amount] [singular_name] to do this!"))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need at least [amount] to do this!</span>")
|
||||
to_chat(user, span_warning("You need at least [amount] to do this!"))
|
||||
|
||||
return FALSE
|
||||
|
||||
@@ -473,7 +473,7 @@
|
||||
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
|
||||
return SECONDARY_ATTACK_CONTINUE_CHAIN
|
||||
split_stack(user, stackmaterial)
|
||||
to_chat(user, "<span class='notice'>You take [stackmaterial] sheets out of the stack.</span>")
|
||||
to_chat(user, span_notice("You take [stackmaterial] sheets out of the stack."))
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/** Splits the stack into two stacks.
|
||||
@@ -499,7 +499,7 @@
|
||||
if(can_merge(W))
|
||||
var/obj/item/stack/S = W
|
||||
if(merge(S))
|
||||
to_chat(user, "<span class='notice'>Your [S.name] stack now contains [S.get_amount()] [S.singular_name]\s.</span>")
|
||||
to_chat(user, span_notice("Your [S.name] stack now contains [S.get_amount()] [S.singular_name]\s."))
|
||||
else
|
||||
. = ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user