From ce9a6b2d8597b8020fdfeef6b3f176a377945588 Mon Sep 17 00:00:00 2001 From: Infuseting Date: Wed, 14 Oct 2026 10:56:12 +0200 Subject: [PATCH] feat(chat): show welcome message and fix runtime dependency layout --- flamework.build | 3 ++- pnpm-workspace.yaml | 3 +++ .../controllers/welcome-chat-controller.ts | 27 +++++++++++++++++++ src/shared/welcome-chat.ts | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/client/controllers/welcome-chat-controller.ts create mode 100644 src/shared/welcome-chat.ts diff --git a/flamework.build b/flamework.build index 4e97ac4..75e970c 100644 --- a/flamework.build +++ b/flamework.build @@ -4,7 +4,8 @@ "identifiers": { "crownstudio-roblox-ts-template:out/server/services/startup-service@StartupService": "server/services/startup-service@StartupService", "crownstudio-roblox-ts-template:out/client/controllers/cmdr-controller@CmdrController": "client/controllers/cmdr-controller@CmdrController", - "crownstudio-roblox-ts-template:out/server/services/cmdr-service@CmdrService": "server/services/cmdr-service@CmdrService" + "crownstudio-roblox-ts-template:out/server/services/cmdr-service@CmdrService": "server/services/cmdr-service@CmdrService", + "crownstudio-roblox-ts-template:out/client/controllers/welcome-chat-controller@WelcomeChatController": "client/controllers/welcome-chat-controller@WelcomeChatController" }, "metadata": {} } \ No newline at end of file diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 595dfc7..4255e75 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,6 @@ +nodeLinker: hoisted +shamefullyHoist: true + minimumReleaseAgeExclude: - "@typescript-eslint/eslint-plugin@8.71.2" - "@typescript-eslint/parser@8.71.2" diff --git a/src/client/controllers/welcome-chat-controller.ts b/src/client/controllers/welcome-chat-controller.ts new file mode 100644 index 0000000..203cc14 --- /dev/null +++ b/src/client/controllers/welcome-chat-controller.ts @@ -0,0 +1,27 @@ +import { Controller, OnStart } from "@flamework/core"; +import Log from "@rbxts/log"; +import { TextChatService } from "@rbxts/services"; +import { WELCOME_CHAT, WELCOME_CHAT_MESSAGE } from "shared/welcome-chat"; + +@Controller() +export class WelcomeChatController implements OnStart { + public onStart(): void { + task.delay(WELCOME_CHAT.delaySeconds, () => this.displayWelcome()); + } + + private displayWelcome(): void { + const deadline = os.clock() + WELCOME_CHAT.channelTimeoutSeconds; + const channels = TextChatService.WaitForChild( + "TextChannels", + WELCOME_CHAT.channelTimeoutSeconds, + ); + const channel = channels?.WaitForChild("RBXGeneral", math.max(deadline - os.clock(), 0)); + + if (!channel?.IsA("TextChannel")) { + Log.Warn("Welcome chat unavailable: RBXGeneral did not become ready before the timeout"); + return; + } + + channel.DisplaySystemMessage(WELCOME_CHAT_MESSAGE); + } +} diff --git a/src/shared/welcome-chat.ts b/src/shared/welcome-chat.ts new file mode 100644 index 0000000..602dc7d --- /dev/null +++ b/src/shared/welcome-chat.ts @@ -0,0 +1,20 @@ +export const WELCOME_CHAT = { + delaySeconds: 2, + channelTimeoutSeconds: 30, + colors: { + heading: "#FFD166", + text: "#F1F5FF", + liked: "#5DE4A8", + follow: "#74C7FF", + hint: "#BDC6DC", + }, +}; + +const colors = WELCOME_CHAT.colors; + +export const WELCOME_CHAT_MESSAGE = + `✨ SUPPORT THE GAME ✨\n` + + `If you like the game ` + + `👍 LIKED` + + ` and ` + + `🔔 FOLLOW\n`;