owned this note
owned this note
Published
Linked with GitHub
# Final Transition to TGUI
TGUI currently grants us many positives, but since we still have HTML UIs, we have a ton of unmaintained code. This goes over the largest offenders of code untouched for many years, and what we can do to remove them.
### updateUsrDialog
updateUsrDialog will check for mobs w/ a client next to itself, and update the UI for those mobs, then it will check if the person calling it can use it. If anything is true, it will update their UI, and set its ``IN_USE`` flag on.
This is not needed with TGUI, as it handles all of this for us, so we should aim to move the current uses of it to TGUI.
### updateDialog
If a machine is ``IN_USE``, calling this will update the UI for everyone currently on the AI, assuming the mob's machine is set to that UI. Like above, we should move these to TGUI so we can remove these instances.
### machine var (mob)
This is a mob-level define that holds reference to a machine that it's supposed to be using. This is bad, and once everything is turned into TGUI, this should be removed. Because this only has reference to one machine (not a weakref either), opening 2 UIs means that the old one will stop updating, which is a pretty bad exploit but with how few machines use non-TGUI UIs, I don't think anything malicious could be done with it anymore. This is how people would manage to make clone records of themselves back in the day, btw.
This var is set in ``set_machine()`` and unset in ``unset_machine()``, which are mob-level procs.
### IN_USE
``IN_USE``'s sole purpose is to be checked to know whether a machine is being used or not, to check whether it should update people's UIs.
Things that use ``IN_USE`` obj_flag
``set_machine()``
``unset_machine``
``updateUsrDialog()``
``updateDialog()``
When these procs are all fully deprecated and removed, we can also remove this flag as well.
### Unused procs
These procs are related to these HTML windows but are completely unused. When we're done moving all of these away to HTML and we're cleaning up all the procs that used it, these should also be removed:
- ``updateSelfDialog()``
- ``on_unset_machine(mob/user)``
### Snowflake songs
``/datum/song`` uses a lot of these bad procs such as ``updateDialog``, but they do not use the obj procs, instead they redefine it on the song datum and does not use much of the code mentioned here (such as ``IN_USE``), instead using a lesser-version copy paste variant of it that should be removed because it doesn't follow the rules that HTML windows were supposed to.
This is very poor and should be removed, especially as it is paired with ``/obj/item/instrument`` which does use ``set_machine``.
### Last Notes
Helping remove this is a good idea for people who just want to convert things to TGUI or make parts of the game more accessible (the ice cream vat for example is pretty annoying for new players to learn).
Doing this on my own would probably span out months at best, so any help would be appreciated.
### Completed
Just so I am not leaving a bunch of dead links once we're done, here's a list of all things that has been mentioned here, but was removed from being refactored away from using HTML windows:
- ``/obj/item/areaeditor`` (https://github.com/tgstation/tgstation/pull/82565)
- ``/obj/machinery/computer/arcade/battle`` (https://github.com/tgstation/tgstation/pull/81810)
- ``/obj/item/instrument`` (https://github.com/tgstation/tgstation/pull/81923)
- ``/obj/machinery/computer/arena`` (https://github.com/tgstation/tgstation/pull/81707)
- ``/obj/machinery/computer/slot_machine`` (https://github.com/tgstation/tgstation/pull/81700)
- ``/obj/machinery/rnd/experimentor`` (https://github.com/tgstation/tgstation/pull/81157)
- ``/obj/machinery/computer/telecomms/monitor`` - (https://github.com/tgstation/tgstation/pull/75460 & https://github.com/tgstation/tgstation/pull/81111)
- ``/obj/item/newspaper`` (https://github.com/tgstation/tgstation/pull/80991)
- ``/obj/machinery/mineral/processing_unit_console`` (https://github.com/tgstation/tgstation/pull/81029)
- ``/obj/machinery/power/generator`` (https://github.com/tgstation/tgstation/pull/81044)
- ``/obj/machinery/door_buttons/airlock_controller`` (https://github.com/tgstation/tgstation/pull/81050)
- ``obj/item/implantpad`` (https://github.com/tgstation/tgstation/pull/80978)
- ``/obj/machinery/icecream_vat`` (https://github.com/tgstation/tgstation/pull/80965)
- ``/obj/machinery/ore_silo`` (https://github.com/tgstation/tgstation/pull/80975)
- ``/obj/item/storage/secure/safe`` (https://github.com/tgstation/tgstation/pull/79594)
- ``/obj/machinery/rnd/destructive_analyzer`` (https://github.com/tgstation/tgstation/pull/79572)
- ``/obj/machinery/computer/prisoner`` (https://github.com/tgstation/tgstation/pull/79882)
- ``/obj/machinery/computer/rdservercontrol`` (https://github.com/tgstation/tgstation/pull/72987)
- ``/obj/item/camera_bug`` (https://github.com/tgstation/tgstation/pull/77713)
###### tags: `TGstation`