Files
Bubberstation/code/controllers/subsystem/tgui.dm
Aleksej Komarov 602270d178 tgui: MIT License (#50969)
* MIT license headers

* various tweaks

- Tweak jsdoc headers a bit
- Use an old-school format with SPDX-License-Identifier for SCSS
- Add headers to tgui dmcode

* Simplify the license section

* Rebuild tgui, small tweaks

Co-authored-by: ZeWaka <zewakagamer@gmail.com>

About The Pull Request

All relevant source code now contains copyright headers, that explicitly assert copyright and license for every file.

This has been done to prepare TGUI for wider adoption. Goon station devs are interested in using TGUI, and hopefully this will result in a nice collaboration and improvements to both codebases.

The following files were relicensed under MIT:

    code/controllers/subsystem/tgui.dm
    code/modules/tgui/*.dm
    tgui/**/*.js
    tgui/**/*.scss

The following files were kept untouched:

    tgui/packages/tgui/interfaces/**/*.js
    tgui/packages/tgui/styles/interfaces/**/*.scss

Project is still basically AGPL-3.0 under /tg/station's parent license (with added MIT texts), but allows importing MIT code into MIT-compatible codebases.
2020-05-11 10:32:52 +12:00

42 lines
1.1 KiB
Plaintext

/**
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
SUBSYSTEM_DEF(tgui)
name = "tgui"
wait = 9
flags = SS_NO_INIT
priority = FIRE_PRIORITY_TGUI
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun = list()
var/list/open_uis = list() // A list of open UIs, grouped by src_object and ui_key.
var/list/processing_uis = list() // A list of processing UIs, ungrouped.
var/basehtml // The HTML base used for all UIs.
/datum/controller/subsystem/tgui/PreInit()
basehtml = file2text('tgui/packages/tgui/public/tgui.html')
/datum/controller/subsystem/tgui/Shutdown()
close_all_uis()
/datum/controller/subsystem/tgui/stat_entry()
..("P:[processing_uis.len]")
/datum/controller/subsystem/tgui/fire(resumed = 0)
if (!resumed)
src.currentrun = processing_uis.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/tgui/ui = currentrun[currentrun.len]
currentrun.len--
if(ui && ui.user && ui.src_object)
ui.process()
else
processing_uis.Remove(ui)
if (MC_TICK_CHECK)
return