Skip to content

Commit 194046e

Browse files
committed
TGS Test Merge (#8734)
2 parents 2fb2351 + 46e5730 commit 194046e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+189
-129
lines changed

code/datums/browser.dm

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/datum/browser
2-
var/mob/user
2+
var/client/user
33
var/title
44
var/window_id // window_id is used as the window name for browse and onclose
55
var/width = 0
@@ -18,6 +18,8 @@
1818
var/static/datum/asset/simple/common/common_asset = get_asset_datum(/datum/asset/simple/common)
1919
var/static/datum/asset/simple/other/other_asset = get_asset_datum(/datum/asset/simple/other)
2020

21+
var/existing_browser = FALSE
22+
2123

2224
/datum/browser/New(nuser, nwindow_id, ntitle = 0, nstylesheet = "common.css", nwidth = 0, nheight = 0, atom/nref = null)
2325
user = nuser
@@ -70,6 +72,15 @@
7072
head_content += "<link rel='stylesheet' type='text/css' href='[common_asset.get_url_mappings()[stylesheet]]'>"
7173
head_content += "<link rel='stylesheet' type='text/css' href='[other_asset.get_url_mappings()["loading.gif"]]'>"
7274

75+
if(user.window_scaling && user.window_scaling != 1 && !user.prefs.window_scale && width && height)
76+
head_content += {"
77+
<style>
78+
body {
79+
zoom: [100 / user.window_scaling]%;
80+
}
81+
</style>
82+
"}
83+
7384
for (var/file in stylesheets)
7485
head_content += "<link rel='stylesheet' type='text/css' href='[SSassets.transport.get_asset_url(file)]'>"
7586

@@ -114,7 +125,10 @@
114125
return
115126
var/window_size = ""
116127
if (width && height)
117-
window_size = "size=[width]x[height];"
128+
if(user.window_scaling && user.prefs.window_scale)
129+
window_size = "size=[width * user?.window_scaling]x[height * user?.window_scaling];"
130+
else
131+
window_size = "size=[width]x[height];"
118132
common_asset.send(user)
119133
other_asset.send(user)
120134
if (length(stylesheets))
@@ -124,6 +138,9 @@
124138

125139
user << browse(get_content(), "window=[window_id];[window_size][window_options]")
126140

141+
if(existing_browser)
142+
winset(user, existing_browser, window_size)
143+
127144
if (use_onclose)
128145
setup_onclose()
129146

@@ -226,7 +243,7 @@
226243
mob.unset_interaction()
227244
return
228245

229-
/proc/show_browser(target, browser_content, browser_name, id = null, window_options = null, closeref)
246+
/proc/show_browser(target, browser_content, browser_name, id = null, window_options = null, closeref, width, height, existing_container = FALSE)
230247
var/client/C = target
231248

232249
if (ismob(target))
@@ -241,7 +258,11 @@
241258
C.prefs.stylesheet = "Modern"
242259
stylesheet = "Modern"
243260

244-
var/datum/browser/popup = new(C, id ? id : browser_name, browser_name, GLOB.stylesheets[stylesheet], nref = closeref)
261+
var/datum/browser/popup = new(C, id ? id : browser_name, browser_name, GLOB.stylesheets[stylesheet], nwidth = width, nheight = height, nref = closeref)
262+
263+
if(existing_container)
264+
popup.existing_browser = existing_container
265+
245266
popup.set_content(browser_content)
246267
if (window_options)
247268
popup.set_window_options(window_options)
@@ -324,7 +345,7 @@
324345
set_content(output)
325346

326347
/datum/browser/modal/listpicker/Topic(href,href_list)
327-
if (href_list["close"] || !user || !user.client)
348+
if (href_list["close"] || !user)
328349
opentime = 0
329350
return
330351
if (href_list["button"])

code/datums/global_variables.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112

113113
html += "</body></html>"
114114

115-
show_browser(usr, html, "View Global Variables", "global_variables", "size=475x650")
115+
show_browser(usr, html, "View Global Variables", "global_variables", width = 475, height = 650)
116116

117117
return
118118

code/datums/matrix_editor.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<a href='byond://?_src_=matrices;operation=delete'>Delete selected matrix</a>
4747
"}
4848

49-
show_browser(usr, data, "Matrix Editor", "matrixeditor\ref[src]", "size=600x450")
49+
show_browser(usr, data, "Matrix Editor", "matrixeditor\ref[src]", width = 600, height = 450)
5050

5151
/client/proc/matrix_editor_Topic(href, href_list)
5252
if(!usr.client || !usr.client.admin_holder || !(usr.client.admin_holder.rights & (R_DEBUG|R_ADMIN)))

code/game/atoms.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Parameters are passed from New.
511511
return TRUE
512512

513513
if(href_list["desc_lore"])
514-
show_browser(usr, "<BODY><TT>[replacetext(desc_lore, "\n", "<BR>")]</TT></BODY>", name, name, "size=500x500")
514+
show_browser(usr, "<BODY><TT>[replacetext(desc_lore, "\n", "<BR>")]</TT></BODY>", name, name, width = 500, height = 500)
515515
onclose(usr, "[name]")
516516

517517
///This proc is called on atoms when they are loaded into a shuttle

code/game/machinery/computer/area_air_control.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<i>[zone]</i>
8181
</body>
8282
</html>"}
83-
show_browser(user, dat, name, "miningshuttle", "size=400x400")
83+
show_browser(user, dat, name, "miningshuttle", width = 400, height = 400)
8484
status = ""
8585

8686
/obj/structure/machinery/computer/area_atmos/Topic(href, href_list)

code/game/machinery/computer/communications.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@
502502
return FALSE
503503

504504
dat += "<BR>[(state != STATE_DEFAULT) ? "<A href='byond://?src=\ref[src];operation=main'>Main Menu</A>|" : ""]<A href='byond://?src=\ref[user];mach_close=communications'>Close</A>"
505-
show_browser(user, dat, "Communications Console", "communications", "size=400x500")
505+
show_browser(user, dat, "Communications Console", "communications", width = 400, height = 500)
506506
onclose(user, "communications")
507507
#undef STATE_DEFAULT
508508
#undef STATE_MESSAGELIST

code/game/machinery/computer/emails.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
var/datum/fluff_email/FE = mail
5252
dat += "<A href='byond://?src=\ref[src];selectmail=[i]'>[FE.title]</A><BR>"
5353

54-
show_browser(user, dat, "Personal Computer", "email", "size=600x520")
54+
show_browser(user, dat, "Personal Computer", "email", width = 600, height = 520)
5555

5656

5757
/obj/structure/machinery/computer/emails/Topic(href, href_list)

code/game/machinery/computer/groundside_operations.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
dat += get_overwatch_info()
101101

102102
dat += "<BR><A href='byond://?src=\ref[user];mach_close=groundside_operations'>Close</A>"
103-
show_browser(user, dat, name, "groundside_operations", "size=600x700")
103+
show_browser(user, dat, name, "groundside_operations", width = 600, height = 700)
104104
concurrent_users += WEAKREF(user)
105105
onclose(user, "groundside_operations")
106106

code/game/machinery/computer/skills.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
dat += "<br><A href='byond://?src=\ref[src];choice=Return'>Return to index.</A>"
129129
else
130130
dat += "<A href='byond://?src=\ref[src];choice=Log In'>{Log In}</A>"
131-
show_browser(user, dat, "Employment Records", "secure_rec", "size=600x400")
131+
show_browser(user, dat, "Employment Records", "secure_rec", width = 600, height = 400)
132132
onclose(user, "secure_rec")
133133
return
134134

code/game/machinery/door_display/door_display.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181

8282
if(!uses_tgui)
8383
user.set_interaction(src)
84-
show_browser(user, display_contents(user), name, "computer", "size=400x500")
84+
show_browser(user, display_contents(user), name, "computer", width = 400, height = 500)
8585
return
8686

8787
/obj/structure/machinery/door_display/proc/display_contents(mob/user as mob)

code/game/machinery/medical_pod/autodoc.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@
805805
else
806806
dat += "The autodoc is empty."
807807
dat += text("<a href='byond://?src=\ref[];mach_close=sleeper'>Close</a>", user)
808-
show_browser(user, dat, "Auto-Doc Medical System", "sleeper", "size=300x400")
808+
show_browser(user, dat, "Auto-Doc Medical System", "sleeper", width = 300, height = 400)
809809
onclose(user, "sleeper")
810810

811811
/obj/structure/machinery/autodoc_console/Topic(href, href_list)

code/game/machinery/suit_storage_unit.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
dat += "<A href='byond://?src=\ref[src];start_UV=1'>Start Disinfection cycle</A><BR>"
125125
dat += "<BR><BR><A href='byond://?src=\ref[user];mach_close=suit_storage_unit'>Close control panel</A>"
126126

127-
show_browser(user, dat, "Suit Storage Unit", "suit_storage_unit", "size=400x500")
127+
show_browser(user, dat, "Suit Storage Unit", "suit_storage_unit", width = 400, height = 500)
128128
return
129129

130130

code/game/machinery/telecomms/machine_interactions.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160

161161
dat += "</font>"
162162
temp = ""
163-
show_browser(user, dat, "[src] Access", "tcommachine", "size=520x500;can_resize=0")
163+
show_browser(user, dat, "[src] Access", "tcommachine", "can_resize=0", width = 520, height = 500)
164164
onclose(user, "tcommachine")
165165

166166

code/game/objects/items/books/book.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
to_chat(user, SPAN_NOTICE("The pages of [title] have been cut out!"))
4646
return
4747
if(src.dat)
48-
show_browser(user, "<body class='paper'><TT><I>Owner: [author].</I></TT> <BR>[dat]</body>", "window=book;size=800x600")
48+
show_browser(user, "<body class='paper'><TT><I>Owner: [author].</I></TT> <BR>[dat]</body>", "window=book", width = 800, height = 600)
4949
user.visible_message("[user] opens \"[src.title]\".")
5050
onclose(user, "book")
5151
else

code/game/objects/items/devices/dummy_tablet.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
dat += "<BR>\[ <A href='byond://?src=\ref[src];operation=reset'>Reset</A> \]"
8989
dat += "<BR><hr>"
9090

91-
show_browser(user, dat, "Professor DUMMY Control Tablet", "dummytablet", window_options="size=400x500")
91+
show_browser(user, dat, "Professor DUMMY Control Tablet", "dummytablet", width = 400, height = 500)
9292
onclose(user, "dummytablet")
9393
updateDialog()
9494
return

code/game/objects/items/stacks/stack.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Also change the icon to reflect the amount of sheets, if possible.*/
136136
t1 += " <A href='byond://?src=\ref[src];make=[i];multiplier=[max_multiplier]'>[max_multiplier*R.res_amount]x</A>"
137137

138138
t1 += "</TT></body></HTML>"
139-
show_browser(user, t1, "Construction using [src]", "stack")
139+
show_browser(user, t1, "Construction using [src]", "stack", width = 440, height = 500)
140140
return
141141

142142
/obj/item/stack/Topic(href, href_list)

code/game/objects/structures/safe.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ FLOOR SAFES
129129
var/obj/item/P = contents[i]
130130
dat += "<tr><td><a href='byond://?src=\ref[src];retrieve=\ref[P]'>[P.name]</a></td></tr>"
131131
dat += "</table></center>"
132-
show_browser(user, dat, name, "safe", "size=350x300")
132+
show_browser(user, dat, name, "safe", width = 350, height = 300)
133133
onclose(user, "safe")
134134

135135
/obj/structure/safe/Topic(href, href_list)

code/game/supplyshuttle.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
10301030
if(scramble)
10311031
paper_info = stars_decode_html(info)
10321032
// Tossing ref in widow id as this allows us to read multiple manifests at same time
1033-
show_browser(user, "<BODY class='paper'>[paper_info][stamps]</BODY>", null, "manifest\ref[src]", "size=550x650")
1033+
show_browser(user, "<BODY class='paper'>[paper_info][stamps]</BODY>", null, "manifest\ref[src]", width = 550, height = 650)
10341034
onclose(user, "manifest\ref[src]")
10351035

10361036
/obj/item/paper/manifest/proc/generate_contents()
@@ -1447,7 +1447,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
14471447
else
14481448
dat += "<a href='byond://?src=\ref[src];get_vehicle=\ref[VO]'>[VO.name]</a><br>"
14491449

1450-
show_browser(H, dat, asrs_name, "computer", "size=575x450")
1450+
show_browser(H, dat, asrs_name, "computer", width = 575, height = 450)
14511451

14521452
/obj/structure/machinery/computer/supply/asrs/vehicle/Topic(href, href_list)
14531453
. = ..()

code/game/verbs/records.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
dat += "</table>"
6464

65-
show_browser(usr, dat, "Your [category_text] Record", "ownrecords", "size=480x480")
65+
show_browser(usr, dat, "Your [category_text] Record", "ownrecords", width = 480, height = 480)
6666

6767

6868

@@ -172,7 +172,7 @@
172172
if(can_edit || ishost(src))
173173
dat += add_dat
174174

175-
show_browser(src, dat, "[target]'s [category_text] Notes", "otherplayersinfo", "size=480x480")
175+
show_browser(src, dat, "[target]'s [category_text] Notes", "otherplayersinfo", width = 480, height = 480)
176176

177177
GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)
178178

code/modules/admin/NewBan.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ GLOBAL_DATUM(Banlist, /savefile)
305305

306306
data += "</table>"
307307

308-
show_browser(owner, data, "Stickyban Panel", "sticky", "size=875x400")
308+
show_browser(owner, data, "Stickyban Panel", "sticky", width = 875, height = 400)
309309

310310
//////////////////////////////////// DEBUG ////////////////////////////////////
311311

code/modules/admin/admin.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
dat += "<br><br>"
108108
dat += "</body></html>"
109109

110-
show_browser(usr, dat, "Info on [key]", "allplayerinfo", "size=480x480")
110+
show_browser(usr, dat, "Info on [key]", "allplayerinfo", width = 480, height = 480)
111111

112112

113113
/datum/admins/proc/Jobbans()
@@ -128,7 +128,7 @@
128128
u = "[c] - [r]"
129129
dat += "<tr><td>[t] (<A href='byond://?src=\ref[src];[HrefToken(forceGlobal = TRUE)];removejobban=[u]'>unban</A>)</td></tr>"
130130
dat += "</table>"
131-
show_browser(usr, dat, "Job Bans", "ban", "size=400x400")
131+
show_browser(usr, dat, "Job Bans", "ban", width = 400, height = 400)
132132

133133

134134
/datum/admins/proc/Game()
@@ -148,7 +148,7 @@
148148
<A href='byond://?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];send_tip=1'>Immediately Send Tip</A><br>
149149
"}
150150

151-
show_browser(usr, dat, "Game Panel", "admin2", "size=210x280")
151+
show_browser(usr, dat, "Game Panel", "admin2", width = 210, height = 280)
152152
return
153153

154154
/////////////////////////////////////////////////////////////////////////////////////////////////admins2.dm merge

code/modules/admin/banjob.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,5 @@ WARNING!*/
169169

170170
body = "<body>[jobs]</body>"
171171
dat = "<tt>[body]</tt>"
172-
show_browser(usr, dat, "Job-Ban Panel: [M.name]", "jobban2", "size=800x490")
172+
show_browser(usr, dat, "Job-Ban Panel: [M.name]", "jobban2", width = 800, height = 490)
173173
return

code/modules/admin/create_mob.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
create_mob_html = replacetext(create_mob_html, "null /* object types */", "\"[mobjs]\"")
99
create_mob_html = replacetext(create_mob_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))
1010

11-
show_browser(user, replacetext(create_mob_html, "/* ref src */", "\ref[src]"), "Create Mob", "create_mob", "size=450x525")
11+
show_browser(user, replacetext(create_mob_html, "/* ref src */", "\ref[src]"), "Create Mob", "create_mob", width = 450, height = 525)

code/modules/admin/create_object.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
create_object_html = replacetext(create_object_html, "null /* object types */", "\"[objectjs]\"")
99
create_object_html = replacetext(create_object_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))
1010

11-
show_browser(user, replacetext(create_object_html, "/* ref src */", "\ref[src]"), "Create Object", "create_object", "size=450x525")
11+
show_browser(user, replacetext(create_object_html, "/* ref src */", "\ref[src]"), "Create Object", "create_object", width = 450, height = 525)
1212

1313

1414
/datum/admins/proc/quick_create_object(mob/user)
@@ -46,4 +46,4 @@
4646
quick_create_object_html = replacetext(quick_create_object_html, "null /* object types */", "\"[objectjs]\"")
4747
quick_create_object_html = replacetext(quick_create_object_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))
4848

49-
show_browser(user, replacetext(quick_create_object_html, "/* ref src */", "\ref[src]"), "Quick Create Object", "quick_create_object", "size=450x525")
49+
show_browser(user, replacetext(quick_create_object_html, "/* ref src */", "\ref[src]"), "Quick Create Object", "quick_create_object", width = 450, height = 525)

code/modules/admin/create_turf.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
create_turf_html = replacetext(create_turf_html, "null /* object types */", "\"[turfjs]\"")
99
create_turf_html = replacetext(create_turf_html, "/* href token */", RawHrefToken(forceGlobal = TRUE))
1010

11-
show_browser(usr, replacetext(create_turf_html, "/* ref src */", "\ref[src]"), "Create Turf", "create_turf", "size=450x525")
11+
show_browser(usr, replacetext(create_turf_html, "/* ref src */", "\ref[src]"), "Create Turf", "create_turf", width = 450, height = 525)

code/modules/admin/player_panel/player_panel.dm

+4-4
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
</body></html>
270270
"}
271271

272-
show_browser(usr, dat, "User Panel", "players", "size=640x480")
272+
show_browser(usr, dat, "User Panel", "players", width = 640, height = 480)
273273

274274
//Extended panel with ban related things
275275
/datum/admins/proc/player_panel_extended()
@@ -314,7 +314,7 @@
314314

315315
dat += "</table></body></html>"
316316

317-
show_browser(usr, dat, "Player Menu", "players", "size=640x480")
317+
show_browser(usr, dat, "Player Menu", "players", width = 640, height = 480)
318318

319319

320320
/datum/admins/proc/check_antagonists()
@@ -367,7 +367,7 @@
367367

368368
dat += "</table>"
369369

370-
show_browser(usr, dat, "Antagonists", "antagonists", "size=600x500")
370+
show_browser(usr, dat, "Antagonists", "antagonists", width = 600, height = 500)
371371

372372
/datum/admins/proc/check_round_status()
373373
if (SSticker.current_state >= GAME_STATE_PLAYING)
@@ -395,7 +395,7 @@
395395

396396
dat += "<br><A href='byond://?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];delay_round_end=1'>[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]</A><br>"
397397
dat += "</body></html>"
398-
show_browser(usr, dat, "Round Status", "roundstatus", "size=600x500")
398+
show_browser(usr, dat, "Round Status", "roundstatus", width = 600, height = 500)
399399
else
400400
alert("The game hasn't started yet!")
401401

code/modules/admin/tabs/admin_tab.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
dat += "<A href='byond://?src=\ref[src];[HrefToken()];add_player_info_confidential=[key]'>Add Confidential Note</A><br>"
194194
dat += "<A href='byond://?src=\ref[src];[HrefToken()];player_notes_all=[key]'>Show Complete Record</A><br>"
195195

196-
show_browser(usr, dat, "Admin record for [key]", "adminplayerinfo", "size=480x480")
196+
show_browser(usr, dat, "Admin record for [key]", "adminplayerinfo", width = 480, height = 480)
197197

198198
/datum/admins/proc/check_ckey(target_key as text)
199199
set name = "Check CKey"

0 commit comments

Comments
 (0)