Skip to content

Major TGUI update #4870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 80 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a9ce194
not a bad start?
FalloutFalcon Apr 6, 2025
4675651
removes context
FalloutFalcon Apr 6, 2025
bdc8e1f
readds some terminal themeing
FalloutFalcon Apr 6, 2025
5ba2de2
flex. admin themes
FalloutFalcon Apr 6, 2025
6550275
grid to flex fixes
FalloutFalcon Apr 6, 2025
55f212f
yea
FalloutFalcon Apr 6, 2025
8d82ad7
returns the cam console and fishing .scss files
FalloutFalcon Apr 9, 2025
9a6110f
and the includes for the scss
FalloutFalcon Apr 9, 2025
6094617
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon Apr 9, 2025
3ce408d
Adds a Chat Reliability Layer (#79479) and some fix chat related stuf…
ZephyrTFA Nov 17, 2023
b177a8a
removes this ugly font
FalloutFalcon Apr 9, 2025
8372e9d
two fixes
FalloutFalcon Apr 9, 2025
78b4dcc
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 3, 2025
0e4ace2
fix
FalloutFalcon May 3, 2025
08be135
Converts uses of SIGN() to sign() (#238)
Frenjo Apr 6, 2025
f2a15e8
Adds missing byond:// to href links (#239)
Frenjo Apr 6, 2025
cee5857
Replaces all instances of the var clicker to something else
Constellado Apr 6, 2025
9c5fcde
stuff.
FalloutFalcon May 3, 2025
212a421
[516] Fixes chat settings not saving and other 516 bugs (#254)
Constellado Apr 10, 2025
cd05bb8
[516 branch] Fixes 516 issues (#287)
Constellado Apr 24, 2025
12de2d1
hrm
FalloutFalcon May 3, 2025
8141e62
message
FalloutFalcon May 3, 2025
a916812
tgs update mabye.
FalloutFalcon May 3, 2025
5318992
Revert "Converts uses of SIGN() to sign() (#238)"
FalloutFalcon May 4, 2025
eabdb22
sigh
FalloutFalcon May 4, 2025
6e68f60
light backwards compat for 515.
FalloutFalcon May 4, 2025
8ed7bf9
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 4, 2025
a7a101a
regex
FalloutFalcon May 4, 2025
e5005a2
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 5, 2025
93dc2a6
it techinicly compiles for 515. Wouldnt recommend it moving foward.
FalloutFalcon May 5, 2025
e658c04
little notice
FalloutFalcon May 5, 2025
1215be0
prettier works
FalloutFalcon May 5, 2025
bb41552
yarn install + yarn dlx @yarnpkg/sdks vscode
FalloutFalcon May 5, 2025
2c8b100
partial port of https://github.com/cmss13-devs/cmss13/pull/9054 for t…
FalloutFalcon May 5, 2025
24049ba
small fix
FalloutFalcon May 5, 2025
9568bd1
two small things
FalloutFalcon May 5, 2025
8d4dd89
jukebox works
FalloutFalcon May 5, 2025
543df66
removes resiable, partial port of https://github.com/tgstation/tgstat…
FalloutFalcon May 5, 2025
8e856ad
remove context
FalloutFalcon May 6, 2025
3872a05
partial port of https://github.com/tgstation/tgstation/pull/82000
FalloutFalcon May 6, 2025
ba1b962
cargo catalog now doesnt break when you try and add to cart
FalloutFalcon May 6, 2025
540dda5
signaler to tsx, fixing it bluescreening
FalloutFalcon May 6, 2025
6134ccc
readds events for onDrag so knobs work, stack is now tsx
FalloutFalcon May 6, 2025
fd072a8
css for chat colors
FalloutFalcon May 6, 2025
08768ce
yea
FalloutFalcon May 6, 2025
1da9053
stuff
FalloutFalcon May 6, 2025
44c3fb4
adjust smes size to fix ui
FalloutFalcon May 6, 2025
784b649
shuttle manipulator works
FalloutFalcon May 6, 2025
33b7dd8
camera console and helm work better
FalloutFalcon May 6, 2025
0e1be33
handful of fixes
FalloutFalcon May 6, 2025
fc47074
smes no longer wraps weirdly
FalloutFalcon May 6, 2025
fb5b18d
removed args
FalloutFalcon May 6, 2025
414713a
removes useLocalState for OutpostExport
FalloutFalcon May 6, 2025
7149a05
sleeper fixed
FalloutFalcon May 7, 2025
008f53d
seed extractor works (god is this only one ugly. remind to to revive …
FalloutFalcon May 7, 2025
6aec56e
you cant acctually connect with 515 anymore
FalloutFalcon May 7, 2025
0ab1e9f
https://github.com/tgstation/tgstation/pull/90416 plus skin.dmf updates
FalloutFalcon May 7, 2025
820249e
oh god please work
FalloutFalcon May 7, 2025
0b72c0d
small
FalloutFalcon May 7, 2025
fcc1bc1
this doesnt seem used at all from testing
FalloutFalcon May 7, 2025
37276e5
fridge works
FalloutFalcon May 7, 2025
19b58f5
should fix chat renaming?
FalloutFalcon May 7, 2025
7d27148
handful more map fixes
FalloutFalcon May 7, 2025
7966ab8
testing to see what might cause chat to fail
FalloutFalcon May 10, 2025
4f05204
wrong branch lol
FalloutFalcon May 10, 2025
a66da5e
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 21, 2025
67cc3ff
this pr is no longer 516 focused.
FalloutFalcon May 21, 2025
20ee0a2
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 23, 2025
f3af102
yea
FalloutFalcon May 24, 2025
9f819d5
Merge branch 'master' of https://github.com/shiptest-ss13/Shiptest in…
FalloutFalcon May 26, 2025
d72f11c
ui scale off by default
FalloutFalcon May 28, 2025
680a8db
fixes right click not working
FalloutFalcon May 28, 2025
95bff43
returns maptext to orginial. in theory.
FalloutFalcon May 28, 2025
da77bf1
Merge branch 'master' into tgui-ALL-of-it
FalloutFalcon Jun 4, 2025
047c2d9
right click wor ks as intended
FalloutFalcon Jun 4, 2025
8741fb0
reverts admin themeing stuff untill it looks better
FalloutFalcon Jun 4, 2025
6f2ea5d
never use ui_scale for right now.
FalloutFalcon Jun 4, 2025
35aafc8
ensures 515 clients acctually fill the titlebar
FalloutFalcon Jun 5, 2025
5c92193
fix sytax for this sortby, another error in accesslist however.
FalloutFalcon Jun 5, 2025
05be22e
Merge branch 'master' into tgui-ALL-of-it
FalloutFalcon Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"editor.tabSize": 4,
"eslint.nodePath": "./tgui/.yarn/sdks",
"eslint.workingDirectories": ["./tgui"],
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js",
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.cjs",
"typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ COPY dependencies.sh .
RUN apt-get update \
&& apt-get install curl -y \
&& /bin/bash -c "source dependencies.sh \
&& curl -fsSL https://deb.nodesource.com/setup_\$NODE_VERSION.x | bash -" \
&& curl -fsSL https://deb.nodesource.com/setup_\$NODE_VERSION_LTS.x | bash -" \
&& apt-get install -y nodejs

# Build TGUI, tgfonts, and the dmb
Expand Down
2 changes: 2 additions & 0 deletions bin/tgui-fix.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
call "%~dp0\..\tools\build\build.bat" --wait-on-error tgui-fix %*
4 changes: 2 additions & 2 deletions check_regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ standards:

- exactly:
[
261,
260,
"non-bitwise << uses",
'(?<!\d)(?<!\d\s)(?<!<)<<(?!=|\s\d|\d|<|\/)',
]
Expand All @@ -52,7 +52,7 @@ standards:
'\(([\t ]+([^)"\n\\]*)|([^("\n]+)[\t ]+)\)',
]

- exactly: [1, "Old-style proc references", '\.proc/(\w+)']
- exactly: [0, "Old-style proc references", '\.proc/(\w+)']
- exactly: [0, "Old-style typed proc references", '([\w/]+?)/?\.proc/(\w+)']

- no_more:
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/callbacks.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#define GLOBAL_PROC "some_magic_bullshit"
/// A shorthand for the callback datum, [documented here](datum/callback.html)
#define CALLBACK new /datum/callback

///Per the DM reference, spawn(-1) will execute the spawned code immediately until a block is met.
#define MAKE_SPAWN_ACT_LIKE_WAITFOR -1
///Create a codeblock that will not block the callstack if a block is met.
#define ASYNC spawn(MAKE_SPAWN_ACT_LIKE_WAITFOR)

//Port tgstations version of this soon - Fallcon 2025
#define INVOKE_ASYNC world.ImmediateInvokeAsync

/// like CALLBACK but specifically for verb callbacks
#define VERB_CALLBACK new /datum/callback/verb_callback
#define CALLBACK_NEW(typepath, args) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbacknew), typepath, args)
5 changes: 5 additions & 0 deletions code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* SPDX-License-Identifier: MIT
*/

/// How many chat payloads to keep in history
#define CHAT_RELIABILITY_HISTORY_SIZE 5
/// How many resends to allow before giving up
#define CHAT_RELIABILITY_MAX_RESENDS 3

#define MESSAGE_TYPE_SYSTEM "system"
#define MESSAGE_TYPE_LOCALCHAT "localchat"
#define MESSAGE_TYPE_RADIO "radio"
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK))
#define MIDNIGHT_ROLLOVER_CHECK (GLOB.rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : GLOB.midnight_rollovers)

#if DM_VERSION >= 516
#define SIGN(x) (sign(x))
#else
#define SIGN(x) ((x)!=0 ? (x) / abs(x) : 0)
#endif

#define CEILING(x, y) (-round(-(x) / (y)) * (y))

Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/// Maximum ping timeout allowed to detect zombie windows
#define TGUI_PING_TIMEOUT 4 SECONDS
/// Used for rate-limiting to prevent DoS by excessively refreshing a TGUI window
#define TGUI_REFRESH_FULL_UPDATE_COOLDOWN (1 SECONDS)

/// Window does not exist
#define TGUI_WINDOW_CLOSED 0
Expand Down
12 changes: 12 additions & 0 deletions code/__DEFINES/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
///same as above, but based on real time of day
#define ROUND_REALTIMEOFDAY ( "[REALTIMEOFDAY - SSticker.round_start_timeofday > MIDNIGHT_ROLLOVER ? "[round((REALTIMEOFDAY - SSticker.round_start_timeofday)/MIDNIGHT_ROLLOVER)]:[time2text(world.timeofday - SSticker.round_start_timeofday, "hh:mm:ss", 0)]" : time2text(world.timeofday - SSticker.round_start_timeofday, "hh:mm:ss", 0)]" )

///displays the current time into the round, with a lot of extra code just there for ensuring it looks okay after an entire day passes
//#define ROUND_TIME(...) ( "[SECTOR_TIME_PASSED() > MIDNIGHT_ROLLOVER ? "[round(SECTOR_TIME_PASSED()/MIDNIGHT_ROLLOVER)]:[gameTimestamp(wtime = SECTOR_TIME_PASSED())]" : gameTimestamp(wtime = SECTOR_TIME_PASSED())]" )

///Returns the time that has passed since the game started
#define SECTOR_TIME_PASSED(...) (world.time - SSticker.round_start_time)

/// Define that just has the current in-universe year for use in whatever context you might want to display that in. (For example, 2022 -> 2562 given a 540 year offset)
#define CURRENT_SECTOR_YEAR (GLOB.year_integer + SECTOR_YEAR_OFFSET)

/// In-universe year. Offset from ours by this much.
#define SECTOR_YEAR_OFFSET -1519

#define JANUARY 1
#define FEBRUARY 2
#define MARCH 3
Expand Down
30 changes: 9 additions & 21 deletions code/__byond_version_compat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
//Update this whenever you need to take advantage of more recent byond features
#define MIN_COMPILER_VERSION 515
#define MIN_COMPILER_BUILD 1621
#if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM)
#if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM) && !defined(OPENDREAM)
//Don't forget to update this part
#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update.
#error You need version 515.1621 or higher
#endif

// 516.1660 broke (x in vars), which breaks a lot of things.
#if (DM_VERSION == 516 && DM_BUILD == 1660)
#error This version of BYOND (516.1660) has a bug which prevents this codebase from loading properly. If possible, update your BYOND version. Otherwise, visit www.byond.com/download/build to download an older release.
#endif

// Keep savefile compatibilty at minimum supported level
#if DM_VERSION >= 515
/savefile/byond_version = 514 //TODO: Make this MIN_COMPILER_VERSION before merge
/savefile/byond_version = MIN_COMPILER_VERSION
#endif

// 515 split call for external libraries into call_ext
Expand All @@ -21,26 +26,10 @@
#define LIBCALL call_ext
#endif

// So we want to have compile time guarantees these methods exist on local type, unfortunately 515 killed the .proc/procname and .verb/verbname syntax so we have to use nameof()
// So we want to have compile time guarantees these methods exist on local type
// We use wrappers for this in case some part of the api ever changes, and to make their function more clear
// For the record: GLOBAL_VERB_REF would be useless as verbs can't be global.

#if DM_VERSION < 515

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (.proc/##X)
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
#define VERB_REF(X) (.verb/##X)

/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc
#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X)
/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb
#define TYPE_VERB_REF(TYPE, X) (##TYPE.verb/##X)

/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#else

/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
#define PROC_REF(X) (nameof(.proc/##X))
/// Call by name verb references, checks if the verb exists on either this type or as a global verb.
Expand All @@ -54,4 +43,3 @@
/// Call by name proc reference, checks if the proc is an existing global proc
#define GLOBAL_PROC_REF(X) (/proc/##X)

#endif
11 changes: 11 additions & 0 deletions code/_onclick/hud/map_popups.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@
/atom/movable/screen/proc/set_position(x, y, px = 0, py = 0)
if(assigned_map)
screen_loc = "[assigned_map]:[x]:[px],[y]:[py]"
ASYNC
// HACK: This fixes the character creator in 516 being small and relying on other byondui things (like cameras) to open in order to update and refresh.
// This also will fix the camera console screen being offset, Gateway, and admin pod panel.
// Adding 100 then setting it back seemed to do the trick!
// Why the fuck does this work? This is some byond bug and I honestly have no fucking clue why this works.
// I don't think plane master will be affected, I hope.
// We're stuck in the belly of this awful machine.
sleep(0.2 SECONDS) // If it's too fast, it has a chance to fail? Idk. This seems like a good number.
screen_loc = "[assigned_map]:[x+100]:[px],[y+100]:[py]"
sleep(0.2 SECONDS)
screen_loc = "[assigned_map]:[x]:[px],[y]:[py]"
else
screen_loc = "[x]:[px],[y]:[py]"

Expand Down
5 changes: 2 additions & 3 deletions code/controllers/globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)

var/datum/controller/exclude_these = new
// I know this is dumb but the nested vars list hangs a ref to the datum. This fixes that
// I have an issue report open, lummox has not responded. It might be a FeaTuRE
// Sooo we gotta be dumb
var/list/controller_vars = exclude_these.vars.Copy()
controller_vars["vars"] = null
gvars_datum_in_built_vars = controller_vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order))

#if MIN_COMPILER_VERSION >= 515 && MIN_COMPILER_BUILD > 1627
#warn datum.vars hanging a ref should now be fixed, there should be no reason to remove the vars list from our controller's vars list anymore
#endif
QDEL_IN(exclude_these, 0) //signal logging isn't ready
log_world("[vars.len - gvars_datum_in_built_vars.len] global variables")

Expand Down
101 changes: 80 additions & 21 deletions code/controllers/subsystem/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,93 @@

SUBSYSTEM_DEF(chat)
name = "Chat"
flags = SS_TICKER
flags = SS_TICKER|SS_NO_INIT
wait = 1
priority = FIRE_PRIORITY_CHAT
init_order = INIT_ORDER_CHAT

var/list/payload_by_client = list()
/// Assosciates a ckey with a list of messages to send to them.
var/list/list/datum/chat_payload/client_to_payloads = list()

/// Associates a ckey with an assosciative list of their last CHAT_RELIABILITY_HISTORY_SIZE messages.
var/list/list/datum/chat_payload/client_to_reliability_history = list()

/// Assosciates a ckey with their next sequence number.
var/list/client_to_sequence_number = list()

/datum/controller/subsystem/chat/proc/generate_payload(client/target, message_data)
var/sequence = client_to_sequence_number[target.ckey]
client_to_sequence_number[target.ckey] += 1

var/datum/chat_payload/payload = new
payload.sequence = sequence
payload.content = message_data

if(!(target.ckey in client_to_reliability_history))
client_to_reliability_history[target.ckey] = list()
var/list/client_history = client_to_reliability_history[target.ckey]
client_history["[sequence]"] = payload

if(length(client_history) > CHAT_RELIABILITY_HISTORY_SIZE)
var/oldest = text2num(client_history[1])
for(var/index in 2 to length(client_history))
var/test = text2num(client_history[index])
if(test < oldest)
oldest = test
client_history -= "[oldest]"
return payload

/datum/controller/subsystem/chat/proc/send_payload_to_client(client/target, datum/chat_payload/payload)
target.tgui_panel.window.send_message("chat/message", payload.into_message())

/datum/controller/subsystem/chat/fire()
for(var/key in payload_by_client)
var/client/client = key
var/payload = payload_by_client[key]
payload_by_client -= key
if(client)
// Send to tgchat
client.tgui_panel?.window.send_message("chat/message", payload)
// Send to old chat
for(var/message in payload)
SEND_TEXT(client, message_to_html(message))
for(var/ckey in client_to_payloads)
var/client/target = GLOB.directory[ckey]
if(isnull(target)) // verify client still exists
LAZYREMOVE(client_to_payloads, ckey)
continue

for(var/datum/chat_payload/payload as anything in client_to_payloads[ckey])
send_payload_to_client(target, payload)
LAZYREMOVE(client_to_payloads, ckey)

if(MC_TICK_CHECK)
return

/datum/controller/subsystem/chat/proc/queue(target, message)
if(islist(target))
for(var/_target in target)
var/client/client = CLIENT_FROM_VAR(_target)
if(client)
LAZYADD(payload_by_client[client], list(message))
/datum/controller/subsystem/chat/proc/queue(queue_target, list/message_data)
var/list/targets = islist(queue_target) ? queue_target : list(queue_target)
for(var/target in targets)
var/client/client = CLIENT_FROM_VAR(target)
if(isnull(client))
continue
LAZYADDASSOCLIST(client_to_payloads, client.ckey, generate_payload(client, message_data))

/datum/controller/subsystem/chat/proc/send_immediate(send_target, list/message_data)
var/list/targets = islist(send_target) ? send_target : list(send_target)
for(var/target in targets)
var/client/client = CLIENT_FROM_VAR(target)
if(isnull(client))
continue
send_payload_to_client(client, generate_payload(client, message_data))

/datum/controller/subsystem/chat/proc/handle_resend(client/client, sequence)
var/list/client_history = client_to_reliability_history[client.ckey]
sequence = "[sequence]"
if(isnull(client_history) || !(sequence in client_history))
return
var/client/client = CLIENT_FROM_VAR(target)
if(client)
LAZYADD(payload_by_client[client], list(message))

var/datum/chat_payload/payload = client_history[sequence]
if(payload.resends > CHAT_RELIABILITY_MAX_RESENDS)
return // we tried but byond said no

payload.resends += 1
send_payload_to_client(client, client_history[sequence])
SSblackbox.record_feedback(
"nested tally",
"chat_resend_byond_version",
1,
list(
"[client.byond_version]",
"[client.byond_build]",
),
)
Loading
Loading