Text() away (#19850)

Refactored all the builtin text procs to use string interpolation
instead.
Added a linting for the above.

This is based on, and should only be merged after, #19847
This commit is contained in:
Fluffy
2024-09-21 14:46:31 +02:00
committed by GitHub
parent 1aeeb6827d
commit 8f9de7c3e2
76 changed files with 351 additions and 264 deletions
+2 -2
View File
@@ -431,8 +431,8 @@ var/list/slot_equipment_priority = list( \
var/start_T_descriptor = "<font color='#6b5d00'>tile at [start_T.x], [start_T.y], [start_T.z] in area [get_area(start_T)]</font>"
var/end_T_descriptor = "<font color='#6b4400'>tile at [end_T.x], [end_T.y], [end_T.z] in area [get_area(end_T)]</font>"
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been thrown by [usr.name] ([usr.ckey]) from [start_T_descriptor] with the target [end_T_descriptor]</font>")
usr.attack_log += text("\[[time_stamp()]\] <span class='warning'>Has thrown [M.name] ([M.ckey]) from [start_T_descriptor] with the target [end_T_descriptor]</span>")
M.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been thrown by [usr.name] ([usr.ckey]) from [start_T_descriptor] with the target [end_T_descriptor]</font>"
usr.attack_log += "\[[time_stamp()]\] <span class='warning'>Has thrown [M.name] ([M.ckey]) from [start_T_descriptor] with the target [end_T_descriptor]</span>"
msg_admin_attack("[usr.name] ([usr.ckey]) has thrown [M.name] ([M.ckey]) from [start_T_descriptor] with the target [end_T_descriptor] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[usr.x];Y=[usr.y];Z=[usr.z]'>JMP</a>)",ckey=key_name(usr),ckey_target=key_name(M))
qdel(G)
@@ -565,7 +565,7 @@
show_inv(machine)
if (href_list["mach_close"])
var/t1 = text("window=[]", href_list["mach_close"])
var/t1 = "window=[href_list["mach_close"]]"
unset_machine()
src << browse(null, t1)
@@ -673,10 +673,10 @@
return
if(istype(usr,/mob/living/carbon/human))
var/mob/living/carbon/human/U = usr
R.security.comments += text("Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]")
R.security.comments += "Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]"
if(istype(usr,/mob/living/silicon/robot))
var/mob/living/silicon/robot/U = usr
R.security.comments += text("Made by [U.name] ([U.mod_type] [U.braintype]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]")
R.security.comments += "Made by [U.name] ([U.mod_type] [U.braintype]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]"
if (href_list["medical"])
if(hasHUD(usr,"medical"))
@@ -774,10 +774,10 @@
return
if(ishuman(usr))
var/mob/living/carbon/human/U = usr
R.medical.comments += text("Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]")
R.medical.comments += "Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]"
if(isrobot(usr))
var/mob/living/silicon/robot/U = usr
R.medical.comments += text("Made by [U.name] ([U.mod_type] [U.braintype]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]")
R.medical.comments += "Made by [U.name] ([U.mod_type] [U.braintype]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]"
if(href_list["triagetag"])
if(hasHUD(usr, "medical"))
@@ -47,8 +47,8 @@
if(G.cell.charge >= 2500)
G.cell.use(G.cell.charge) //So it drains the cell.
visible_message(SPAN_DANGER("[src] has been touched with the stun gloves by [M]!"))
M.attack_log += text("\[[time_stamp()]\] <span class='warning'>Stungloved [src.name] ([src.ckey])</span>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been stungloved by [M.name] ([M.ckey])</font>")
M.attack_log += "\[[time_stamp()]\] <span class='warning'>Stungloved [src.name] ([src.ckey])</span>"
src.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been stungloved by [M.name] ([M.ckey])</font>"
msg_admin_attack("[key_name_admin(M)] stungloved [src.name] ([src.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[M.x];Y=[M.y];Z=[M.z]'>JMP</a>)",ckey=key_name(M),ckey_target=key_name(src))
@@ -248,8 +248,8 @@
H.visible_message(SPAN_DANGER("[attack_message]"))
playsound(loc, ((miss_type) ? (miss_type == 1 ? attack.miss_sound : 'sound/weapons/thudswoosh.ogg') : attack.attack_sound), 25, 1, -1)
H.attack_log += text("\[[time_stamp()]\] <span class='warning'>[miss_type ? (miss_type == 1 ? "Missed" : "Blocked") : "[pick(attack.attack_verb)]"] [src.name] ([src.ckey])</span>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>[miss_type ? (miss_type == 1 ? "Was missed by" : "Has blocked") : "Has Been [pick(attack.attack_verb)]"] by [H.name] ([H.ckey])</font>")
H.attack_log += "\[[time_stamp()]\] <span class='warning'>[miss_type ? (miss_type == 1 ? "Missed" : "Blocked") : "[pick(attack.attack_verb)]"] [src.name] ([src.ckey])</span>"
src.attack_log += "\[[time_stamp()]\] <font color='orange'>[miss_type ? (miss_type == 1 ? "Was missed by" : "Has blocked") : "Has Been [pick(attack.attack_verb)]"] by [H.name] ([H.ckey])</font>"
msg_admin_attack("[key_name(H)] [miss_type ? (miss_type == 1 ? "has missed" : "was blocked by") : "has [pick(attack.attack_verb)]"] [key_name(src)] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[H.x];Y=[H.y];Z=[H.z]'>JMP</a>)",ckey=key_name(H),ckey_target=key_name(src))
if(miss_type)
@@ -335,8 +335,8 @@
return FALSE
M.nutrition = Clamp(M.nutrition - disarm_cost, 0, M.max_nutrition)
M.attack_log += text("\[[time_stamp()]\] <span class='warning'>Disarmed [src.name] ([src.ckey])</span>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been disarmed by [M.name] ([M.ckey])</font>")
M.attack_log += "\[[time_stamp()]\] <span class='warning'>Disarmed [src.name] ([src.ckey])</span>"
src.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been disarmed by [M.name] ([M.ckey])</font>"
msg_admin_attack("[key_name(M)] disarmed [src.name] ([src.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[M.x];Y=[M.y];Z=[M.z]'>JMP</a>)",ckey=key_name(M),ckey_target=key_name(src))
M.do_attack_animation(src)
@@ -546,8 +546,8 @@
if(!damage)
return
user.attack_log += text("\[[time_stamp()]\] <span class='warning'>attacked [src.name] ([src.ckey])</span>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>was attacked by [user.name] ([user.ckey])</font>")
user.attack_log += "\[[time_stamp()]\] <span class='warning'>attacked [src.name] ([src.ckey])</span>"
src.attack_log += "\[[time_stamp()]\] <font color='orange'>was attacked by [user.name] ([user.ckey])</font>"
user.do_attack_animation(src)
if(damage < 15 && check_shields(damage, null, user, null, "\the [user]"))
return
@@ -382,8 +382,8 @@ emp_act
var/mob/M = O.throwing?.thrower?.resolve()
var/client/assailant = M.client
if(assailant)
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been hit with a [O], thrown by [M.name] ([assailant.ckey])</font>")
M.attack_log += text("\[[time_stamp()]\] <span class='warning'>Hit [src.name] ([src.ckey]) with a thrown [O]</span>")
src.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been hit with a [O], thrown by [M.name] ([assailant.ckey])</font>"
M.attack_log += "\[[time_stamp()]\] <span class='warning'>Hit [src.name] ([src.ckey]) with a thrown [O]</span>"
if(!istype(src,/mob/living/simple_animal/rat))
msg_admin_attack("[src.name] ([src.ckey]) was hit by a [O], thrown by [M.name] ([assailant.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[src.x];Y=[src.y];Z=[src.z]'>JMP</a>)",ckey=key_name(M),ckey_target=key_name(src))
@@ -3,7 +3,7 @@
return FALSE
if(user.incapacitated() || !user.Adjacent(src))
user << browse(null, text("window=mob[src.name]"))
user << browse(null, "window=mob[src.name]")
return FALSE
if(ishuman(user))
@@ -134,8 +134,8 @@
if (suit.has_sensor >= 2)
to_chat(user, SPAN_WARNING("\The [src]'s suit sensor controls are locked."))
return
attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their sensors toggled by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <span class='warning'>Attempted to toggle [name]'s ([ckey]) sensors</span>")
attack_log += "\[[time_stamp()]\] <font color='orange'>Has had their sensors toggled by [user.name] ([user.ckey])</font>"
user.attack_log += "\[[time_stamp()]\] <span class='warning'>Attempted to toggle [name]'s ([ckey]) sensors</span>"
suit.set_sensors(user)
// Remove all splints.
@@ -127,7 +127,7 @@
health = maxHealth
amount_grown = 0
regenerate_icons()
name = text("[colour] [is_adult ? "adult" : "baby"] slime ([number])")
name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])"
real_name = name
set_content(TRUE)
addtimer(CALLBACK(src, PROC_REF(set_content), FALSE), 1200) // You get two minutes of safety
+4 -4
View File
@@ -193,8 +193,8 @@
var/mob/M = O.throwing?.thrower?.resolve()
var/client/assailant = M.client
if(assailant)
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been hit with a [O], thrown by [M.name] ([assailant.ckey])</font>")
M.attack_log += text("\[[time_stamp()]\] <span class='warning'>Hit [src.name] ([src.ckey]) with a thrown [O]</span>")
src.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been hit with a [O], thrown by [M.name] ([assailant.ckey])</font>"
M.attack_log += "\[[time_stamp()]\] <span class='warning'>Hit [src.name] ([src.ckey]) with a thrown [O]</span>"
if(!istype(src,/mob/living/simple_animal/rat))
msg_admin_attack("[src.name] ([src.ckey]) was hit by a [O], thrown by [M.name] ([assailant.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[src.x];Y=[src.y];Z=[src.z]'>JMP</a>)",ckey=key_name(M),ckey_target=key_name(src))
@@ -261,8 +261,8 @@
if(!damage)
return
user.attack_log += text("\[[time_stamp()]\] <span class='warning'>attacked [src.name] ([src.ckey])</span>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'>was attacked by [user.name] ([user.ckey])</font>")
user.attack_log += "\[[time_stamp()]\] <span class='warning'>attacked [src.name] ([src.ckey])</span>"
src.attack_log += "\[[time_stamp()]\] <font color='orange'>was attacked by [user.name] ([user.ckey])</font>"
if (attack_message)
src.visible_message(SPAN_DANGER("[user] has [attack_message] [src]!"))
user.do_attack_animation(src)
+2 -2
View File
@@ -517,7 +517,7 @@ var/list/ai_verbs_default = list(
if (href_list["mach_close"])
if (href_list["mach_close"] == "aialerts")
view_alerts = 0
var/t1 = text("window=[]", href_list["mach_close"])
var/t1 = "window=[href_list["mach_close"]]"
unset_machine()
src << browse(null, t1)
if (href_list["switchcamera"])
@@ -546,7 +546,7 @@ var/list/ai_verbs_default = list(
to_chat(src, SPAN_NOTICE("Unable to locate visual entry."))
return
var/info = cameraRecords[entry]
src << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", info[1], info[2]), text("window=[]", html_encode(info[1])))
src << browse("<HTML><HEAD><TITLE>[info[1]]</TITLE></HEAD><BODY><TT>[info[2]]</TT></BODY></HTML>", "window=[html_encode(info[1])]")
return
return
@@ -197,11 +197,11 @@
for(var/O in module.modules)
var/module_string = ""
if(!O)
module_string += text("<B>Resource depleted</B><BR>")
module_string +="<B>Resource depleted</B><BR>"
else if(activated(O))
module_string += text("[O]: <B>Activated</B><BR>")
module_string += "[O]: <B>Activated</B><BR>"
else
module_string += text("[O]: <A HREF=?src=[REF(src)];act=[REF(O)]>Activate</A><BR>")
module_string += "[O]: <A HREF=?src=[REF(src)];act=[REF(O)]>Activate</A><BR>"
var/obj/item/I = O
if((istype(I, /obj/item) || istype(I, /obj/item/device)) && !(I.iscoil()))
@@ -213,11 +213,11 @@
if(emagged)
if(!module.emag)
dat += text("<B>Resource depleted</B><BR>")
dat += "<B>Resource depleted</B><BR>"
else if(activated(module.emag))
dat += text("[module.emag]: <B>Activated</B><BR>")
dat += "[module.emag]: <B>Activated</B><BR>"
else
dat += text("[module.emag]: <A HREF=?src=[REF(src)];act=[REF(module.emag)]>Activate</A><BR>")
dat += "[module.emag]: <A HREF=?src=[REF(src)];act=[REF(module.emag)]>Activate</A><BR>"
dat += resources
@@ -878,21 +878,21 @@
for(var/obj in module.modules)
if(!obj)
dat += text("<B>Resource depleted</B><BR>")
dat += "<B>Resource depleted</B><BR>"
else if(activated(obj))
dat += text("[obj]: <B>Activated</B><BR>")
dat += "[obj]: <B>Activated</B><BR>"
else
dat += text("[obj]: <A HREF=?src=[REF(src)];act=[REF(obj)]>Activate</A><BR>")
dat += "[obj]: <A HREF=?src=[REF(src)];act=[REF(obj)]>Activate</A><BR>"
if(emagged)
if(activated(module.emag))
dat += text("[module.emag]: <B>Activated</B><BR>")
dat += "[module.emag]: <B>Activated</B><BR>"
else
dat += text("[module.emag]: <A HREF=?src=[REF(src)];act=[REF(module.emag)]>Activate</A><BR>")
dat += "[module.emag]: <A HREF=?src=[REF(src)];act=[REF(module.emag)]>Activate</A><BR>"
if(malf_AI_module)
if(activated(module.malf_AI_module))
dat += text("[module.malf_AI_module]: <B>Activated</B><BR>")
dat += "[module.malf_AI_module]: <B>Activated</B><BR>"
else
dat += text("[module.malf_AI_module]: <A HREF=?src=[REF(src)];act=[REF(module.malf_AI_module)]>Activate</A><BR>")
dat += "[module.malf_AI_module]: <A HREF=?src=[REF(src)];act=[REF(module.malf_AI_module)]>Activate</A><BR>"
src << browse(dat, "window=robotmod")
@@ -26,8 +26,8 @@
to_chat(user, SPAN_WARNING("This being is corrupted by an alien intelligence and cannot be soul trapped."))
return..()
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their soul captured with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <span class='warning'>Used the [src.name] to capture the soul of [M.name] ([M.ckey])</span>")
M.attack_log += "\[[time_stamp()]\] <font color='orange'>Has had their soul captured with [src.name] by [user.name] ([user.ckey])</font>"
user.attack_log += "\[[time_stamp()]\] <span class='warning'>Used the [src.name] to capture the soul of [M.name] ([M.ckey])</span>"
msg_admin_attack("[user.name] ([user.ckey]) used the [src.name] to capture the soul of [M.name] ([M.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(src),ckey_target=key_name(M))
transfer_soul("VICTIM", M, user)
@@ -136,7 +136,7 @@
else
dat += "<br><b>Headset:</b> <a href='?src=[REF(src)];add_inv=ears'>Nothing</a>"
user << browse(dat, text("window=mob[];size=325x500", name))
user << browse(dat, "window=mob[name];size=325x500")
onclose(user, "mob[real_name]")
return
+3 -3
View File
@@ -263,7 +263,7 @@
/mob/proc/findname(msg)
for(var/mob/M in GLOB.mob_list)
if (M.real_name == text("[]", msg))
if (M.real_name == "[msg]")
return M
return 0
@@ -367,7 +367,7 @@
<BR><B>Left Hand:</B> <A href='?src=[REF(src)];item=l_hand'>[(l_hand ? l_hand : "Nothing")]</A>
<BR><B>Right Hand:</B> <A href='?src=[REF(src)];item=r_hand'>[(r_hand ? r_hand : "Nothing")]</A>
<BR><B>Back:</B> <A href='?src=[REF(src)];item=back'>[(back ? back : "Nothing")]</A> [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/tank) && !( internal )) ? " <A href='?src=[REF(src)];item=internal'>Set Internal</A>" : "")]
<BR>[(internal ? text("<A href='?src=[REF(src)];item=internal'>Remove Internal</A>") : "")]
<BR>[(internal ? "<A href='?src=[REF(src)];item=internal'>Remove Internal</A>" : "")]
<BR><A href='?src=[REF(src)];item=pockets'>Empty Pockets</A>
<BR><A href='?src=[REF(user)];refresh=1'>Refresh</A>
<BR><A href='?src=[REF(user)];mach_close=mob[name]'>Close</A>
@@ -657,7 +657,7 @@
/mob/Topic(href, href_list)
if(href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
var/t1 = "window=[href_list["mach_close"]]"
unset_machine()
src << browse(null, t1)
+2 -2
View File
@@ -113,8 +113,8 @@
attacker.visible_message(SPAN_DANGER("[attacker] [attacker.species.knockout_message]"))
playsound(attacker.loc, /singleton/sound_category/swing_hit_sound, 25, 1, -1)
attacker.attack_log += text("\[[time_stamp()]\] <span class='warning'>Headbutted [target.name] ([target.ckey])</span>")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Headbutted by [attacker.name] ([attacker.ckey])</font>")
attacker.attack_log += "\[[time_stamp()]\] <span class='warning'>Headbutted [target.name] ([target.ckey])</span>"
target.attack_log += "\[[time_stamp()]\] <font color='orange'>Headbutted by [attacker.name] ([attacker.ckey])</font>"
msg_admin_attack("[key_name(attacker)] has headbutted [key_name(target)]",ckey=key_name(attacker),ckey_target=key_name(target))
qdel(src)
+5 -5
View File
@@ -442,12 +442,12 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
n_letter = copytext(te, p, p+n_mod)
if (prob(50))
if (prob(30))
n_letter = text("[n_letter]-[n_letter]-[n_letter]")
n_letter = "[n_letter]-[n_letter]-[n_letter]"
else
n_letter = text("[n_letter]-[n_letter]")
n_letter = "[n_letter]-[n_letter]"
else
n_letter = text("[n_letter]")
t = text("[t][n_letter]")
n_letter = "[n_letter]"
t = "[t][n_letter]"
p=p+n_mod
return sanitize(t)
@@ -472,7 +472,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
/proc/findname(msg)
for(var/mob/M in GLOB.mob_list)
if (M.real_name == text("[msg]"))
if (M.real_name == "[msg]")
return 1
return 0