mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Reorganizing the non-game UI (#95383)
This commit is contained in:
@@ -256,5 +256,7 @@
|
||||
/// The DPI scale of the client. 1 is equivalent to 100% window scaling, 2 will be 200% window scaling
|
||||
var/window_scaling
|
||||
|
||||
var/datum/tgui_window/stat_panel
|
||||
|
||||
/// OOC colour of the clients messages.
|
||||
var/ooc_colour = null
|
||||
|
||||
@@ -557,8 +557,6 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
|
||||
to_chat(src, span_info("You have unread updates in the changelog."))
|
||||
if(CONFIG_GET(flag/aggressive_changelog))
|
||||
changelog()
|
||||
else
|
||||
winset(src, "infobuttons.changelog", "font-style=bold")
|
||||
|
||||
if(ckey in GLOB.clientmessages)
|
||||
for(var/message in GLOB.clientmessages[ckey])
|
||||
@@ -578,19 +576,16 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
|
||||
if(!tooltips)
|
||||
tooltips = new /datum/tooltip(src)
|
||||
|
||||
if (!interviewee)
|
||||
initialize_menus()
|
||||
|
||||
loot_panel = new(src)
|
||||
|
||||
view_size = new(src)
|
||||
set_fullscreen(logging_in = TRUE)
|
||||
view_size.resetFormat()
|
||||
view_size.setZoomMode()
|
||||
view_size.apply()
|
||||
Master.UpdateTickRate()
|
||||
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CLIENT_CONNECT, src)
|
||||
fully_created = TRUE
|
||||
set_fullscreen()
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
@@ -1118,29 +1113,6 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
|
||||
return
|
||||
to_chat(src, span_userdanger("Statpanel failed to load, click <a href='byond://?src=[REF(src)];reload_statbrowser=1'>here</a> to reload the panel "))
|
||||
|
||||
/**
|
||||
* Initializes dropdown menus on client
|
||||
*/
|
||||
/client/proc/initialize_menus()
|
||||
var/list/topmenus = GLOB.menulist[/datum/verbs/menu]
|
||||
for (var/thing in topmenus)
|
||||
var/datum/verbs/menu/topmenu = thing
|
||||
var/topmenuname = "[topmenu]"
|
||||
if (topmenuname == "[topmenu.type]")
|
||||
var/list/tree = splittext(topmenuname, "/")
|
||||
topmenuname = tree[tree.len]
|
||||
winset(src, "[topmenu.type]", "parent=menu;name=[url_encode(topmenuname)]")
|
||||
var/list/entries = topmenu.Generate_list(src)
|
||||
for (var/child in entries)
|
||||
winset(src, "[child]", "[entries[child]]")
|
||||
if (!ispath(child, /datum/verbs/menu))
|
||||
var/procpath/verbpath = child
|
||||
if (verbpath.name[1] != "@")
|
||||
new child(src)
|
||||
|
||||
// Place Help back at the end.
|
||||
winset(src, "help-menu", "index=1000")
|
||||
|
||||
/client/proc/open_filter_editor(atom/in_atom)
|
||||
if(holder)
|
||||
holder.filterrific = new /datum/filter_editor(in_atom)
|
||||
@@ -1154,13 +1126,13 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
|
||||
|
||||
/client/proc/set_right_click_menu_mode(shift_only)
|
||||
if(shift_only)
|
||||
winset(src, "mapwindow.map", "right-click=true")
|
||||
winset(src, "ShiftUp", "is-disabled=false")
|
||||
winset(src, "Shift", "is-disabled=false")
|
||||
winset(src, SKIN_MAPWINDOW_MAP, "right-click=true")
|
||||
winset(src, SKIN_DEFAULT_SHIFTUP, "is-disabled=false")
|
||||
winset(src, SKIN_DEFAULT_SHIFT, "is-disabled=false")
|
||||
else
|
||||
winset(src, "mapwindow.map", "right-click=false")
|
||||
winset(src, "default.Shift", "is-disabled=true")
|
||||
winset(src, "default.ShiftUp", "is-disabled=true")
|
||||
winset(src, SKIN_MAPWINDOW_MAP, "right-click=false")
|
||||
winset(src, SKIN_DEFAULT_SHIFT, "is-disabled=true")
|
||||
winset(src, SKIN_DEFAULT_SHIFTUP, "is-disabled=true")
|
||||
|
||||
/client/proc/update_ambience_pref(value)
|
||||
if(value)
|
||||
@@ -1229,15 +1201,8 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
|
||||
prefs.write_preference(GLOB.preference_entries[/datum/preference/toggle/fullscreen_mode], !is_on)
|
||||
set_fullscreen()
|
||||
|
||||
/client/proc/set_fullscreen(logging_in = FALSE)
|
||||
var/fullscreen = prefs?.read_preference(/datum/preference/toggle/fullscreen_mode)
|
||||
//no need to set every login to not fullscreen, they already aren't.
|
||||
//we also dont need to call attempt_auto_fit_viewport, Login does that for us.
|
||||
if(logging_in)
|
||||
if(fullscreen)
|
||||
winset(src, "mainwindow", "menu=;is-fullscreen=[fullscreen ? "true" : "false"]")
|
||||
return
|
||||
winset(src, "mainwindow", "menu=;is-fullscreen=[fullscreen ? "true" : "false"]")
|
||||
/client/proc/set_fullscreen()
|
||||
winset(src, SKIN_MAINWINDOW, "is-fullscreen=[prefs?.read_preference(/datum/preference/toggle/fullscreen_mode) ? "true" : "false"]")
|
||||
attempt_auto_fit_viewport()
|
||||
|
||||
/// Clears the client's screen, aside from ones that opt out
|
||||
|
||||
@@ -9,3 +9,8 @@
|
||||
return FALSE
|
||||
|
||||
return is_admin(preferences.parent)
|
||||
|
||||
/datum/preference/toggle/statpanel
|
||||
savefile_key = "statpanel_open"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
default_value = TRUE
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
/datum/preference/toggle/status_bar/apply_to_client(client/client, value)
|
||||
if(isnull(client) || istype(client, /datum/client_interface)) //no winset on mock clients.
|
||||
return
|
||||
winset(client, "mapwindow.status_bar", "is-visible=[value]")
|
||||
winset(client, SKIN_MAPWINDOW_STATUS_BAR, "is-visible=[value]")
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
/datum/verbs/menu/Preferences/verb/open_character_preferences()
|
||||
/client/verb/open_character_preferences()
|
||||
set category = "OOC"
|
||||
set name = "Open Character Preferences"
|
||||
set desc = "Open Character Preferences"
|
||||
|
||||
var/datum/preferences/preferences = usr?.client?.prefs
|
||||
if (!preferences)
|
||||
if(!prefs)
|
||||
return
|
||||
prefs.current_window = PREFERENCE_TAB_CHARACTER_PREFERENCES
|
||||
prefs.update_static_data(usr)
|
||||
prefs.ui_interact(usr)
|
||||
|
||||
preferences.current_window = PREFERENCE_TAB_CHARACTER_PREFERENCES
|
||||
preferences.update_static_data(usr)
|
||||
preferences.ui_interact(usr)
|
||||
|
||||
/datum/verbs/menu/Preferences/verb/open_game_preferences()
|
||||
/client/verb/open_game_preferences()
|
||||
set category = "OOC"
|
||||
set name = "Open Game Preferences"
|
||||
set desc = "Open Game Preferences"
|
||||
|
||||
var/datum/preferences/preferences = usr?.client?.prefs
|
||||
if (!preferences)
|
||||
if(!prefs)
|
||||
return
|
||||
|
||||
preferences.current_window = PREFERENCE_TAB_GAME_PREFERENCES
|
||||
preferences.update_static_data(usr)
|
||||
preferences.ui_interact(usr)
|
||||
prefs.current_window = PREFERENCE_TAB_GAME_PREFERENCES
|
||||
prefs.update_static_data(usr)
|
||||
prefs.ui_interact(usr)
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ ADMIN_VERB(reset_ooc_color, R_FUN, "Reset Player OOC Color", "Returns player OOC
|
||||
// Calculate and apply a best estimate
|
||||
// +4 pixels are for the width of the splitter's handle
|
||||
var/pct = 100 * (desired_width + 4) / split_width
|
||||
winset(src, "mainwindow.split", "splitter=[pct]")
|
||||
winset(src, SKIN_MAINWINDOW_SPLIT, "splitter=[pct]")
|
||||
|
||||
// Apply an ever-lowering offset until we finish or fail
|
||||
var/delta
|
||||
@@ -414,7 +414,7 @@ ADMIN_VERB(reset_ooc_color, R_FUN, "Reset Player OOC Color", "Returns player OOC
|
||||
delta = -delta/2
|
||||
|
||||
pct += delta
|
||||
winset(src, "mainwindow.split", "splitter=[pct]")
|
||||
winset(src, SKIN_MAINWINDOW_SPLIT, "splitter=[pct]")
|
||||
|
||||
/// Attempt to automatically fit the viewport, assuming the user wants it
|
||||
/client/proc/attempt_auto_fit_viewport()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/client/verb/update_ping(time as num)
|
||||
set instant = TRUE
|
||||
set name = ".update_ping"
|
||||
var/ping = pingfromtime(time)
|
||||
lastping = ping
|
||||
if (!avgping)
|
||||
avgping = ping
|
||||
else
|
||||
avgping = MC_AVERAGE_SLOW(avgping, ping)
|
||||
|
||||
/client/proc/pingfromtime(time)
|
||||
return ((world.time+world.tick_lag*TICK_USAGE_REAL/100)-time)*100
|
||||
|
||||
/client/verb/display_ping(time as num)
|
||||
set instant = TRUE
|
||||
set name = ".display_ping"
|
||||
to_chat(src, span_notice("Round trip ping took [round(pingfromtime(time),1)]ms"))
|
||||
|
||||
/client/verb/ping()
|
||||
set name = "Ping"
|
||||
set category = "OOC"
|
||||
winset(src, null, "command=.display_ping+[world.time+world.tick_lag*TICK_USAGE_REAL/100]")
|
||||
@@ -0,0 +1,21 @@
|
||||
/client/verb/toggle_stat_panel()
|
||||
set name = "Toggle Stat Panel"
|
||||
set hidden = TRUE
|
||||
|
||||
//Flip it
|
||||
prefs.write_preference(GLOB.preference_entries[/datum/preference/toggle/statpanel], !prefs.read_preference(/datum/preference/toggle/statpanel))
|
||||
set_stat_panel()
|
||||
|
||||
///Sets the stat panel's visibility to the player, depending on whether they need it/have it enabled or not.
|
||||
/client/proc/set_stat_panel()
|
||||
if(prefs.read_preference(/datum/preference/toggle/statpanel) || needs_stat_panel())
|
||||
winset(src, INFOWINDOW_INFO, "left=statwindow")
|
||||
else
|
||||
winset(src, INFOWINDOW_INFO, "left=null")
|
||||
|
||||
///Returns TRUE if the player has something that necessitates the stat panel.
|
||||
/client/proc/needs_stat_panel()
|
||||
if(holder || interviewee)
|
||||
return TRUE
|
||||
. = mob.get_status_tab_items()
|
||||
return length(.) >= 2
|
||||
Reference in New Issue
Block a user