Play Solo & Test Server auto connect (#840)

When enabled, the `baseurl` of the session is written to
`workspace:SetAttribute("__Rojo_ConnectionUrl")` so that the test server
can connect to that session automatically.

This works for Play Solo and Local Test Server. It is marked
experimental for now (and disabled by default) since connecting during a
playtest session is... not polished. Rojo may overwrite things and cause
headaches. Further work can be done later.
This commit is contained in:
boatbomber
2024-01-30 12:51:45 -08:00
committed by GitHub
parent 4018607b77
commit 506a60d0be
4 changed files with 99 additions and 15 deletions

View File

@@ -75,6 +75,12 @@ function SettingsPage:init()
end
function SettingsPage:render()
local layoutOrder = 0
local function layoutIncrement()
layoutOrder += 1
return layoutOrder
end
return Theme.with(function(theme)
theme = theme.Settings
@@ -86,7 +92,7 @@ function SettingsPage:render()
Navbar = e(Navbar, {
onBack = self.props.onBack,
transparency = self.props.transparency,
layoutOrder = 0,
layoutOrder = layoutIncrement(),
}),
ShowNotifications = e(Setting, {
@@ -94,7 +100,7 @@ function SettingsPage:render()
name = "Show Notifications",
description = "Popup notifications in viewport",
transparency = self.props.transparency,
layoutOrder = 1,
layoutOrder = layoutIncrement(),
}),
SyncReminder = e(Setting, {
@@ -103,7 +109,7 @@ function SettingsPage:render()
description = "Notify to sync when opening a place that has previously been synced",
transparency = self.props.transparency,
visible = Settings:getBinding("showNotifications"),
layoutOrder = 2,
layoutOrder = layoutIncrement(),
}),
ConfirmationBehavior = e(Setting, {
@@ -111,7 +117,7 @@ function SettingsPage:render()
name = "Confirmation Behavior",
description = "When to prompt for confirmation before syncing",
transparency = self.props.transparency,
layoutOrder = 3,
layoutOrder = layoutIncrement(),
options = confirmationBehaviors,
}),
@@ -121,7 +127,7 @@ function SettingsPage:render()
name = "Confirmation Threshold",
description = "How many modified instances to be considered a large change",
transparency = self.props.transparency,
layoutOrder = 4,
layoutOrder = layoutIncrement(),
visible = Settings:getBinding("confirmationBehavior"):map(function(value)
return value == "Large Changes"
end),
@@ -152,7 +158,16 @@ function SettingsPage:render()
name = "Play Sounds",
description = "Toggle sound effects",
transparency = self.props.transparency,
layoutOrder = 5,
layoutOrder = layoutIncrement(),
}),
AutoConnectPlaytestServer = e(Setting, {
id = "autoConnectPlaytestServer",
name = "Auto Connect Playtest Server",
description = "Automatically connect game server to Rojo when playtesting while connected in Edit",
experimental = true,
transparency = self.props.transparency,
layoutOrder = layoutIncrement(),
}),
OpenScriptsExternally = e(Setting, {
@@ -162,7 +177,7 @@ function SettingsPage:render()
locked = self.props.syncActive,
experimental = true,
transparency = self.props.transparency,
layoutOrder = 6,
layoutOrder = layoutIncrement(),
}),
TwoWaySync = e(Setting, {
@@ -172,7 +187,7 @@ function SettingsPage:render()
locked = self.props.syncActive,
experimental = true,
transparency = self.props.transparency,
layoutOrder = 7,
layoutOrder = layoutIncrement(),
}),
LogLevel = e(Setting, {
@@ -180,7 +195,7 @@ function SettingsPage:render()
name = "Log Level",
description = "Plugin output verbosity level",
transparency = self.props.transparency,
layoutOrder = 100,
layoutOrder = layoutIncrement(),
options = invertedLevels,
showReset = Settings:getBinding("logLevel"):map(function(value)
@@ -196,7 +211,7 @@ function SettingsPage:render()
name = "Typechecking",
description = "Toggle typechecking on the API surface",
transparency = self.props.transparency,
layoutOrder = 101,
layoutOrder = layoutIncrement(),
}),
Layout = e("UIListLayout", {