/tg/ Station 13 - Modules - TypesVar Details - Proc Details

/datum/tgui

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

tgui datum (represents a UI).

Vars

autoupdateUpdate the UI every MC tick.
closingStops further updates when close() was called.
initializedIf the UI has been initialized yet.
interfaceThe interface (template) to be used for this UI.
opened_atTime of opening the window.
src_objectThe object which owns the UI.
stateTopic state used to determine status/interactability.
statusThe status/visibility of the UI.
titleThe title of te UI.
userThe mob who opened/is using the UI.
windowThe window_id for browse() and onclose().
window_keyKey that is used for remembering the window geometry.
window_sizeDeprecated: Window size.

Procs

Newpublic
closepublic
get_payloadprivate
on_messageprivate
openpublic
processprivate
process_statusprivate
send_assetpublic
send_full_updatepublic
send_updatepublic
set_autoupdatepublic
set_statepublic

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).

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