diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index f49b823b3e..015396c24a 100644 --- a/code/ZAS/Variable Settings.dm +++ b/code/ZAS/Variable Settings.dm @@ -112,7 +112,9 @@ var/global/vs_control/vsc = new if("[ch]_NAME" in vars) vw_name = vars["[ch]_NAME"] dat += span_bold("[vw_name] = [vw]") + " \[Change\]
" dat += "[vw_desc]

" - user << browse("[dat]","window=settings") + var/datum/browser/popup = new(user, "settings", "Settings") + popup.set_content(dat) + popup.open() /vs_control/Topic(href,href_list) if("changevar" in href_list) diff --git a/code/__defines/client.dm b/code/__defines/client.dm new file mode 100644 index 0000000000..d58ae1456a --- /dev/null +++ b/code/__defines/client.dm @@ -0,0 +1,2 @@ +/// Checks if the given target is either a client or a mock client, for now removed: || istype(target, /datum/client_interface) +#define IS_CLIENT_OR_MOCK(target) (istype(target, /client)) diff --git a/code/_global_vars/bitfields.dm b/code/_global_vars/bitfields.dm index a8a9be511b..b77364dcdb 100644 --- a/code/_global_vars/bitfields.dm +++ b/code/_global_vars/bitfields.dm @@ -16,6 +16,17 @@ GLOBAL_LIST_INIT(bitfields, generate_bitfields()) bitfields[bitfield.variable] = bitfield.flags return bitfields +/// Returns an associative list of bitflag name -> number for all valid bitflags in the passed in field +/proc/get_valid_bitflags(var_name) + return GLOB.bitfields[var_name] || list() + +/proc/get_random_bitflag(var_name) + var/list/flags = get_valid_bitflags(var_name) + if(!length(flags)) + return + var/name = pick(flags) + return flags[name] + DEFINE_BITFIELD(admin_flags, list( "ADMIN" = R_ADMIN, "REJUVINATE" = R_REJUVINATE, diff --git a/code/datums/browser.dm b/code/datums/browser.dm index a5e9896d41..7ba9e80e72 100644 --- a/code/datums/browser.dm +++ b/code/datums/browser.dm @@ -1,40 +1,48 @@ /datum/browser var/mob/user - var/title - var/window_id // window_id is used as the window name for browse and onclose + var/title = "" + /// window_id is used as the window name for browse and onclose + var/window_id var/width = 0 var/height = 0 - var/datum/weakref/ref = null - var/window_options = "can_close=1;can_minimize=1;can_maximize=0;can_resize=1;titlebar=1;" // window option is set using window_id - var/stylesheets[0] - var/scripts[0] + var/datum/weakref/source_ref = null + /// window option is set using window_id + var/window_options = "can_close=1;can_minimize=1;can_maximize=0;can_resize=1;titlebar=1;" + var/list/stylesheets = list() + var/list/scripts = list() var/head_elements var/body_elements var/head_content = "" var/content = "" -/datum/browser/New(nuser, nwindow_id, ntitle = 0, nwidth = 0, nheight = 0, atom/nref = null) - user = nuser +/datum/browser/New(mob/user, window_id, title = "", width = 0, height = 0, atom/source = null) + if(IS_CLIENT_OR_MOCK(user)) + var/client/client_user = user + user = client_user.mob + src.user = user RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(user_deleted)) - window_id = nwindow_id - if (ntitle) - title = format_text(ntitle) - if (nwidth) - width = nwidth - if (nheight) - height = nheight - if (nref) - ref = WEAKREF(nref) + src.window_id = window_id + if (title) + src.title = format_text(title) + if (width) + src.width = width + if (height) + src.height = height + if (source) + src.source_ref = WEAKREF(source) /datum/browser/proc/user_deleted(datum/source) SIGNAL_HANDLER user = null -/datum/browser/proc/add_head_content(nhead_content) - head_content = nhead_content +/datum/browser/proc/add_head_content(head_content) + src.head_content += head_content -/datum/browser/proc/set_window_options(nwindow_options) - window_options = nwindow_options +/datum/browser/proc/set_head_content(head_content) + src.head_content = head_content + +/datum/browser/proc/set_window_options(window_options) + src.window_options = window_options /datum/browser/proc/add_stylesheet(name, file) if (istype(name, /datum/asset/spritesheet)) @@ -55,24 +63,24 @@ scripts["[ckey(name)].js"] = file SSassets.transport.register_asset("[ckey(name)].js", file) -/datum/browser/proc/set_content(ncontent) - content = ncontent +/datum/browser/proc/set_content(content) + src.content = content -/datum/browser/proc/add_content(ncontent) - content += ncontent +/datum/browser/proc/add_content(content) + src.content += content /datum/browser/proc/get_header() var/datum/asset/simple/namespaced/common/common_asset = get_asset_datum(/datum/asset/simple/namespaced/common) - var/file + var/list/new_head_content = list() // If a client exists, but they have disabled fancy windowing, disable it! if(user?.client?.prefs?.read_preference(/datum/preference/toggle/browser_style)) - head_content += "" - for (file in stylesheets) - head_content += "" + new_head_content += "" + for (var/file in stylesheets) + new_head_content += "" if(user.client?.window_scaling && user.client?.window_scaling != 1 && !user.client?.prefs.read_preference(/datum/preference/toggle/ui_scale) && width && height) - head_content += {" + new_head_content += {" "} - for (file in scripts) - head_content += "" + for (var/file in scripts) + new_head_content += "" + head_content += new_head_content.Join() return {" @@ -95,6 +104,7 @@ [title ? "
[title]
" : ""]
"} + //" This is here because else the rest of the file looks like a string in notepad++. /datum/browser/proc/get_footer() return {" @@ -105,16 +115,17 @@ /datum/browser/proc/get_content() return {" - [get_header()] - [content] - [get_footer()] + [get_header()] + [content] + [get_footer()] "} -/datum/browser/proc/open(use_onclose = TRUE) +/datum/browser/proc/open(use_on_close = TRUE) if(isnull(window_id)) //null check because this can potentially nuke goonchat WARNING("Browser [title] tried to open with a null ID") to_chat(user, span_userdanger("The [title] browser you tried to open failed a sanity check! Please report this on GitHub!")) return + var/window_size = "" if(width && height) if(user.client?.prefs?.read_preference(/datum/preference/toggle/ui_scale)) @@ -122,27 +133,28 @@ window_size = "size=[width * scaling]x[height * scaling];" else window_size = "size=[width]x[height];" + var/datum/asset/simple/namespaced/common/common_asset = get_asset_datum(/datum/asset/simple/namespaced/common) common_asset.send(user) - if (stylesheets.len) + if (length(stylesheets)) SSassets.transport.send_assets(user, stylesheets) - if (scripts.len) + if (length(scripts)) SSassets.transport.send_assets(user, scripts) - user << browse(get_content(), "window=[window_id];[window_size][window_options]") - if (use_onclose) + DIRECT_OUTPUT(user, browse(get_content(), "window=[window_id];[window_size][window_options]")) + if (use_on_close) setup_onclose() /datum/browser/proc/setup_onclose() set waitfor = 0 //winexists sleeps, so we don't need to. for (var/i in 1 to 10) - if (user?.client && winexists(user, window_id)) - var/atom/send_ref - if(ref) - send_ref = ref.resolve() - if(!send_ref) - ref = null - onclose(user, window_id, send_ref) - break + if (!user?.client || !winexists(user, window_id)) + continue + var/atom/send_ref + if(source_ref) + send_ref = source_ref.resolve() + if(!send_ref) + source_ref = null + onclose(user, window_id, send_ref) /datum/browser/proc/close() if(!isnull(window_id))//null check because this can potentially nuke goonchat @@ -150,106 +162,106 @@ else WARNING("Browser [title] tried to close with a null ID") -/datum/browser/modal/alert/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1,Timeout=6000) - if (!User) +/datum/browser/modal/alert/New(user, message, title, button_1 = "Ok", button_2, button_3, steal_focus = TRUE, timeout = 600 SECONDS) + if (!user) return - var/output = {"
[Message]

+ var/list/display_list = list() + display_list += {"
[message]

- [Button1]"} + [button_1]"} - if (Button2) - output += {"[Button2]"} + if (button_2) + display_list += {"[button_2]"} - if (Button3) - output += {"[Button3]"} + if (button_3) + display_list += {"[button_3]"} - output += {"
"} + display_list += {"
"} - ..(User, ckey("[User]-[Message]-[Title]-[world.time]-[rand(1,10000)]"), Title, 350, 150, src, StealFocus, Timeout) - set_content(output) + ..(user, ckey("[user]-[message]-[title]-[world.time]-[rand(1,10000)]"), title, 350, 150, src, steal_focus, timeout) + set_content(display_list.Join()) /datum/browser/modal/alert/Topic(href,href_list) if (href_list["close"] || !user || !user.client) - opentime = 0 + open_time = 0 return if (href_list["button"]) var/button = text2num(href_list["button"]) if (button <= 3 && button >= 1) - selectedbutton = button - opentime = 0 + selected_button = button + open_time = 0 close() /** * **DEPRECATED: USE tgui_alert(...) INSTEAD** * - * Designed as a drop in replacement for alert(); functions the same. (outside of needing User specified) + * Designed as a drop in replacement for alert(); functions the same. (outside of needing user specified) * Arguments: - * * User - The user to show the alert to. - * * Message - The textual body of the alert. - * * Title - The title of the alert's window. - * * Button1 - The first button option. - * * Button2 - The second button option. - * * Button3 - The third button option. - * * StealFocus - Boolean operator controlling if the alert will steal the user's window focus. - * * Timeout - The timeout of the window, after which no responses will be valid. + * * user - The user to show the alert to. + * * message - The textual body of the alert. + * * title - The title of the alert's window. + * * button_1 - The first button option. + * * button_2 - The second button option. + * * button_3 - The third button option. + * * steal_focus - Boolean operator controlling if the alert will steal the user's window focus. + * * timeout - The timeout of the window, after which no responses will be valid. */ -/proc/tgalert(mob/User, Message, Title, Button1="Ok", Button2, Button3, StealFocus = TRUE, Timeout = 6000) - if (!User) - User = usr - if (!istype(User)) - if (istype(User, /client)) - var/client/client = User - User = client.mob - else +/proc/tg_alert(mob/user, message, title, button_1 = "Ok", button_2, button_3, steal_focus = TRUE, timeout = 600 SECONDS) + if (!user) + user = usr + if (!ismob(user)) + if (!istype(user, /client)) return + var/client/user_client = user + user = user_client.mob // Get user's response using a modal - var/datum/browser/modal/alert/A = new(User, Message, Title, Button1, Button2, Button3, StealFocus, Timeout) - A.open() - A.wait() - switch(A.selectedbutton) + var/datum/browser/modal/alert/window = new(user, message, title, button_1, button_2, button_3, steal_focus, timeout) + window.open() + window.wait() + switch(window.selected_button) if (1) - return Button1 + return button_1 if (2) - return Button2 + return button_2 if (3) - return Button3 + return button_3 /datum/browser/modal - var/opentime = 0 + var/open_time = 0 var/timeout - var/selectedbutton = 0 - var/stealfocus + var/selected_button = 0 + var/steal_focus -/datum/browser/modal/New(nuser, nwindow_id, ntitle = 0, nwidth = 0, nheight = 0, atom/nref = null, StealFocus = 1, Timeout = 6000) +/datum/browser/modal/New(user, window_id, title = 0, width = 0, height = 0, atom/source = null, steal_focus = TRUE, timeout = 600 SECONDS) ..() - stealfocus = StealFocus - if (!StealFocus) + src.steal_focus = steal_focus + if (!src.steal_focus) window_options += "focus=false;" - timeout = Timeout - + src.timeout = timeout /datum/browser/modal/close() - .=..() - opentime = 0 + . = ..() + open_time = 0 -/datum/browser/modal/open(use_onclose) +/datum/browser/modal/open(use_on_close) set waitfor = FALSE - opentime = world.time + open_time = world.time + use_on_close = TRUE - if (stealfocus) - . = ..(use_onclose = 1) + if (steal_focus) + . = ..() else - var/focusedwindow = winget(user, null, "focus") - . = ..(use_onclose = 1) + var/focused_window = winget(user, null, "focus") + . = ..() //waits for the window to show up client side before attempting to un-focus it //winexists sleeps until it gets a reply from the client, so we don't need to bother sleeping for (var/i in 1 to 10) if (user && winexists(user, window_id)) - if (focusedwindow) - winset(user, focusedwindow, "focus=true") + if (focused_window) + winset(user, focused_window, "focus=true") else winset(user, "mapwindow", "focus=true") break @@ -257,126 +269,237 @@ addtimer(CALLBACK(src, PROC_REF(close)), timeout) /datum/browser/modal/proc/wait() - while (opentime && selectedbutton <= 0 && (!timeout || opentime+timeout > world.time)) + while (open_time && selected_button <= 0 && (!timeout || open_time + timeout > world.time)) stoplag(1) -/datum/browser/modal/listpicker - var/valueslist = list() +/datum/browser/modal/list_picker + var/values_list = list() -/datum/browser/modal/listpicker/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1, Timeout = FALSE,list/values,inputtype="checkbox", width, height, slidecolor) - if (!User) +/datum/browser/modal/list_picker/New(user, message, title, button_1 = "Ok", button_2, button_3, steal_focus = TRUE, timeout = FALSE, list/values, input_type = "checkbox", width, height, slide_color) + if (!user) return - var/output = {"
+ "} - if (Button2) - output += {""} + if (button_2) + display_list += {""} - if (Button3) - output += {""} + if (button_3) + display_list += {""} - output += {"
"} - ..(User, ckey("[User]-[Message]-[Title]-[world.time]-[rand(1,10000)]"), Title, width, height, src, StealFocus, Timeout) - set_content(output) + display_list += {""} + ..(user, ckey("[user]-[message]-[title]-[world.time]-[rand(1,10000)]"), title, width, height, src, steal_focus, timeout) + set_content(display_list.Join()) -/datum/browser/modal/listpicker/Topic(href,href_list) +/datum/browser/modal/list_picker/Topic(href, list/href_list) if (href_list["close"] || !user || !user.client) - opentime = 0 + open_time = 0 return if (href_list["button"]) var/button = text2num(href_list["button"]) if (button <= 3 && button >= 1) - selectedbutton = button - for (var/item in href_list) - switch(item) - if ("close", "button", "src") - continue - else - valueslist[item] = href_list[item] - opentime = 0 + selected_button = button + values_list = href_list.Copy() + values_list -= list("close", "button", "src") + open_time = 0 close() -/proc/presentpicker(mob/User,Message, Title, Button1="Ok", Button2, Button3, StealFocus = 1,Timeout = 6000,list/values, inputtype = "checkbox", width, height, slidecolor) - if (!istype(User)) - if (istype(User, /client/)) - var/client/C = User - User = C.mob - else +/proc/present_picker(mob/user, message, title, button_1 = "Ok", button_2, button_3, steal_focus = TRUE, timeout = 600 SECONDS, list/values, input_type = "checkbox", width, height, slide_color) + if (!ismob(user)) + if (!istype(user, /client)) return - var/datum/browser/modal/listpicker/A = new(User, Message, Title, Button1, Button2, Button3, StealFocus,Timeout, values, inputtype, width, height, slidecolor) - A.open() - A.wait() - if (A.selectedbutton) - return list("button" = A.selectedbutton, "values" = A.valueslist) + var/client/user_client = user + user = user_client.mob + var/datum/browser/modal/list_picker/window = new(user, message, title, button_1, button_2, button_3, steal_focus, timeout, values, input_type, width, height, slide_color) + window.open() + window.wait() + if (window.selected_button) + return list("button" = window.selected_button, "values" = window.values_list) -/proc/input_bitfield(var/mob/User, title, bitfield, current_value, nwidth = 350, nheight = 350, nslidecolor, allowed_edit_list = null) - if (!User || !(bitfield in GLOB.bitfields)) +/proc/input_bitfield(mob/user, title, bitfield, current_value, width = 350, height = 350, slide_color, allowed_edit_field = ALL) + var/list/bitflags = get_valid_bitflags(bitfield) + if (!user || !length(bitflags)) return - var/list/pickerlist = list() - for (var/i in GLOB.bitfields[bitfield]) - var/can_edit = 1 - if(!isnull(allowed_edit_list) && !(allowed_edit_list & GLOB.bitfields[bitfield][i])) - can_edit = 0 - if (current_value & GLOB.bitfields[bitfield][i]) - pickerlist += list(list("checked" = 1, "value" = GLOB.bitfields[bitfield][i], "name" = i, "allowed_edit" = can_edit)) + var/list/picker_list = list() + for (var/bit_name in bitflags) + var/bit_value = bitflags[bit_name] + // Gotta make it TRUE/FALSE sorry brother + var/can_edit = !!(allowed_edit_field & bit_value) + var/enabled = !!(current_value & bit_value) + picker_list += list(list("checked" = enabled, "value" = bit_value, "name" = bit_name, "allowed_edit" = can_edit)) + + var/list/result = present_picker(user, "", title, button_1 = "Save", button_2 = "Cancel", timeout = FALSE, values = picker_list, width = width, height = height, slide_color = slide_color) + if (!islist(result)) + return + if (result["button"] == 2) // If the user pressed the cancel button + return + + var/result_bitfield = NONE + for (var/flag_name in result["values"]) + result_bitfield |= bitflags[flag_name] + return result_bitfield + +/datum/browser/modal/pref_like_picker + var/settings = list() + var/icon/preview_icon = null + var/datum/callback/preview_update + +/datum/browser/modal/pref_like_picker/New(mob/user, message, title, steal_focus = TRUE, timeout = 600 SECONDS, list/settings, width, height) + if (!user) + return + src.settings = settings + + ..(user, ckey("[user]-[message]-[title]-[world.time]-[rand(1,10000)]"), title, width, height, src, steal_focus, timeout) + set_content(show_choices(user)) + +/datum/browser/modal/pref_like_picker/proc/show_choices(mob/user) + if (settings["preview_callback"]) + var/datum/callback/callback = settings["preview_callback"] + preview_icon = callback.Invoke(settings) + if (preview_icon) + user << browse_rsc(preview_icon, "previewicon.png") + + var/list/display_list = list() + for (var/name in settings["mainsettings"]) + var/setting = settings["mainsettings"][name] + if (setting["type"] == "datum") + if (setting["subtypesonly"]) + display_list += "[setting["desc"]]: [setting["value"]]
" + else + display_list += "[setting["desc"]]: [setting["value"]]
" else - pickerlist += list(list("checked" = 0, "value" = GLOB.bitfields[bitfield][i], "name" = i, "allowed_edit" = can_edit)) - var/list/result = presentpicker(User, "", title, Button1="Save", Button2 = "Cancel", Timeout=FALSE, values = pickerlist, width = nwidth, height = nheight, slidecolor = nslidecolor) - if (islist(result)) - if (result["button"] == 2) // If the user pressed the cancel button - return - . = 0 - for (var/flag in result["values"]) - . |= GLOB.bitfields[bitfield][flag] - else + display_list += "[setting["desc"]]: [setting["value"]]
" + + if (preview_icon) + display_list += "" + display_list += "
" + display_list += "" + + display_list += "" + display_list += "
Ok " + display_list += "
" + + return display_list.Join() + +/datum/browser/modal/pref_like_picker/Topic(href,href_list) + if (href_list["close"] || !user || !user.client) + open_time = 0 return -// -/proc/onclose(mob/user, windowid, atom/ref=null) + + if (href_list["task"] == "input") + var/setting_key = href_list["setting"] + var/list/setting = settings["mainsettings"][setting_key] + switch (href_list["type"]) + if ("datum") + var/parent_path = text2path(href_list["path"]) + var/list/paths + if (href_list["subtypesonly"]) + paths = subtypesof(parent_path) + else + paths = typesof(parent_path) + + var/new_value = pick_closest_path(null, make_types_fancy(paths)) + if (!isnull(new_value)) + setting["value"] = new_value + + if ("string") + setting["value"] = stripped_input(user, "Enter new value for [setting["desc"]]", "Enter new value for [setting["desc"]]", setting["value"]) + if ("number") + setting["value"] = input(user, "Enter new value for [setting["desc"]]", "Enter new value for [setting["desc"]]") as num + if ("color") + setting["value"] = input(user, "Enter new value for [setting["desc"]]", "Enter new value for [setting["desc"]]", setting["value"]) as color + if ("boolean") + setting["value"] = (setting["value"] == "Yes") ? "No" : "Yes" + if ("ckey") + setting["value"] = input(user, "[setting["desc"]]?") in (list("none") + GLOB.directory) + if (setting["callback"]) + var/datum/callback/callback = setting["callback"] + settings = callback.Invoke(settings) + + if (href_list["button"]) + var/button = text2num(href_list["button"]) + if (button <= 3 && button >= 1) + selected_button = button + + if (selected_button != 1) + set_content(show_choices(user)) + open() + return + + open_time = 0 + close() + +/proc/present_pref_like_picker(mob/user, message, title, steal_focus = TRUE, timeout = 600 SECONDS, list/settings, width, height) + if (!ismob(user)) + if (!istype(user, /client)) + return + var/client/user_client = user + user = user_client.mob + var/datum/browser/modal/pref_like_picker/window = new(user, message, title, steal_focus, timeout, settings, width, height) + window.open() + window.wait() + if (window.selected_button) + return list("button" = window.selected_button, "settings" = window.settings) + +/// Registers the on-close verb for a browse window (client/verb/windowclose) +/// this will be called when the close-button of a window is pressed. +/// +/// This is usually only needed for devices that regularly update the browse window, +/// e.g. canisters, timers, etc. +/// +/// windowid should be the specified window name +/// e.g. code is : user << browse(text, "window=fred") +/// then use : onclose(user, "fred") +/// +/// Optionally, specify the "source" parameter as the controlled atom (usually src) +// to pass a "close=1" parameter to the atom's Topic() proc for special handling. +/// Otherwise, the user mob's machine var will be reset directly. +/// +/proc/onclose(mob/user, windowid, atom/source = null) if(!user.client) return var/param = "null" - if(ref) - param = "[REF(ref)]" + if(source) + param = "[REF(source)]" winset(user, windowid, "on-close=\".windowclose [param]\"") - - -// the on-close client verb -// called when a browser popup window is closed after registering with proc/onclose() -// if a valid atom reference is supplied, call the atom's Topic() with "close=1" -// otherwise, just reset the client mob's machine var. -// +/// the on-close client verb +/// called when a browser popup window is closed after registering with proc/onclose() +/// if a valid atom reference is supplied, call the atom's Topic() with "close=1" +/// otherwise, just reset the client mob's machine var. /client/verb/windowclose(atomref as text) set hidden = TRUE // hide this verb from the user's panel set name = ".windowclose" // no autocomplete on cmd line - if(atomref != "null") // if passed a real atomref - var/hsrc = locate(atomref) // find the reffed atom - var/href = "close=1" - if(hsrc) - usr = src.mob - src.Topic(href, params2list(href), hsrc) // this will direct to the atom's - return // Topic() proc via client.Topic() - + if(atomref == "null") + return + // if passed a real atomref + var/atom/hsrc = locate(atomref) // find the reffed atom + var/href = "close=1" + if(!hsrc) + return + usr = src.mob + src.Topic(href, params2list(href), hsrc) // this will direct to the atom's /datum/browser/modal/color_matrix_picker var/color_matrix @@ -426,12 +549,12 @@ /datum/browser/modal/color_matrix_picker/Topic(href, list/href_list) if(href_list["close"] || !user) - opentime = 0 + open_time = 0 return if(href_list["button"]) var/button = text2num(href_list["button"]) if(ISINRANGE(button, 1, 3)) - selectedbutton = button + selected_button = button var/list/cm = rgb_construct_color_matrix( text2num(href_list["rr"]), text2num(href_list["rg"]), @@ -448,7 +571,7 @@ ) if(cm) color_matrix = cm - opentime = 0 + open_time = 0 close() /proc/color_matrix_picker(mob/user, message, title, button1 = "Ok", button2, button3, stealfocus, timeout = 10 MINUTES, list/values) @@ -461,4 +584,4 @@ var/datum/browser/modal/color_matrix_picker/B = new(user, message, title, button1, button2, button3, stealfocus, timeout, values) B.open() B.wait() - return list("button" = B.selectedbutton, "matrix" = B.color_matrix) + return list("button" = B.selected_button, "matrix" = B.color_matrix) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 5c6e94874e..2ab34c5c7a 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -114,7 +114,10 @@ if(ambitions) output += "
Ambitions: [ambitions]
" - recipient << browse("[output]","window=memory") + + var/datum/browser/popup = new(recipient, "memory", "Memory") + popup.set_content(output) + popup.open() /datum/mind/proc/edit_memory() if(!ticker || !ticker.mode) @@ -149,7 +152,10 @@ out += "None." out += "
\[add\]

" out += span_bold("Ambitions:") + " [ambitions ? ambitions : "None"] \[edit\]
" - usr << browse("[out]", "window=edit_memory[src]") + + var/datum/browser/popup = new(usr, "edit_memory[src]", "Edit Memory") + popup.set_content(out) + popup.open() /datum/mind/Topic(href, href_list) if(!check_rights(R_ADMIN|R_FUN|R_EVENT)) return diff --git a/code/game/gamemodes/cult/talisman.dm b/code/game/gamemodes/cult/talisman.dm index b7f7c4fb8b..3f226d0c9c 100644 --- a/code/game/gamemodes/cult/talisman.dm +++ b/code/game/gamemodes/cult/talisman.dm @@ -72,8 +72,10 @@ dat += "Sa tatha najin - Allows you to summon armoured robes and an unholy blade
" dat += "Kal om neth - Summons a soul stone
" dat += "Da A'ig Osk - Summons a construct shell for use with captured souls. It is too large to carry on your person.
" - usr << browse("[dat]", "window=id_com;size=350x200") - return + + var/datum/browser/popup = new(usr, "id_com", "Talisman", 350, 200) + popup.set_content(dat) + popup.open() /obj/item/paper/talisman/Topic(href, href_list) diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm index 677801f2c1..1be8db04fd 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/HELPERS.dm @@ -68,7 +68,9 @@ if(!help) help = "Error loading help (file /ingame_manuals/malf_ai.html is probably missing). Please report this to server administration staff." - user << browse(help, "window=malf_ai_help;size=600x500") + var/datum/browser/popup = new(user, "malf_ai_help", "Malf AI Help", 600, 500) + popup.set_content(help) + popup.open() // Verb: ai_select_research() diff --git a/code/game/gamemodes/sandbox/h_sandbox.dm b/code/game/gamemodes/sandbox/h_sandbox.dm index 7cb9336bff..42ae36dfa9 100644 --- a/code/game/gamemodes/sandbox/h_sandbox.dm +++ b/code/game/gamemodes/sandbox/h_sandbox.dm @@ -43,7 +43,10 @@ mob hsbpanel += "- [hrefs[T]]
" if(hsboxspawn) hsbpanel += "- Spawn Object

" - usr << browse("[hsbpanel]", "window=hsbpanel") + + var/datum/browser/popup = new(usr, "hsbpanel", "HSB Panel") + popup.set_content(hsbpanel) + popup.open() Topic(href, href_list) if(!(src.owner == usr.ckey)) return if(!usr) return //I guess this is possible if they log out or die with the panel open? It happened. diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index 8bdd15b0b2..cb087a8ea8 100644 --- a/code/game/machinery/ai_slipper.dm +++ b/code/game/machinery/ai_slipper.dm @@ -83,8 +83,8 @@ t += text("Dispenser [] - []?
\n", disabled?"deactivated":"activated", src, disabled?"Enable":"Disable") t += text("Uses Left: [uses]. Activate the dispenser?
\n") - user << browse("[t]", "window=computer;size=575x450") - onclose(user, "computer") + user << browse("[t]", "window=ai_slipper;size=575x450") + onclose(user, "ai_slipper") return /obj/machinery/ai_slipper/Topic(href, href_list) diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm index 994c6bd0ea..d3a6d28116 100644 --- a/code/game/machinery/computer/pod.dm +++ b/code/game/machinery/computer/pod.dm @@ -113,7 +113,7 @@ if(..()) return - var/dat = "[title]" + var/dat = "[title]" user.set_machine(src) if(connected) var/d2 @@ -134,11 +134,11 @@ dat += "
\nPower Level: [temp]
\nFiring Sequence
\nTest Fire Driver
\nToggle Outer Door
" else dat += "
\nToggle Outer Door
" - dat += "

Close
" - user << browse(dat, "window=computer;size=400x500") + dat += "

Close
" add_fingerprint(user) - onclose(user, "computer") - return + var/datum/browser/popup = new(user, "pod_computer", "Pod Computer", 400, 500) + popup.set_content(dat) + popup.open() /obj/machinery/computer/pod/process() diff --git a/code/game/machinery/computer/specops_shuttle.dm b/code/game/machinery/computer/specops_shuttle.dm index e87c5e1232..71f0a3fe6a 100644 --- a/code/game/machinery/computer/specops_shuttle.dm +++ b/code/game/machinery/computer/specops_shuttle.dm @@ -270,9 +270,9 @@ var/specops_shuttle_timeleft = 0 [specops_shuttle_moving_to_station || specops_shuttle_moving_to_centcom ? "\n*The Special Ops. shuttle is already leaving.*
\n
":specops_shuttle_at_station ? "\nShuttle standing by...
\n
":"\nDepart to [station_name()]
\n
"] \nClose"} - user << browse("[dat]", "window=computer;size=575x450") - onclose(user, "computer") - return + var/datum/browser/popup = new(usr, "computer", "Computer", 575, 450) + popup.set_content(dat) + popup.open() /obj/machinery/computer/specops_shuttle/Topic(href, href_list) if(..()) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 09bf6c021d..5d545a6cf0 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -137,9 +137,9 @@ Transponder Codes: