mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 16:42:13 +00:00
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
237 lines
5.7 KiB
Plaintext
237 lines
5.7 KiB
Plaintext
/*!
|
|
* External tgui definitions, such as src_object APIs.
|
|
*
|
|
* Copyright (c) 2020 Aleksej Komarov
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Used to open and update UIs.
|
|
* If this proc is not implemented properly, the UI will not update correctly.
|
|
*
|
|
* required user mob The mob who opened/is using the UI.
|
|
* optional ui datum/tgui The UI to be updated, if it exists.
|
|
*/
|
|
/datum/proc/ui_interact(mob/user, datum/tgui/ui)
|
|
return FALSE // Not implemented.
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Data to be sent to the UI.
|
|
* This must be implemented for a UI to work.
|
|
*
|
|
* required user mob The mob interacting with the UI.
|
|
*
|
|
* return list Data to be sent to the UI.
|
|
*/
|
|
/datum/proc/ui_data(mob/user)
|
|
return list() // Not implemented.
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Static Data to be sent to the UI.
|
|
*
|
|
* Static data differs from normal data in that it's large data that should be
|
|
* sent infrequently. This is implemented optionally for heavy uis that would
|
|
* be sending a lot of redundant data frequently. Gets squished into one
|
|
* object on the frontend side, but the static part is cached.
|
|
*
|
|
* required user mob The mob interacting with the UI.
|
|
*
|
|
* return list Statuic Data to be sent to the UI.
|
|
*/
|
|
/datum/proc/ui_static_data(mob/user)
|
|
return list()
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Forces an update on static data. Should be done manually whenever something
|
|
* happens to change static data.
|
|
*
|
|
* required user the mob currently interacting with the ui
|
|
* optional ui ui to be updated
|
|
*/
|
|
/datum/proc/update_static_data(mob/user, datum/tgui/ui)
|
|
if(!ui)
|
|
ui = SStgui.get_open_ui(user, src)
|
|
if(ui)
|
|
ui.send_full_update()
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Will force an update on static data for all viewers.
|
|
* Should be done manually whenever something happens to
|
|
* change static data.
|
|
*/
|
|
/datum/proc/update_static_data_for_all_viewers()
|
|
for (var/datum/tgui/window as anything in SStgui.open_uis_by_src[text_ref(src)])
|
|
window.send_full_update()
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Called on a UI when the UI receieves a href.
|
|
* Think of this as Topic().
|
|
*
|
|
* required action string The action/button that has been invoked by the user.
|
|
* required params list A list of parameters attached to the button.
|
|
*
|
|
* return bool If the user's input has been handled and the UI should update.
|
|
*/
|
|
/datum/proc/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
SHOULD_CALL_PARENT(TRUE)
|
|
SEND_SIGNAL(src, COMSIG_UI_ACT, usr, action)
|
|
// If UI is not interactive or usr calling Topic is not the UI user, bail.
|
|
if(!ui || ui.status != UI_INTERACTIVE)
|
|
return TRUE
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Called on an object when a tgui object is being created, allowing you to
|
|
* push various assets to tgui, for examples spritesheets.
|
|
*
|
|
* return list List of asset datums or file paths.
|
|
*/
|
|
/datum/proc/ui_assets(mob/user)
|
|
return list()
|
|
|
|
/**
|
|
* private
|
|
*
|
|
* The UI's host object (usually src_object).
|
|
* This allows modules/datums to have the UI attached to them,
|
|
* and be a part of another object.
|
|
*/
|
|
/datum/proc/ui_host(mob/user)
|
|
return src // Default src.
|
|
|
|
/**
|
|
* private
|
|
*
|
|
* The UI's state controller to be used for created uis
|
|
* This is a proc over a var for memory reasons
|
|
*/
|
|
/datum/proc/ui_state(mob/user)
|
|
return default_state
|
|
|
|
/**
|
|
* global
|
|
*
|
|
* Associative list of JSON-encoded shared states that were set by
|
|
* tgui clients.
|
|
*/
|
|
/datum/var/list/tgui_shared_states
|
|
|
|
/**
|
|
* global
|
|
*
|
|
* Tracks open UIs for a user.
|
|
*/
|
|
/mob/var/list/tgui_open_uis = list()
|
|
|
|
/**
|
|
* global
|
|
*
|
|
* Tracks open windows for a user.
|
|
*/
|
|
/client/var/list/tgui_windows = list()
|
|
|
|
/**
|
|
* global
|
|
*
|
|
* TRUE if cache was reloaded by tgui dev server at least once.
|
|
*/
|
|
/client/var/tgui_cache_reloaded = FALSE
|
|
|
|
/**
|
|
* public
|
|
*
|
|
* Called on a UI's object when the UI is closed, not to be confused with
|
|
* client/verb/uiclose(), which closes the ui window
|
|
*/
|
|
/datum/proc/ui_close(mob/user)
|
|
SIGNAL_HANDLER
|
|
|
|
/**
|
|
* verb
|
|
*
|
|
* Called by UIs when they are closed.
|
|
* Must be a verb so winset() can call it.
|
|
*
|
|
* required uiref ref The UI that was closed.
|
|
*/
|
|
/client/verb/uiclose(window_id as text)
|
|
// Name the verb, and hide it from the user panel.
|
|
set name = "uiclose"
|
|
set hidden = TRUE
|
|
var/mob/user = src?.mob
|
|
if(!user)
|
|
return
|
|
// Close all tgui datums based on window_id.
|
|
SStgui.force_close_window(user, window_id)
|
|
|
|
/**
|
|
* Middleware for /client/Topic.
|
|
*
|
|
* return bool If TRUE, prevents propagation of the topic call.
|
|
*/
|
|
/proc/tgui_Topic(href_list)
|
|
// Skip non-tgui topics
|
|
if(!href_list["tgui"])
|
|
return FALSE
|
|
var/type = href_list["type"]
|
|
// Unconditionally collect tgui logs
|
|
if(type == "log")
|
|
var/context = href_list["window_id"]
|
|
if (href_list["ns"])
|
|
context += " ([href_list["ns"]])"
|
|
log_tgui(usr, href_list["message"],
|
|
context = context)
|
|
// Reload all tgui windows
|
|
if(type == "cacheReloaded")
|
|
if(!check_rights(R_ADMIN) || usr.client.tgui_cache_reloaded)
|
|
return TRUE
|
|
// Mark as reloaded
|
|
usr.client.tgui_cache_reloaded = TRUE
|
|
// Notify windows
|
|
var/list/windows = usr.client.tgui_windows
|
|
for(var/window_id in windows)
|
|
var/datum/tgui_window/window = windows[window_id]
|
|
if (window.status == TGUI_WINDOW_READY)
|
|
window.on_message(type, null, href_list)
|
|
return TRUE
|
|
// Locate window
|
|
var/window_id = href_list["window_id"]
|
|
var/datum/tgui_window/window
|
|
if(window_id)
|
|
window = usr.client.tgui_windows[window_id]
|
|
if(!window)
|
|
log_tgui(usr,
|
|
"Error: Couldn't find the window datum, force closing.",
|
|
context = window_id)
|
|
SStgui.force_close_window(usr, window_id)
|
|
return TRUE
|
|
|
|
// Decode payload
|
|
var/payload
|
|
if(href_list["payload"])
|
|
var/payload_text = href_list["payload"]
|
|
|
|
if (!rustg_json_is_valid(payload_text))
|
|
log_tgui(usr, "Error: Invalid JSON")
|
|
return TRUE
|
|
|
|
payload = json_decode(payload_text)
|
|
|
|
// Pass message to window
|
|
if(window)
|
|
window.on_message(type, payload, href_list)
|
|
return TRUE
|