tgui
Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
tgui datum (represents a UI).
Vars | |
asset_data | Asset data to be sent with every update |
---|---|
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. |
refresh_cooldown | Rate limit client refreshes to prevent DoS. |
refreshing | Timed refreshing state |
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
asset_data
Asset data to be sent with every update
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.
refresh_cooldown
Rate limit client refreshes to prevent DoS.
refreshing
Timed refreshing state
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).
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
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