use ref. if really needed (#19518)

* use ref. if really needed

* replace browse_rsc with the macro for it
This commit is contained in:
Kashargul
2026-06-20 21:50:43 +02:00
committed by GitHub
parent 4a1efa8f22
commit 9cb6b2ec55
16 changed files with 52 additions and 52 deletions
+2 -2
View File
@@ -161,7 +161,7 @@ mob
// Give it a name for the cache
var/iconName = "[ckey(src.name)]_flattened.dmi"
// Send the icon to src's local cache
src<<browse_rsc(get_flat_icon(src), iconName)
send_rsc(src, get_flat_icon(src), iconName)
// Display the icon in their browser
src<<browse("<html><body bgcolor='#000000'><p><img src='[iconName]'></p></body></html>")
@@ -176,7 +176,7 @@ mob
// Copy the file to the rsc manually
var/icon/I = fcopy_rsc(get_flat_icon(src))
// Send the icon to src's local cache
src<<browse_rsc(I, iconName)
send_rsc(src, I, iconName)
// Update the label to show it
winset(src,"imageLabel","image='[REF(I)]'");
+1 -1
View File
@@ -380,7 +380,7 @@
var/datum/callback/callback = settings["preview_callback"]
preview_icon = callback.Invoke(settings)
if (preview_icon)
user << browse_rsc(preview_icon, "previewicon.png")
send_rsc(user, preview_icon, "previewicon.png")
var/list/display_list = list()
for (var/name in settings["mainsettings"])
+2 -2
View File
@@ -378,7 +378,7 @@ ADMIN_VERB(access_news_network, R_ADMIN|R_EVENT, "Access Newscaster Network", "A
//dat+="-[MESSAGE.body] <br>"
var/pic_data
if(MESSAGE.img)
user << browse_rsc(MESSAGE.img, "tmp_photo[i].png")
send_rsc(user, MESSAGE.img, "tmp_photo[i].png")
pic_data+="<img src='tmp_photo[i].png' width = '180'><BR>"
dat+= get_newspaper_content(MESSAGE.title, MESSAGE.body, MESSAGE.author,"#d4cec1", pic_data)
dat+="<br>"
@@ -493,7 +493,7 @@ ADMIN_VERB(access_news_network, R_ADMIN|R_EVENT, "Access Newscaster Network", "A
"} + span_bold("Photo:") + {":
"}
if(GLOB.news_network.wanted_issue.img)
user << browse_rsc(GLOB.news_network.wanted_issue.img, "tmp_photow.png")
send_rsc(user, GLOB.news_network.wanted_issue.img, "tmp_photow.png")
dat+="<br><img src='tmp_photow.png' width = '180'>"
else
dat+="None"
+1 -1
View File
@@ -67,6 +67,6 @@ ADMIN_VERB(capture_map, R_ADMIN, "Capture Map Part", "Usage: Capture-Map-Part ta
var/file_name = "map_capture_x[tx]_y[ty]_z[tz]_r[range].png"
to_chat(user, span_filter_notice("Saved capture in cache as [file_name]."))
DIRECT_OUTPUT(user, browse_rsc(cap, file_name))
send_rsc(user, cap, file_name)
else
to_chat(user, span_filter_notice("Target coordinates are incorrect."))
@@ -47,7 +47,7 @@
var/icon/icon_value = icon(value)
var/rnd = rand(1,10000)
var/rname = "tmp[REF(icon_value)][rnd].png"
usr << browse_rsc(icon_value, rname)
send_rsc(usr, icon_value, rname)
return "(" + span_value("[value]") + ") <img class=icon src=\"[rname]\">"
#else
return "/icon (" + span_value("[value]") + ")"
@@ -73,7 +73,7 @@ ADMIN_VERB_AND_CONTEXT_MENU(debug_variables, (R_DEBUG|R_SERVER|R_ADMIN|R_SPAWN|R
var/sprite_text
if(sprite)
hash = md5(sprite)
src << browse_rsc(sprite, "vv[hash].png")
send_rsc(src, sprite, "vv[hash].png")
sprite_text = no_icon ? "\[NO ICON\]" : "<img src='vv[hash].png'></td><td>"
title = "[thing] ([REF(thing)]) = [type]"
@@ -139,7 +139,7 @@
if (!keep_local_name)
new_asset_name = "asset.[ACI.hash][ACI.ext]"
log_asset("Sending asset `[asset_name]` to client `[client]` as `[new_asset_name]`")
client << browse_rsc(ACI.resource, new_asset_name)
send_rsc(client, ACI.resource, new_asset_name)
client.sent_assets[new_asset_name] = ACI.hash
+1 -1
View File
@@ -350,7 +350,7 @@ Book Cart End
user << browse(dat, "window=[name]")
else if(istype(pages[page], /obj/item/photo))
var/obj/item/photo/P = W
user << browse_rsc(P.img, "tmp_photo.png")
send_rsc(user, P.img, "tmp_photo.png")
user << browse("<html>" + dat + "<head><title>[P.name]</title></head>" \
+ "<body style='overflow:hidden'>" \
+ "<div> <img src='tmp_photo.png' width = '180'" \
+1 -1
View File
@@ -108,7 +108,7 @@
//if(!current_page)
//generate_pages()
user << browse_rsc('html/browser/codex.css', "codex.css")
send_rsc(user, 'html/browser/codex.css', "codex.css")
var/dat
dat = "<head>"
+1 -1
View File
@@ -78,7 +78,7 @@
var/pic_data
if(MESSAGE.img)
usr << browse_rsc(MESSAGE.img, "tmp_photo[current_page].png")
send_rsc(usr, MESSAGE.img, "tmp_photo[current_page].png")
pic_data+="<img src='tmp_photo[current_page].png' width = '180'><BR>"
dat += get_newspaper_content(MESSAGE.title, MESSAGE.body, MESSAGE.author, "#d4cec1", pic_data)
+2 -2
View File
@@ -67,7 +67,7 @@
i++
dat+="-[MESSAGE.body] <BR>"
if(MESSAGE.img)
user << browse_rsc(MESSAGE.img, "tmp_photo[i].png")
send_rsc(user, MESSAGE.img, "tmp_photo[i].png")
dat+="<img src='tmp_photo[i].png' width = '180'><BR>"
dat+=span_small("\[[MESSAGE.message_type] by " + span_maroon("[MESSAGE.author]") + "\]") + "<BR><BR>"
dat+="</ul>"
@@ -83,7 +83,7 @@
dat+=span_bold("Description") + ": [important_message.body]<BR>"
dat+=span_bold("Photo:") + ": "
if(important_message.img)
user << browse_rsc(important_message.img, "tmp_photow.png")
send_rsc(user, important_message.img, "tmp_photow.png")
dat+="<BR><img src='tmp_photow.png' width = '180'>"
else
dat+="None"
+2 -2
View File
@@ -69,7 +69,7 @@
dat+="[MESSAGE.title] <BR>"
dat+="-[MESSAGE.body] <BR>"
if(MESSAGE.img)
user << browse_rsc(MESSAGE.img, "tmp_photo[i].png")
send_rsc(user, MESSAGE.img, "tmp_photo[i].png")
dat+="<img src='tmp_photo[i].png' width = '180'><BR>"
dat+=span_small("\[[MESSAGE.message_type] by " + span_maroon("[MESSAGE.author]") + "\]") + "<BR><BR>"
dat+="</ul>"
@@ -85,7 +85,7 @@
dat+=span_bold("Description") + ": [important_message.body]<BR>"
dat+=span_bold("Photo:") + ": "
if(important_message.img)
user << browse_rsc(important_message.img, "tmp_photow.png")
send_rsc(user, important_message.img, "tmp_photow.png")
dat+="<BR><img src='tmp_photow.png' width = '180'>"
else
dat+="None"
+1 -1
View File
@@ -131,7 +131,7 @@
user << browse(dat, "window=[name]")
else if(istype(pages[page], /obj/item/photo))
var/obj/item/photo/P = W
user << browse_rsc(P.img, "tmp_photo.png")
send_rsc(user, P.img, "tmp_photo.png")
user << browse("<html>" + dat + "<head><title>[P.name]</title></head>" \
+ "<body style='overflow:hidden'>" \
+ "<div> <img src='tmp_photo.png' width = '180'" \
+1 -1
View File
@@ -65,7 +65,7 @@ GLOBAL_VAR_INIT(photo_count, 0)
return list(span_notice("It is too far away to examine."))
/obj/item/photo/proc/show(mob/user as mob)
user << browse_rsc(img, "tmp_photo_[id].png")
send_rsc(user, img, "tmp_photo_[id].png")
user << browse("<html><head><title>[name]</title></head>" \
+ "<body style='overflow:hidden;margin:0;text-align:center'>" \
+ "<img src='tmp_photo_[id].png' width='[64*photo_size]' style='-ms-interpolation-mode:nearest-neighbor' />" \
+1 -2
View File
@@ -316,7 +316,6 @@
/datum/data/pda/app/goals/proc/get_goals()
var/list/goals = list()
var/index = 0
for(var/category in SSdepartmentgoals.active_department_goals)
var/list/dept_goal = SSdepartmentgoals.active_department_goals[category]
@@ -325,6 +324,6 @@
"name" = goal.name,
"description" = goal.goal_text,
"count" = FLOOR((goal.current_count / goal.goal_count) * 100, 1),
"index" = ++index
"ref" = REF(goal)
))
return goals
@@ -15,7 +15,7 @@ type Goal = {
name: string;
description: string;
count: number;
index: number;
ref: string;
};
export const pda_depgoals = (props) => {
@@ -25,9 +25,11 @@ export const pda_depgoals = (props) => {
return (
<Box>
{(!goals.length && (
{!goals.length ? (
<NoticeBox>No departmental goals found!</NoticeBox>
)) || <GoalsDisplay />}
) : (
<GoalsDisplay />
)}
</Box>
);
};
@@ -38,35 +40,34 @@ const GoalsDisplay = (props) => {
return (
<Stack vertical fill>
{goals.length > 0 &&
goals.map((goal) => (
<Section key={goal.index}>
<Stack vertical>
<Stack.Item>
<Box fontSize="4">{goal.name}</Box>
<Box fontSize="2" color="gray">
{goal.description}
</Box>
</Stack.Item>
<Stack.Item>
<ProgressBar
value={goal.count}
minValue={0}
maxValue={100}
ranges={{
good: [85, 100],
average: [25, 85],
bad: [0, 25],
}}
>
<Stack align="baseline">
{!!goal.name && <Stack.Item grow>{goal.count}%</Stack.Item>}
</Stack>
</ProgressBar>
</Stack.Item>
</Stack>
</Section>
))}
{goals.map((goal) => (
<Section key={goal.ref}>
<Stack vertical>
<Stack.Item>
<Box fontSize="4">{goal.name}</Box>
<Box fontSize="2" color="gray">
{goal.description}
</Box>
</Stack.Item>
<Stack.Item>
<ProgressBar
value={goal.count}
minValue={0}
maxValue={100}
ranges={{
good: [85, 100],
average: [25, 85],
bad: [0, 25],
}}
>
<Stack align="baseline">
<Stack.Item grow>{goal.count}%</Stack.Item>
</Stack>
</ProgressBar>
</Stack.Item>
</Stack>
</Section>
))}
</Stack>
);
};