T-G-U-I
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*!
|
||||
* Copyright (c) 2020 Aleksej Komarov
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
@@ -50,7 +50,7 @@
|
||||
*/
|
||||
/datum/tgui/New(mob/user, datum/src_object, interface, title, ui_x, ui_y)
|
||||
log_tgui(user,
|
||||
"new [interface] fancy [user.client.prefs.tgui_fancy]",
|
||||
"new [interface] fancy [user?.client?.prefs.tgui_fancy]",
|
||||
src_object = src_object)
|
||||
src.user = user
|
||||
src.src_object = src_object
|
||||
@@ -67,18 +67,20 @@
|
||||
* public
|
||||
*
|
||||
* Open this UI (and initialize it with data).
|
||||
*
|
||||
* return bool - TRUE if a new pooled window is opened, FALSE in all other situations including if a new pooled window didn't open because one already exists.
|
||||
*/
|
||||
/datum/tgui/proc/open()
|
||||
if(!user.client)
|
||||
return null
|
||||
return FALSE
|
||||
if(window)
|
||||
return null
|
||||
return FALSE
|
||||
process_status()
|
||||
if(status < UI_UPDATE)
|
||||
return null
|
||||
return FALSE
|
||||
window = SStgui.request_pooled_window(user)
|
||||
if(!window)
|
||||
return null
|
||||
return FALSE
|
||||
opened_at = world.time
|
||||
window.acquire_lock(src)
|
||||
if(!window.is_ready())
|
||||
@@ -101,6 +103,8 @@
|
||||
with_static_data = TRUE))
|
||||
SStgui.on_open(src)
|
||||
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
@@ -156,7 +160,7 @@
|
||||
*/
|
||||
/datum/tgui/proc/send_asset(datum/asset/asset)
|
||||
if(!window)
|
||||
CRASH("send_asset() can only be called after open().")
|
||||
CRASH("send_asset() was called either without calling open() first or when open() did not return TRUE.")
|
||||
return window.send_asset(asset)
|
||||
|
||||
/**
|
||||
@@ -237,7 +241,7 @@
|
||||
* Run an update cycle for this UI. Called internally by SStgui
|
||||
* every second or so.
|
||||
*/
|
||||
/datum/tgui/process(force = FALSE)
|
||||
/datum/tgui/process(delta_time, force = FALSE)
|
||||
if(closing)
|
||||
return
|
||||
var/datum/host = src_object.ui_host(user)
|
||||
|
||||
Reference in New Issue
Block a user