From 2cf715f9db0742c78f7c03f6dd4a2cdb81222445 Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Wed, 12 Aug 2026 18:14:42 +0300 Subject: [PATCH] Add ability to force game start for benchmarks Add `Playtime = true` configuration attribute. When enabled, displays a popup prompting the user to start the game via RunService:Run() with an option to suppress the message. Closes #7 --- src/configurations.ts | 3 +++ src/index.server.tsx | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/configurations.ts b/src/configurations.ts index 2107d8c..e3ef661 100644 --- a/src/configurations.ts +++ b/src/configurations.ts @@ -32,3 +32,6 @@ export const ZINDEX = { /** Axis labels that must never be occluded */ ALWAYS_ON_TOP: math.huge, } as const; + +/* Benchmark Execution */ +export const PLAYTIME = false; diff --git a/src/index.server.tsx b/src/index.server.tsx index 95248d6..5b0f5c8 100644 --- a/src/index.server.tsx +++ b/src/index.server.tsx @@ -3,7 +3,7 @@ import { createPortal, createRoot } from "@rbxts/react-roblox"; import { RunService } from "@rbxts/services"; import { PluginProvider } from "components"; import App from "app"; -import { VERSION_NUMBER } from "configurations"; +import { VERSION_NUMBER, PLAYTIME } from "configurations"; import { Settings } from "settings"; const toolbar = plugin.CreateToolbar(`Scriptbench v${VERSION_NUMBER}`); @@ -16,6 +16,19 @@ const toggle = toolbar.CreateButton( function main() { if (RunService.IsRunMode()) return; + if (PLAYTIME) { + const suppressed = plugin.GetSetting("Scriptbench_SuppressPlayPrompt", false); + if (!suppressed) { + const [accepted, checked] = plugin.PromptGlobalConfirm( + "Auto-Start Game", + "Would you like to automatically start the game simulation for benchmarks?", + "Do not show again" + ); + if (checked) plugin.SetSetting("Scriptbench_SuppressPlayPrompt", true); + if (accepted) task.defer(() => RunService.Run()); + } + } + const widgetInfo = new DockWidgetPluginGuiInfo( Enum.InitialDockState.Float, false,