/datum/tgui
Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
tgui datum (represents a UI).
Vars | |
autoupdate | Update the UI every MC tick. |
---|---|
closing | Stops further updates when close() was called. |
initialized | If the UI has been initialized yet. |
interface | The interface (template) to be used for this UI. |
opened_at | Time of opening the window. |
src_object | The object which owns the UI. |
state | Topic state used to determine status/interactability. |
status | The status/visibility of the UI. |
title | The title of te UI. |
user | The mob who opened/is using the UI. |
window | The window_id for browse() and onclose(). |
window_key | Key that is used for remembering the window geometry. |
window_size | Deprecated: Window size. |
Procs | |
New | public |
close | public |
get_payload | private |
on_message | private |
open | public |
process | private |
process_status | private |
send_asset | public |
send_full_update | public |
send_update | public |
set_autoupdate | public |
set_state | public |
Var Details
autoupdate
Update the UI every MC tick.
closing
Stops further updates when close() was called.
initialized
If the UI has been initialized yet.
interface
The interface (template) to be used for this UI.
opened_at
Time of opening the window.
src_object
The object which owns the UI.
state
Topic state used to determine status/interactability.
status
The status/visibility of the UI.
title
The title of te UI.
user
The mob who opened/is using the UI.
window
The window_id for browse() and onclose().
window_key
Key that is used for remembering the window geometry.
window_size
Deprecated: Window size.
Proc Details
New
public
Create a new UI.
required user mob The mob who opened/is using the UI. required src_object datum The object or datum which owns the UI. required interface string The interface used to render the UI. optional title string The title of the UI. optional ui_x int Deprecated: Window width. optional ui_y int Deprecated: Window height.
return datum/tgui The requested UI.
close
public
Close the UI.
optional can_be_suspended bool
get_payload
private
Package the data to send to the UI, as JSON.
return list
on_message
private
Callback for handling incoming tgui messages.
open
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.
process
private
Run an update cycle for this UI. Called internally by SStgui every second or so.
process_status
private
Updates the status, and returns TRUE if status has changed.
send_asset
public
Makes an asset available to use in tgui.
required asset datum/asset
return bool - true if an asset was actually sent
send_full_update
public
Send a full update to the client (includes static data).
optional custom_data list Custom data to send instead of ui_data. optional force bool Send an update even if UI is not interactive.
send_update
public
Send a partial update to the client (excludes static data).
optional custom_data list Custom data to send instead of ui_data. optional force bool Send an update even if UI is not interactive.
set_autoupdate
public
Enable/disable auto-updating of the UI.
required value bool Enable/disable auto-updating.
set_state
public
Replace current ui.state with a new one.
required state datum/ui_state/state Next state