Revert "12/21 modernizations from TG live"

This commit is contained in:
LetterJay
2016-12-22 22:35:44 -06:00
committed by GitHub
parent cf59ac1c3d
commit ae40d4134e
2215 changed files with 86928 additions and 707332 deletions
+2 -2
View File
@@ -20,13 +20,13 @@
if(!state)
return
if(isobserver(user))
if(istype(user, /mob/dead/observer))
// If they turn on ghost AI control, admins can always interact.
if(IsAdminGhost(user))
. = max(., UI_INTERACTIVE)
// Regular ghosts can always at least view if in range.
if(get_dist(src_object, user) < user.client.view)
if(get_dist(src_object, src) < user.client.view)
. = max(., UI_UPDATE)
// Check if the state allows interaction
+2 -2
View File
@@ -47,10 +47,10 @@
return UI_INTERACTIVE
return UI_CLOSE
/mob/living/simple_animal/default_can_use_topic(src_object)
/mob/living/simple_animal/drone/default_can_use_topic(src_object)
. = shared_ui_interaction(src_object)
if(. > UI_CLOSE)
. = min(., shared_living_ui_distance(src_object)) //simple animals can only use things they're near.
. = min(., shared_living_ui_distance(src_object)) // Drones can only use things they're near.
/mob/living/silicon/pai/default_can_use_topic(src_object)
// pAIs can only use themselves and the owner's radio.
+1 -1
View File
@@ -15,7 +15,7 @@
return UI_CLOSE
/mob/living/hands_can_use_topic(src_object)
if(is_holding(src_object))
if(src_object in get_both_hands(src))
return UI_INTERACTIVE
return UI_CLOSE
+1 -25
View File
@@ -99,23 +99,6 @@
close_count++ // Count each UI we close.
return close_count
/**
* private
*
* Close *ALL* UIs
*
* return int The number of UIs closed.
**/
/datum/subsystem/tgui/proc/close_all_uis()
var/close_count = 0
for(var/src_object_key in open_uis)
for(var/ui_key in open_uis[src_object_key])
for(var/datum/tgui/ui in open_uis[src_object_key][ui_key])
if(ui && ui.src_object && ui.user && ui.src_object.ui_host()) // Check the UI is valid.
ui.close() // Close the UI.
close_count++ // Count each UI we close.
return close_count
/**
* private
*
@@ -199,15 +182,8 @@
processing_uis.Remove(ui) // Remove it from the list of processing UIs.
if(ui.user) // If the user exists, remove it from them too.
ui.user.open_uis.Remove(ui)
var/Ukey = ui.ui_key
var/list/uis = open_uis[src_object_key][Ukey] // Remove it from the list of open UIs.
var/list/uis = open_uis[src_object_key][ui.ui_key] // Remove it from the list of open UIs.
uis.Remove(ui)
if(!uis.len)
var/list/uiobj = open_uis[src_object_key]
uiobj.Remove(Ukey)
if(!uiobj.len)
open_uis.Remove(src_object_key)
return 1 // Let the caller know we did it.
/**
+8 -16
View File
@@ -33,8 +33,6 @@
var/datum/ui_state/state = null // Topic state used to determine status/interactability.
var/datum/tgui/master_ui // The parent UI.
var/list/datum/tgui/children = list() // Children of this UI.
var/titlebar = TRUE
var/custom_browser_id = FALSE
/**
* public
@@ -53,12 +51,11 @@
*
* return datum/tgui The requested UI.
**/
/datum/tgui/New(mob/user, datum/src_object, ui_key, interface, title, width = 0, height = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state, browser_id = null)
/datum/tgui/New(mob/user, datum/src_object, ui_key, interface, title, width = 0, height = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
src.user = user
src.src_object = src_object
src.ui_key = ui_key
src.window_id = browser_id ? browser_id : "\ref[src_object]-[ui_key]"
src.custom_browser_id = browser_id ? TRUE : FALSE
src.window_id = "\ref[src_object]-[ui_key]"
set_interface(interface)
@@ -99,8 +96,7 @@
var/debugable = check_rights_for(user.client, R_DEBUG)
user << browse(get_html(debugable), "window=[window_id];[window_size][list2params(window_options)]") // Open the window.
if (!custom_browser_id)
winset(user, window_id, "on-close=\"uiclose \ref[src]\"") // Instruct the client to signal UI when the window is closed.
winset(user, window_id, "on-close=\"uiclose \ref[src]\"") // Instruct the client to signal UI when the window is closed.
SStgui.on_open(src)
/**
@@ -220,7 +216,7 @@
"style" = style,
"interface" = interface,
"fancy" = user.client.prefs.tgui_fancy,
"locked" = user.client.prefs.tgui_lock && !custom_browser_id,
"locked" = user.client.prefs.tgui_lock,
"window" = window_id,
"ref" = "\ref[src]",
"user" = list(
@@ -230,8 +226,7 @@
"srcObject" = list(
"name" = "[src_object]",
"ref" = "\ref[src_object]"
),
"titlebar" = titlebar
)
)
return config_data
@@ -273,7 +268,7 @@
switch(action)
if("tgui:initialize")
user << output(url_encode(get_json(initial_data)), "[custom_browser_id ? window_id : "[window_id].browser"]:initialize")
user << output(url_encode(get_json(initial_data)), "[window_id].browser:initialize")
initialized = TRUE
if("tgui:view")
if(params["screen"])
@@ -325,7 +320,7 @@
return // Cannot update UI, we have no visibility.
// Send the new JSON to the update() Javascript function.
user << output(url_encode(get_json(data)), "[custom_browser_id ? window_id : "[window_id].browser"]:update")
user << output(url_encode(get_json(data)), "[window_id].browser:update")
/**
* private
@@ -371,7 +366,4 @@
else
src.status = status
if(status == UI_DISABLED || push) // Update if the UI just because disabled, or a push is requested.
push_data(null, force = 1)
/datum/tgui/proc/set_titlebar(value)
titlebar = value
push_data(null, force = 1)