Skip to content

Commit

Permalink
Langchat is now actually readable through cameras (#7681)
Browse files Browse the repository at this point in the history
# About the pull request
Makes tgui able to read langchat styles.

# Explain why it's good for the game
Readable!

# Testing Photographs and Procedure
before:


![11111](https://github.com/user-attachments/assets/93be0517-d537-4d7a-8226-be0530bd7e2f)

after:


![333333](https://github.com/user-attachments/assets/36ea6019-c208-42c6-9de5-fabbb8e2a6bf)


# Changelog
:cl: ihatethisengine
add: makes langchat readable through tgui menus.
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
ihatethisengine and harryob authored Nov 27, 2024
1 parent 889b7c1 commit 748b57b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,6 @@
#define PERF_TOGGLE_SHUTTLES (1<<3)
/// Disables loading Techwebs and additional Z-Levels
#define PERF_TOGGLE_TECHWEBS (1<<4)

/// Maptext styles
#define MAP_STYLESHEET ".maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .center { text-align: center; } .langchat { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; } .langchat_small { font-size: 6px; } .langchat_yell { font-weight: bold; font-size: 10px; } .langchat_bolded { font-weight: bold; font-size: 8px; } .langchat_announce { font-weight: bold; font-size: 12px; } .langchat_bolditalicbig {font-weight: bold; font-size: 24px; font-style: italic; } .langchat_italic {font-style: italic; }"
1 change: 1 addition & 0 deletions code/controllers/subsystem/tgui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SUBSYSTEM_DEF(tgui)
var/polyfill = file2text('tgui/public/tgui-polyfill.min.js')
polyfill = "<script>\n[polyfill]\n</script>"
basehtml = replacetextEx(basehtml, "<!-- tgui:inline-polyfill -->", polyfill)
basehtml = replacetext(basehtml, "tgui:stylesheet", MAP_STYLESHEET)

/datum/controller/subsystem/tgui/Shutdown()
close_all_uis()
Expand Down
1 change: 1 addition & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(

connection_time = world.time
winset(src, null, "command=\".configure graphics-hwmode on\"")
winset(src, "map", "style=\"[MAP_STYLESHEET]\"")

send_assets()

Expand Down
1 change: 0 additions & 1 deletion interface/skin.dmf
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ window "mapwindow"
font-size = 7
is-default = true
saved-params = "zoom;letterbox;zoom-mode"
style = ".maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .center { text-align: center; } .langchat { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; } .langchat_small { font-size: 6px; } .langchat_yell { font-weight: bold; font-size: 10px; } .langchat_bolded { font-weight: bold; font-size: 8px; } .langchat_announce { font-weight: bold; font-size: 12px; } .langchat_bolditalicbig {font-weight: bold; font-size: 24px; font-style: italic; } .langchat_italic {font-style: italic; }"
elem "status_bar"
type = LABEL
pos = 0,464
Expand Down
5 changes: 5 additions & 0 deletions tgui/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ type ByondType = {
* Loads a script into the document.
*/
loadJs(url: string): void;

/**
* The ByondCSS stylesheet to load into ByondUI components
*/
styleSheet: string;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/components/ByondUi.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const createByondUiElement = (elementId) => {
render: (params) => {
logger.log(`rendering '${id}'`);
byondUiStack[index] = id;
Byond.winset(id, params);

Byond.winset(id, { ...params, style: Byond.styleSheet });
},
unmount: () => {
logger.log(`unmounting '${id}'`);
Expand Down
2 changes: 2 additions & 0 deletions tgui/public/tgui.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
// Expose inlined metadata
Byond.windowId = parseMetaTag('tgui:windowId');

Byond.styleSheet = "tgui:stylesheet"

// Backwards compatibility
window.__windowId__ = Byond.windowId;

Expand Down

0 comments on commit 748b57b

Please sign in to comment.