Fixes/tweaks for NanoUI. These were made by TG coders, so I'm just adding them here.

* Transfer open ui instances when transferring a user to another mob
* Runtime fixes in the NanoUI Topic and nanoclose client verb
* Return focus to the map when a NanoUI is opened
This commit is contained in:
Mark Aherne (Faerdan)
2014-01-03 23:58:44 +00:00
parent d9af451d66
commit a99a7c3dca
4 changed files with 27 additions and 3 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
var/datum/nanoui/ui = locate(uiref)
if (ui)
if (istype(ui))
ui.close()
if(ui.ref)
+22
View File
@@ -112,5 +112,27 @@
for (var/datum/nanoui/ui in user.open_uis)
ui.close();
/**
* This is called when a player transfers from one mob to another
* Transfers all open UIs to the new mob
*
* @param oldMob /mob The user's old mob
* @param newMob /mob The user's new mob
*
* @return nothing
*/
/datum/nanomanager/proc/user_transferred(var/mob/oldMob, var/mob/newMob)
if (isnull(oldMob.open_uis) || !istype(oldMob.open_uis, /list) || open_uis.len == 0)
return 0 // has no open uis
if (isnull(newMob.open_uis) || !istype(newMob.open_uis, /list))
newMob.open_uis = list()
for (var/datum/nanoui/ui in oldMob.open_uis)
ui.user = newMob
newMob.open_uis.Add(ui)
oldMob.open_uis.Cut()
return 1 // success
+2 -2
View File
@@ -135,7 +135,6 @@ nanoui is used to open and update nano browser uis
if (dist > 4)
close()
return
if ((allowed_user_stat > -1) && (user.stat > allowed_user_stat))
set_status(STATUS_DISABLED, push_update) // no updates, completely disabled (red visibility)
@@ -352,6 +351,7 @@ nanoui is used to open and update nano browser uis
window_size = "size=[width]x[height];"
update_status(0)
user << browse(get_html(), "window=[window_id];[window_size][window_options]")
winset(user, "mapwindow.map", "focus=true") // return keyboard focus to map
on_close_winset()
//onclose(user, window_id)
nanomanager.ui_opened(src)
@@ -405,7 +405,7 @@ nanoui is used to open and update nano browser uis
if (status != STATUS_INTERACTIVE || user != usr) // If UI is not interactive or usr calling Topic is not the UI user
return
if (src_object.Topic(href, href_list))
if (src_object && src_object.Topic(href, href_list))
nanomanager.update_uis(src_object) // update all UIs attached to src_object
/**