mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 08:56:49 +01:00
Bun, Inferno->React migration (#22529)
Re-creation of https://github.com/Aurorastation/Aurora.3/pull/21046 to skip merge conflict hell. Brings us modern TGUI. **ALTERNATE TITLE: TGUI HELLSCAPE PR ABANDON ALL HOPE YE WHO ENTER HERE** - [x] Migrate build tools (javascript -> typescript, bun for package management). - [x] Upgrade all TGUI dependencies and associated root files to TG-congruent versions (axios, babel, dompurify, eslint, highlight, marked, prettier, sass, source-map, stacktrace-parser, typescript). - [x] InfernoJS -> React migrations - [x] React cleanup and polish (migrate all remaining .js files to appropriate .ts or .tsx filetype, all remaining hooks, linting, error corrections, etc.) - [ ] Test all remaining TGUI interfaces
This commit is contained in:
@@ -399,17 +399,34 @@
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/organ/internal/vaurca/preserve/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
/obj/item/organ/internal/vaurca/preserve/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "Tank", ui_x=400, ui_y=180)
|
||||
ui.open()
|
||||
|
||||
/obj/item/organ/internal/vaurca/preserve/ui_host(mob/user)
|
||||
. = ..()
|
||||
if(istype(loc,/obj/item/transfer_valve))
|
||||
return loc
|
||||
|
||||
/obj/item/organ/internal/vaurca/preserve/ui_data(mob/user)
|
||||
var/mob/living/carbon/location = null
|
||||
|
||||
if(istype(loc, /obj/item/rig))
|
||||
if(istype(loc.loc, /mob/living/carbon))
|
||||
location = loc.loc
|
||||
else if(istype(loc, /mob/living/carbon))
|
||||
location = loc
|
||||
|
||||
var/using_internal
|
||||
if(istype(location))
|
||||
if(location.internal==src)
|
||||
using_internal = 1
|
||||
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
data["tankPressure"] = round(SAFE_XGM_PRESSURE(air_contents))
|
||||
var/list/data = list()
|
||||
|
||||
data["tankPressure"] = round(XGM_PRESSURE(air_contents))
|
||||
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
|
||||
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
|
||||
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
|
||||
@@ -437,36 +454,13 @@
|
||||
if(H.head && (H.head.item_flags & ITEM_FLAG_AIRTIGHT))
|
||||
data["maskConnected"] = 1
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
ui = new(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
|
||||
// when the ui is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
// open the new ui window
|
||||
ui.open()
|
||||
// auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
return data
|
||||
|
||||
/obj/item/organ/internal/vaurca/preserve/Topic(href, href_list)
|
||||
..()
|
||||
if (usr.stat|| usr.restrained())
|
||||
return 0
|
||||
if (src.loc != usr)
|
||||
return 0
|
||||
|
||||
if (href_list["dist_p"])
|
||||
if (href_list["dist_p"] == "reset")
|
||||
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
|
||||
else if (href_list["dist_p"] == "max")
|
||||
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
|
||||
else
|
||||
var/cp = text2num(href_list["dist_p"])
|
||||
src.distribute_pressure += cp
|
||||
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
|
||||
if (href_list["stat"])
|
||||
/obj/item/organ/internal/vaurca/preserve/ui_act(action,params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(action=="toggleReleaseValve")
|
||||
if(istype(loc,/mob/living/carbon))
|
||||
var/mob/living/carbon/location = loc
|
||||
if(location.internal == src)
|
||||
@@ -476,7 +470,6 @@
|
||||
if (location.internals)
|
||||
location.internals.icon_state = "internal0"
|
||||
else
|
||||
|
||||
var/can_open_valve
|
||||
if(location.wear_mask && (location.wear_mask.item_flags & ITEM_FLAG_AIRTIGHT))
|
||||
can_open_valve = 1
|
||||
@@ -491,11 +484,12 @@
|
||||
if (location.internals)
|
||||
location.internals.icon_state = "internal1"
|
||||
else
|
||||
to_chat(usr, SPAN_NOTICE("You need something to connect to \the [src]."))
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
return 1
|
||||
|
||||
to_chat(usr, SPAN_WARNING("You need something to connect to \the [src]."))
|
||||
. = TRUE
|
||||
update_icon()
|
||||
if(action=="setReleasePressure")
|
||||
distribute_pressure = min(max(round(text2num(params["release_pressure"])), 0), TANK_MAX_RELEASE_PRESSURE)
|
||||
. = TRUE
|
||||
|
||||
/obj/item/organ/internal/vaurca/preserve/remove_air(amount)
|
||||
return air_contents.remove(amount)
|
||||
|
||||
Reference in New Issue
Block a user