Skip to content

Commit

Permalink
Span macros to replace alot of spans (#16820)
Browse files Browse the repository at this point in the history
Co-authored-by: pali <6pali6@gmail.com>
  • Loading branch information
CheffieGithub and pali6 committed Nov 7, 2023
1 parent 62d340d commit 595bec5
Show file tree
Hide file tree
Showing 1,198 changed files with 13,762 additions and 13,709 deletions.
1 change: 1 addition & 0 deletions _std/__std.dme
Expand Up @@ -118,6 +118,7 @@
#include "macros\atom_properties.dm"
#include "macros\area.dm"
#include "macros\atmos.dm"
#include "macros\chat_output.dm"
#include "macros\client.dm"
#include "macros\cooldown.dm"
#include "macros\debug.dm"
Expand Down
51 changes: 51 additions & 0 deletions _std/macros/chat_output.dm
@@ -0,0 +1,51 @@
/* ====== SPAN MACROS ====== */
#define SPAN_ALERT(string) ("<span class='alert'>" + string + "</span>")
#define SPAN_COMBAT(string) ("<span class='combat'>" + string + "</span>")
#define SPAN_NOTICE(string) ("<span class='notice'>" + string + "</span>")
#define SPAN_INTERNAL(string) ("<span class='internal'>" + string + "</span>")
#define SPAN_MEDAL(string) ("<span class='medal'>" + string + "</span>")
#define SPAN_ADMIN(string) ("<span class='admin'>" + string + "</span>")
#define SPAN_SUCCESS(string) ("<span class='success'>" + string + "</span>")
#define SPAN_SUBTLE(string) ("<span class='subtle'>" + string + "</span>")
#define SPAN_NAME(string) ("<span class='name'>" + string + "</span>")
#define SPAN_MESSAGE(string) ("<span class='message'>" + string + "</span>")
#define SPAN_PREFIX(string) ("<span class='prefix'>" + string + "</span>")
#define SPAN_EMOTE(string) ("<span class='emote'>" + string + "</span>")
#define SPAN_VGA(string) ("<span class='vga'>" + string + "</span>")
#define SPAN_HINT(string) ("<span class='hint'>" + string + "</span>")
#define SPAN_SUBTITLE(string) ("<span class='subtitle'>" + string + "</span>")
#define SPAN_GOOD(string) ("<span class='good'>" + string + "</span>")
#define SPAN_BAD(string) ("<span class='bad'>" + string + "</span>")
#define SPAN_BOLD(string) ("<span class='bold'>" + string + "</span>")
#define SPAN_ITALIC(string) ("<span class='italic'>" + string + "</span>")
#define SPAN_FLOCKSAY(string) ("<span class='flocksay'>" + string + "</span>")
#define SPAN_GAME(string) ("<span class='game'>" + string + "</span>")
#define SPAN_BANREASON(string) ("<span class='banreason'>" + string + "</span>")
#define SPAN_TOOLTIPTEXT(string) ("<span class='tooltiptext'>" + string + "</span>")
#define SPAN_PR_NUMBER(string) ("<span class='pr_number'>" + string + "</span>")
#define SPAN_HELPMSG(string) ("<span class='helpmsg'>" + string + "</span>")
#define SPAN_WARNING(string) ("<span class='warning'>" + string + "</span>")
#define SPAN_NOTIFICATION(string) ("<span class='notification'>" + string + "</span>")
#define SPAN_BLOBALERT(string) ("<span class='blobalert'>" + string + "</span>")
#define SPAN_INFO(string) ("<span class='info'>" + string + "</span>")
#define SPAN_REGULAR(string) ("<span class='regular'>" + string + "</span>")
#define SPAN_MONOSPACE(string) ("<span class='monospace'>" + string + "</span>")

#define SPAN_RED(string) ("<span class='red'>" + string + "</span>")
#define SPAN_BLUE(string) ("<span class='blue'>" + string + "</span>")
#define SPAN_GREEN(string) ("<span class='green'>" + string + "</span>")

#define SPAN_RAINBOW(string) ("<span class='rainbow'>" + string + "</span>")

// Intents
#define SPAN_HELP(string) ("<span class='help'>" + string + "</span>")
#define SPAN_DISARM(string) ("<span class='disarm'>" + string + "</span>")
#define SPAN_GRAB(string) ("<span class='grab'>" + string + "</span>")
#define SPAN_HARM(string) ("<span class='harm'>" + string + "</span>")

// OOC / LOOC
#define SPAN_ADMINOOC(string) ("<span class='adminooc'>" + string + "</span>")

// Helps
#define SPAN_MHELP(string) ("<span class='mhelp'>" + string + "</span>")
#define SPAN_AHELP(string) ("<span class='ahelp'>" + string + "</span>")
8 changes: 4 additions & 4 deletions _std/macros/client.dm
Expand Up @@ -5,7 +5,7 @@
/// Returns true if the given is a mind datum
#define ismind(x) istype(x, /datum/mind)

#define ADMIN_ONLY if(!src.holder) {boutput(src, "<span class='admin'>Only administrators may use this command.</span>"); return}
#define DENY_TEMPMIN if(!src.holder || src.holder.tempmin) {boutput(src, "<span class='admin'>Only administrators may use this command.</span>"); return}
#define MENTOR_ONLY if(!src.mentor) {boutput(src, "<span class='admin'>Only mentors may use this command.</span>"); return}
#define USR_ADMIN_ONLY if(usr?.client && !usr.client.holder) {boutput(usr, "<span class='admin'>Only administrators may use this command.</span>"); return}
#define ADMIN_ONLY if(!src.holder) {boutput(src, SPAN_ADMIN("Only administrators may use this command.")); return}
#define DENY_TEMPMIN if(!src.holder || src.holder.tempmin) {boutput(src, SPAN_ADMIN("Only administrators may use this command.")); return}
#define MENTOR_ONLY if(!src.mentor) {boutput(src, SPAN_ADMIN("Only mentors may use this command.")); return}
#define USR_ADMIN_ONLY if(usr?.client && !usr.client.holder) {boutput(usr, SPAN_ADMIN("Only administrators may use this command.")); return}
2 changes: 1 addition & 1 deletion _std/vox.dm
Expand Up @@ -198,7 +198,7 @@ proc/vox_play(var/input, var/user, var/pitch = 1)
if(missingwords.len)
boutput(user, "<b>Input: </b>")
boutput(user, "[input]")
boutput(user, "<b><span class='alert'>Missing VOX words: </span></b>")
boutput(user, SPAN_ALERT("<b>Missing VOX words: </b>"))
for(var/word in missingwords)
boutput(user, "[word]")
var/play = alert("Words missing. Play anyway?","Vox Announcement","Yes","No")
Expand Down
38 changes: 19 additions & 19 deletions code/WorkInProgress/AbilityItem.dm
Expand Up @@ -22,19 +22,19 @@
if (!E.reagents)
return
if (E.reagents.has_reagent(reagent))
boutput(the_mob, "<span class='alert'>The nozzle is clogged!</span>")
boutput(the_mob, SPAN_ALERT("The nozzle is clogged!"))
return

for (var/reagent in E.melting_reagents)
if (!E.reagents)
return
if (E.reagents.has_reagent(reagent))
the_mob.visible_message("<span class='alert'>[E] melts!</span>")
the_mob.visible_message(SPAN_ALERT("[E] melts!"))
make_cleanable(/obj/decal/cleanable/molten_item,get_turf(the_mob))
qdel(E)
return

the_mob.visible_message("<span class='alert'>[the_mob] prepares to spray the contents of the extinguisher all around [himself_or_herself(the_mob)]!</span>")
the_mob.visible_message(SPAN_ALERT("[the_mob] prepares to spray the contents of the extinguisher all around [himself_or_herself(the_mob)]!"))

E.special = 1
the_mob.transforming = 1
Expand Down Expand Up @@ -148,15 +148,15 @@
execute_ability()
var/obj/item/clothing/shoes/magnetic/W = the_item
if(!(the_item in the_mob.get_equipped_items()))
boutput(the_mob, "<span class='alert'>Try wearing [src] first.</span>")
boutput(the_mob, SPAN_ALERT("Try wearing [src] first."))
return

if(W.magnetic)
W.deactivate()
boutput(the_mob, "<span class='hint'>You power off your magnetic boots.</span><br><span class='alert'>You are no longer anchored to the floor.</span>", group = "magbootsoff")
boutput(the_mob, "[SPAN_HINT("You power off your magnetic boots.")]<br>[SPAN_HINT("You are no longer anchored to the floor.")]", group = "magbootsoff")
else
W.activate()
boutput(the_mob, "<span class='hint'>You power on your magnetic boots.</span><br><span class='success'>You are now firmly anchored to the floor, and cannot be moved by pushing or teleportation.</span>", \
boutput(the_mob, "[SPAN_HINT("You power on your magnetic boots.")]<br>[SPAN_SUCCESS("You are now firmly anchored to the floor, and cannot be moved by pushing or teleportation.")]", \
group = "magbootson")
the_mob.update_equipped_modifiers()
the_mob.update_clothing()
Expand Down Expand Up @@ -192,14 +192,14 @@
var/obj/item/clothing/shoes/rocket/R = the_item

if(the_mob:shoes != the_item)
boutput(the_mob, "<span class='alert'>You must be wearing the shoes to use them.</span>")
boutput(the_mob, SPAN_ALERT("You must be wearing the shoes to use them."))
return

R.uses--

if(R.uses < 0)
the_item.name = "Empty Rocket Shoes"
boutput(the_mob, "<span class='alert'>Your rocket shoes are empty.</span>")
boutput(the_mob, SPAN_ALERT("Your rocket shoes are empty."))
the_item.hide_buttons()
R.abilities.Cut()
qdel(src)
Expand All @@ -208,7 +208,7 @@
playsound(the_mob, 'sound/effects/bamf.ogg', 100, TRUE)

if(prob(explosion_chance) || R.emagged)
boutput(the_mob, "<span class='alert'>The rocket shoes blow up!</span>")
boutput(the_mob, SPAN_ALERT("The rocket shoes blow up!"))
explosion(src, get_turf(the_mob), -1, -1, 1, 1)
qdel(the_item)
qdel(src)
Expand Down Expand Up @@ -274,7 +274,7 @@
var/obj/item/clothing/shoes/sonic/R = the_item

if(the_mob:shoes != the_item)
boutput(the_mob, "<span class='alert'>You must be wearing the shoes to use them.</span>")
boutput(the_mob, SPAN_ALERT("You must be wearing the shoes to use them."))
return

playsound(the_mob, 'sound/effects/bamf.ogg', 100, TRUE)
Expand Down Expand Up @@ -332,11 +332,11 @@

execute_ability()
if (!ishuman(usr))
boutput(usr, "<span class='alert'>Only a human can do that.</span>")
boutput(usr, SPAN_ALERT("Only a human can do that."))
return
var/mob/living/carbon/human/H = usr
if (the_item.temp_flags & IS_LIMB_ITEM)
boutput(usr, "<span class='alert'>The saw is already attached as an arm.</span>")
boutput(usr, SPAN_ALERT("The saw is already attached as an arm."))
return
switch (alert(usr, "Which arm would you like to replace with [the_item]?",,"Left","Right","Cancel"))
if ("Cancel")
Expand All @@ -346,14 +346,14 @@
var/obj/item/saw/syndie/S = the_item
S.end_replace_arm("r_arm", H)
return
boutput(H, "<span class='alert'>You need to hold still...</span>")
boutput(H, SPAN_ALERT("You need to hold still..."))
SETUP_GENERIC_ACTIONBAR(H, the_item, 3 SECONDS, /obj/item/saw/syndie/proc/end_replace_arm, list("r_arm", H), the_item.icon, the_item.icon_state,"", INTERRUPT_MOVE | INTERRUPT_STUNNED | INTERRUPT_ACTION)
if ("Left")
if (!H.limbs.l_arm)
var/obj/item/saw/syndie/S = the_item
S.end_replace_arm("l_arm", H)
return
boutput(H, "<span class='alert'>You need to hold still...</span>")
boutput(H, SPAN_ALERT("You need to hold still..."))
SETUP_GENERIC_ACTIONBAR(H, the_item, 3 SECONDS, /obj/item/saw/syndie/proc/end_replace_arm, list("l_arm", H), the_item.icon, the_item.icon_state,"", INTERRUPT_MOVE | INTERRUPT_STUNNED | INTERRUPT_ACTION)
..()

Expand Down Expand Up @@ -535,11 +535,11 @@

ability_allowed()
if (!the_mob || !the_mob.canmove || the_mob.stat || the_mob.getStatusDuration("paralysis"))
boutput(the_mob, "<span class='alert'>You need to be ready on your feet to use this ability.</span>")
boutput(the_mob, SPAN_ALERT("You need to be ready on your feet to use this ability."))
return 0

if(ishuman(the_mob) && the_mob:wear_suit != the_item)
boutput(the_mob, "<span class='alert'>You must be wearing [the_item] to use this ability.</span>")
boutput(the_mob, SPAN_ALERT("You must be wearing [the_item] to use this ability."))
return 0

if(!..())
Expand Down Expand Up @@ -923,7 +923,7 @@
if (H.restrained())
return 0
if (src.last_use_time && src.cooldown && ( src.last_use_time + cooldown ) > TIME)
boutput(src.the_mob, "<span class='alert'>This ability is recharging. ([round((src.cooldown/10)-((TIME - src.last_use_time)/10))] seconds left)</span>")
boutput(src.the_mob, SPAN_ALERT("This ability is recharging. ([round((src.cooldown/10)-((TIME - src.last_use_time)/10))] seconds left)"))
return 0
return 1

Expand Down Expand Up @@ -956,12 +956,12 @@
var/mob/living/carbon/human/H = the_mob
bandana.is_pulled_down = !bandana.is_pulled_down
if (bandana.is_pulled_down)
boutput(H, "<span class='notice'>You pull down [bandana].</span>")
boutput(H, SPAN_NOTICE("You pull down [bandana]."))
bandana.see_face = TRUE
bandana.c_flags ^= COVERSMOUTH
src.icon_state = "bandana_up"
else
boutput(H, "<span class='notice'>You pull up [bandana].</span>")
boutput(H, SPAN_NOTICE("You pull up [bandana]."))
bandana.see_face = FALSE
bandana.c_flags |= COVERSMOUTH
src.icon_state = "bandana_down"
Expand Down
6 changes: 3 additions & 3 deletions code/WorkInProgress/AphsStuff.dm
Expand Up @@ -83,15 +83,15 @@
if(!ai) return
if (istype(W, /obj/item/aiboss_tape/))
if(src.loaded)
boutput(user, "<span class='alert'>There's already a tape inside!</span>")
boutput(user, SPAN_ALERT("There's already a tape inside!"))
return

if(!ai.on)
src.visible_message("[user] prods the databank's tape slot with [W]. Nothing happens.",1)
return

else if(!ai.ready_for_tapes)
boutput(user, "<span class='alert'>The databank refuses to load the tape!</span>")
boutput(user, SPAN_ALERT("The databank refuses to load the tape!"))
return
user.u_equip(W)
W.set_loc(src)
Expand Down Expand Up @@ -145,7 +145,7 @@
if (!O.client)
continue
ehjax.send(O.client, "browseroutput", list("dectalk" = audio["audio"]))
src.audible_message("<span class='game say'><span class='name'>[src]</span> beeps, \"[message]\"")
src.audible_message("<span class='game say'>[SPAN_NAME("[src]")] beeps, \"[message]\"")
return

attackby(obj/item/W, mob/living/user)
Expand Down
16 changes: 8 additions & 8 deletions code/WorkInProgress/AzrunStuff.dm
Expand Up @@ -236,9 +236,9 @@
heart_ticker = max(heart_ticker--,0)
if(heart_ticker & prob(50))
if(prob(30))
boutput(src.owner,"<span class='alert'>You feel as though something moving towards your heart... That can't be good.</span>")
boutput(src.owner,SPAN_ALERT("You feel as though something moving towards your heart... That can't be good."))
else
boutput(src.owner,"<span class='alert'>You feel as though something is working its way through your chest.</span>")
boutput(src.owner,SPAN_ALERT("You feel as though something is working its way through your chest."))
else if(!heart_ticker)
var/mob/living/carbon/human/H = src.owner
if(istype(H))
Expand All @@ -247,11 +247,11 @@
src.owner.TakeDamage("All", 2, 0)

if(prob(5))
boutput(src.owner,"<span class='alert'>AAHRRRGGGG something is trying to dig your heart out from the inside?!?!</span>")
boutput(src.owner,SPAN_ALERT("AAHRRRGGGG something is trying to dig your heart out from the inside?!?!"))
src.owner.emote("scream")
src.owner.changeStatus("stunned", 2 SECONDS)
else if(prob(10))
boutput(src.owner,"<span class='alert'>You feel a sharp pain in your chest.</span>")
boutput(src.owner,SPAN_ALERT("You feel a sharp pain in your chest."))

/datum/gimmick_event
var/interaction = 0
Expand Down Expand Up @@ -640,7 +640,7 @@
var/mob/possible_target = target
if(possible_target.client)
if (!locate(/obj/item/device/pda2) in possible_target)
boutput(ai_holder.owner, "<span class='alert'>Target does not have a PDA to use to assist!</span>")
boutput(ai_holder.owner, SPAN_ALERT("Target does not have a PDA to use to assist!"))
return 1

assisted = target
Expand All @@ -649,10 +649,10 @@
ai_holder.owner.targeting_ability = src
ai_holder.owner.set_cursor('icons/cursors/point.dmi')
ai_holder.updateButtons()
boutput(ai_holder.owner, "<span class='notice'>Select a destination for your target!</span>")
boutput(ai_holder.owner, SPAN_NOTICE("Select a destination for your target!"))
return 1
else
boutput(ai_holder.owner, "<span class='alert'>Not a valid target to assist!</span>")
boutput(ai_holder.owner, SPAN_ALERT("Not a valid target to assist!"))
return 1


Expand Down Expand Up @@ -937,7 +937,7 @@ ADMIN_INTERACT_PROCS(/turf/unsimulated/floor, proc/sunset, proc/sunrise, proc/se
thingsneeded -= 1

if (thingsneeded > 0)//craft successful, but they'll need more
boutput(user, "<span class='notice'>You carefully pour some of [craftingitem] into \the [frame]. You feel like you'll need more to fill all the shells. </span>")
boutput(user, SPAN_NOTICE("You carefully pour some of [craftingitem] into \the [frame]. You feel like you'll need more to fill all the shells. "))

if (thingsneeded <= 0) //check completion and produce shells as needed
var/obj/item/ammo/bullets/shot = new src.result(get_turf(frame))
Expand Down

0 comments on commit 595bec5

Please sign in to comment.