Skip to content

Commit

Permalink
Merge branch 'TGUIv4-TestMerge' of https://github.com/Aylong220/Parad…
Browse files Browse the repository at this point in the history
…ise-SS220 into tgui4-translate
  • Loading branch information
Legendaxe committed Jan 14, 2024
2 parents 073fd76 + 3576060 commit 7511bb9
Show file tree
Hide file tree
Showing 797 changed files with 39,355 additions and 26,995 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"eamodio.gitlens",
"usernamehw.errorlens",
"anturk.dmi-editor",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"arcanis.vscode-zipfs"
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
],
// ESLint settings:
"eslint.workingDirectories": [
"tgui/"
"./tgui"
],
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": "tgui/.yarn/sdks",
"prettier.prettierPath": "tgui/.yarn/sdks/prettier/index.cjs",
"typescript.tsdk": "tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.rules.customizations": [
// We really want to fail the CI builds on styling errors,
// but it's better to show them as yellow squigglies in IDE
Expand Down
15 changes: 1 addition & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"type": "shell",
"command": "tgui/bin/tgui-build",
"windows": {
"command": ".\\tgui\\bin\\tgui-build.bat"
"command": ".\\tgui\\bin\\tgui.bat"
},
"problemMatcher": [
"$tsc",
Expand All @@ -37,18 +37,5 @@
"label": "tgui: run dev server"
}
,
{
"type": "shell",
"command": "tgui/bin/tgui-formatting",
"windows": {
"command": ".\\tgui\\bin\\tgui-formatting.bat"
},
"problemMatcher": [
"$tsc",
"$eslint-stylish"
],
"group": "build",
"label": "tgui: run prettier formatting"
}
]
}
2 changes: 1 addition & 1 deletion _build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For dreamchecker
export SPACEMANDMM_TAG=suite-1.7.1
# For TGUI
export NODE_VERSION=18
export NODE_VERSION=20
# Stable Byond Major
export STABLE_BYOND_MAJOR=515
# Stable Byond Minor
Expand Down
25 changes: 25 additions & 0 deletions code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2020 Aleksej Komarov
* 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"
#define MESSAGE_TYPE_INFO "info"
#define MESSAGE_TYPE_WARNING "warning"
#define MESSAGE_TYPE_DEADCHAT "deadchat"
#define MESSAGE_TYPE_OOC "ooc"
#define MESSAGE_TYPE_ADMINPM "adminpm"
#define MESSAGE_TYPE_COMBAT "combat"
#define MESSAGE_TYPE_ADMINCHAT "adminchat"
#define MESSAGE_TYPE_MENTORCHAT "mentorchat"
#define MESSAGE_TYPE_EVENTCHAT "eventchat"
#define MESSAGE_TYPE_ADMINLOG "adminlog"
#define MESSAGE_TYPE_ATTACKLOG "attacklog"
#define MESSAGE_TYPE_DEBUG "debug"
1 change: 1 addition & 0 deletions code/__DEFINES/chat_box_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define chat_box_examine(str) ("<div class='boxed_message left_align_text'>" + str + "</div>")
#define chat_box_red(str) ("<div class='boxed_message red_border'>" + str + "</div>")
#define chat_box_green(str) ("<div class='boxed_message green_border'>" + str + "</div>")
#define chat_box_purple(str) ("<div class='boxed_message purple_border'>" + str + "</div>")
#define chat_box_notice(str) ("<div class='boxed_message notice_border'>" + str + "</div>")
#define chat_box_healthscan(str) ("<div class='boxed_message notice_border left_align_text'>" + str + "</div>")
#define chat_box_notice_thick(str) ("<div class='boxed_message notice_border thick_border'>" + str + "</div>")
26 changes: 13 additions & 13 deletions code/__DEFINES/construction_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@
#define FULLTILE_WINDOW_DIR NORTHEAST

//Material defines, for determining how much of a given material an item contains
#define MAT_METAL "$metal"
#define MAT_GLASS "$glass"
#define MAT_SILVER "$silver"
#define MAT_GOLD "$gold"
#define MAT_DIAMOND "$diamond"
#define MAT_URANIUM "$uranium"
#define MAT_PLASMA "$plasma"
#define MAT_BLUESPACE "$bluespace"
#define MAT_BANANIUM "$bananium"
#define MAT_TRANQUILLITE "$tranquillite"
#define MAT_TITANIUM "$titanium"
#define MAT_BIOMASS "$biomass"
#define MAT_PLASTIC "$plastic"
#define MAT_METAL "metal"
#define MAT_GLASS "glass"
#define MAT_SILVER "silver"
#define MAT_GOLD "gold"
#define MAT_DIAMOND "diamond"
#define MAT_URANIUM "uranium"
#define MAT_PLASMA "plasma"
#define MAT_BLUESPACE "bluespace"
#define MAT_BANANIUM "bananium"
#define MAT_TRANQUILLITE "tranquillite"
#define MAT_TITANIUM "titanium"
#define MAT_BIOMASS "biomass"
#define MAT_PLASTIC "plastic"
//The amount of materials you get from a sheet of mineral like iron/diamond/glass etc
#define MINERAL_MATERIAL_AMOUNT 2000
//The maximum size of a stack object.
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/misc_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@
#define TRIGGER_GUARD_NONE 0
#define TRIGGER_GUARD_NORMAL 1

#define CLIENT_FROM_VAR(I) (ismob(I) ? I:client : (istype(I, /client) ? I : (istype(I, /datum/mind) ? I:current?:client : null)))

// Macro to get the current elapsed round time, rather than total world runtime
#define ROUND_TIME (SSticker.time_game_started ? (world.time - SSticker.time_game_started) : 0)

Expand Down
6 changes: 0 additions & 6 deletions code/__DEFINES/stat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
#define UNCONSCIOUS 1
#define DEAD 2

// TGUI flags
#define STATUS_INTERACTIVE 2 // GREEN Visability
#define STATUS_UPDATE 1 // ORANGE Visability
#define STATUS_DISABLED 0 // RED Visability
#define STATUS_CLOSE -1 // Close the interface

/*
Shuttles
*/
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@
#define INIT_ORDER_LATE_MAPPING -40
#define INIT_ORDER_PATH -50
#define INIT_ORDER_PERSISTENCE -95
#define INIT_ORDER_CHAT -100 // Should be last to ensure chat remains smooth during init.

// Subsystem fire priority, from lowest to highest priority
// If the subsystem isn't listed here it's either DEFAULT or PROCESS (if it's a processing subsystem child)

#define FIRE_PRIORITY_PING 10
#define FIRE_PRIORITY_NANOMOB 10
#define FIRE_PRIORITY_NIGHTSHIFT 10
#define FIRE_PRIORITY_IDLE_NPC 10
Expand All @@ -112,6 +114,7 @@
#define FIRE_PRIORITY_MOBS 100
#define FIRE_PRIORITY_TGUI 110
#define FIRE_PRIORITY_TICKER 200
#define FIRE_PRIORITY_CHAT 400
#define FIRE_PRIORITY_RUNECHAT 410 // I hate how high the fire priority on this is -aa
#define FIRE_PRIORITY_OVERLAYS 500
#define FIRE_PRIORITY_DELAYED_VERBS 950
Expand Down
40 changes: 39 additions & 1 deletion code/__DEFINES/tgui_defines.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
// TGUI defines
// TGUI Modal defines
#define UI_MODAL_INPUT_MAX_LENGTH 1024
#define UI_MODAL_INPUT_MAX_LENGTH_NAME 64 // Names for generally anything don't go past 32, let alone 64.

#define UI_MODAL_OPEN 1
#define UI_MODAL_DELEGATE 2
#define UI_MODAL_ANSWER 3
#define UI_MODAL_CLOSE 4

/// Green eye; fully interactive
#define UI_INTERACTIVE 2
/// Orange eye; updates but is not interactive
#define UI_UPDATE 1
/// Red eye; disabled, does not update
#define UI_DISABLED 0
/// UI Should close
#define UI_CLOSE -1

/// Maximum number of windows that can be suspended/reused
#define TGUI_WINDOW_SOFT_LIMIT 5
/// Maximum number of open windows
#define TGUI_WINDOW_HARD_LIMIT 9

/// 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
/// Window was just opened, but is still not ready to be sent data
#define TGUI_WINDOW_LOADING 1
/// Window is free and ready to receive data
#define TGUI_WINDOW_READY 2

/// Get a window id based on the provided pool index
#define TGUI_WINDOW_ID(index) "tgui-window-[index]"
/// Get a pool index of the provided window id
#define TGUI_WINDOW_INDEX(window_id) text2num(copytext(window_id, 13))

/// Creates a message packet for sending via output()
#define TGUI_CREATE_MESSAGE(type, payload) ( \
url_encode(json_encode(list( \
"type" = type, \
"payload" = payload, \
))))
20 changes: 17 additions & 3 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ GLOBAL_PROTECT(log_end)

for(var/client/C in GLOB.admins)
if(check_rights(R_DEBUG | R_VIEWRUNTIMES, FALSE, C.mob) && (C.prefs.toggles & PREFTOGGLE_CHAT_DEBUGLOGS))
to_chat(C, "<span class='debug'>DEBUG: [text]</span>")
to_chat(C,
type = MESSAGE_TYPE_DEBUG,
html = "<span class='debug'>DEBUG: [text]</span>",
confidential = TRUE)

/proc/log_game(text)
if(GLOB.configuration.logging.game_logging)
Expand Down Expand Up @@ -149,8 +152,19 @@ GLOBAL_PROTECT(log_end)
/proc/log_runtime_summary(text)
rustg_log_write(GLOB.runtime_summary_log, "[text][GLOB.log_end]")

/proc/log_tgui(text)
rustg_log_write(GLOB.tgui_log, "[text][GLOB.log_end]")
/proc/log_tgui(user_or_client, text)
var/list/messages = list()
if(!user_or_client)
messages.Add("no user")
else if(ismob(user_or_client))
var/mob/user = user_or_client
messages.Add("[user.ckey] (as [user])")
else if(isclient(user_or_client))
var/client/client = user_or_client
messages.Add("[client.ckey]")
messages.Add(": [text]")
messages.Add("[GLOB.log_end]")
rustg_log_write(GLOB.tgui_log, messages.Join())

#ifdef REFERENCE_TRACKING
/proc/log_gc(text)
Expand Down
5 changes: 5 additions & 0 deletions code/__HELPERS/assets.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// Generate a filename for this asset
/// The same asset will always lead to the same asset name
/// (Generated names do not include file extention.)
/proc/generate_asset_name(file)
return "asset.[md5(fcopy_rsc(file))]"
5 changes: 0 additions & 5 deletions code/__HELPERS/files.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@

return text

//Sends resource files to client cache
/client/proc/getFiles()
for(var/file in args)
src << browse_rsc(file)

/client/proc/browse_files(root="data/logs/", max_iterations=10, list/valid_extensions=list("txt", "log", "htm", "json"))
// wow why was this ever a parameter
root = "data/logs/"
Expand Down
41 changes: 41 additions & 0 deletions code/__HELPERS/iconprocs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,44 @@ world
M.Blend("#ffffff", ICON_SUBTRACT)
// apply mask
Blend(M, ICON_ADD)

//Converts an icon to base64. Operates by putting the icon in the iconCache savefile,
// exporting it as text, and then parsing the base64 from that.
// (This relies on byond automatically storing icons in savefiles as base64)
GLOBAL_DATUM_INIT(iconCache, /savefile, new /savefile("data/iconCache.sav"))

GLOBAL_LIST_EMPTY(bicon_cache)

/proc/icon2base64(icon/icon, iconKey = "misc")
if(!isicon(icon)) return 0

GLOB.iconCache[iconKey] << icon
var/iconData = GLOB.iconCache.ExportText(iconKey)
var/list/partial = splittext(iconData, "{")
return replacetext(copytext(partial[2], 3, -5), "\n", "")

/proc/bicon(obj, use_class = 1)
var/class = use_class ? "class='icon misc'" : null
if(!obj)
return

if(isicon(obj))
if(!GLOB.bicon_cache["\ref[obj]"]) // Doesn't exist yet, make it.
GLOB.bicon_cache["\ref[obj]"] = icon2base64(obj)

return "<img [class] src='data:image/png;base64,[GLOB.bicon_cache["\ref[obj]"]]'>"

// Either an atom or somebody fucked up and is gonna get a runtime, which I'm fine with.
var/atom/A = obj
var/key = "[istype(A.icon, /icon) ? "\ref[A.icon]" : A.icon]:[A.icon_state]"
if(!GLOB.bicon_cache[key]) // Doesn't exist, make it.
var/icon/I = icon(A.icon, A.icon_state, SOUTH, 1)
if(ishuman(obj)) // Shitty workaround for a BYOND issue.
var/icon/temp = I
I = icon()
I.Insert(temp, dir = SOUTH)
GLOB.bicon_cache[key] = icon2base64(I, key)
if(use_class)
class = "class='icon [A.icon_state]'"

return "<img [class] src='data:image/png;base64,[GLOB.bicon_cache[key]]'>"
7 changes: 0 additions & 7 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,6 @@
var/middle = L.len / 2 + 1 // Copy is first,second-1
return mergeLists(sortList(L.Copy(0,middle)), sortList(L.Copy(middle))) //second parameter null = to end of list

//Mergsorge: uses sortAssoc() but uses the var's name specifically. This should probably be using mergeAtom() instead
/proc/sortNames(list/L)
var/list/Q = new()
for(var/atom/x in L)
Q[x.name] = x
return sortAssoc(Q)

/proc/mergeLists(list/L, list/R)
var/Li=1
var/Ri=1
Expand Down
Loading

0 comments on commit 7511bb9

Please sign in to comment.