diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6dc1c2..d7f92925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ Making a new release? Simply add the new header with the version and date undern ## Unreleased * `inf` and `nan` values in properties are now synced ([#1176]) -* Fixed the "Always" confirmation behavior setting to prompt for confirmation on every sync patch, not just the initial sync (which is handled by "Initial", the default confirmation behavior setting). Changes that arrive during confirmation are merged into the pending patch and the UI updates in real-time. ([#1216]) +* Added an "Every Change" confirmation behavior option that prompts for confirmation on every sync patch (not just the initial sync). Changes that arrive during confirmation are merged into the pending patch and the UI updates in real-time. ([#1216]) * Fixed a bug caused by having reference properties (such as `ObjectValue.Value`) that point to an Instance not included in syncback. ([#1179]) * Fixed instance replacement fallback failing when too many instances needed to be replaced. ([#1192]) * Added actors and bindable/remote event/function variants to be synced back as JSON files. ([#1199]) diff --git a/plugin/src/App/StatusPages/Settings/init.lua b/plugin/src/App/StatusPages/Settings/init.lua index b63d30e5..b13270fe 100644 --- a/plugin/src/App/StatusPages/Settings/init.lua +++ b/plugin/src/App/StatusPages/Settings/init.lua @@ -26,7 +26,7 @@ local function invertTbl(tbl) end local invertedLevels = invertTbl(Log.Level) -local confirmationBehaviors = { "Initial", "Always", "Large Changes", "Unlisted PlaceId", "Never" } +local confirmationBehaviors = { "Initial", "Always", "Every Change", "Large Changes", "Unlisted PlaceId", "Never" } local syncReminderModes = { "None", "Notify", "Fullscreen" } local function Navbar(props) diff --git a/plugin/src/App/init.lua b/plugin/src/App/init.lua index 6e47ee76..f398eb9e 100644 --- a/plugin/src/App/init.lua +++ b/plugin/src/App/init.lua @@ -751,38 +751,36 @@ function App:startSession() end local confirmationBehavior = Settings:get("confirmationBehavior") - if confirmationBehavior ~= "Always" then - if confirmationBehavior == "Initial" then - -- Only confirm if we haven't synced this project yet this session - if self.knownProjects[serverInfo.projectName] then - Log.trace( - "Accepting patch without confirmation because project has already been connected and behavior is set to Initial" - ) - return "Accept" - end - elseif confirmationBehavior == "Large Changes" then - -- Only confirm if the patch impacts many instances - if PatchSet.countInstances(patch) < Settings:get("largeChangesConfirmationThreshold") then - Log.trace( - "Accepting patch without confirmation because patch is small and behavior is set to Large Changes" - ) - return "Accept" - end - elseif confirmationBehavior == "Unlisted PlaceId" then - -- Only confirm if the current placeId is not in the servePlaceIds allowlist - if serverInfo.expectedPlaceIds then - local isListed = table.find(serverInfo.expectedPlaceIds, game.PlaceId) ~= nil - if isListed then - Log.trace( - "Accepting patch without confirmation because placeId is listed and behavior is set to Unlisted PlaceId" - ) - return "Accept" - end - end - elseif confirmationBehavior == "Never" then - Log.trace("Accepting patch without confirmation because behavior is set to Never") + if confirmationBehavior == "Initial" then + -- Only confirm if we haven't synced this project yet this session + if self.knownProjects[serverInfo.projectName] then + Log.trace( + "Accepting patch without confirmation because project has already been connected and behavior is set to Initial" + ) return "Accept" end + elseif confirmationBehavior == "Large Changes" then + -- Only confirm if the patch impacts many instances + if PatchSet.countInstances(patch) < Settings:get("largeChangesConfirmationThreshold") then + Log.trace( + "Accepting patch without confirmation because patch is small and behavior is set to Large Changes" + ) + return "Accept" + end + elseif confirmationBehavior == "Unlisted PlaceId" then + -- Only confirm if the current placeId is not in the servePlaceIds allowlist + if serverInfo.expectedPlaceIds then + local isListed = table.find(serverInfo.expectedPlaceIds, game.PlaceId) ~= nil + if isListed then + Log.trace( + "Accepting patch without confirmation because placeId is listed and behavior is set to Unlisted PlaceId" + ) + return "Accept" + end + end + elseif confirmationBehavior == "Never" then + Log.trace("Accepting patch without confirmation because behavior is set to Never") + return "Accept" end -- The datamodel name gets overwritten by Studio, making confirmation of it intrusive diff --git a/plugin/src/ServeSession.lua b/plugin/src/ServeSession.lua index 5d140ba0..48bcb735 100644 --- a/plugin/src/ServeSession.lua +++ b/plugin/src/ServeSession.lua @@ -203,6 +203,15 @@ function ServeSession:__onWebSocketMessage(messagesPacket) Log.debug("Received {} messages from Rojo server", #messagesPacket.messages) + -- If not "Every Change", apply patches directly without confirmation + if Settings:get("confirmationBehavior") ~= "Every Change" then + for _, message in messagesPacket.messages do + self:__applyPatch(message) + end + self.__apiContext:setMessageCursor(messagesPacket.messageCursor) + return + end + -- Combine all messages into a single patch local combinedPatch = PatchSet.newEmpty() for _, message in messagesPacket.messages do diff --git a/plugin/src/Settings.lua b/plugin/src/Settings.lua index 2c7008d9..3baf0654 100644 --- a/plugin/src/Settings.lua +++ b/plugin/src/Settings.lua @@ -20,7 +20,7 @@ local defaultSettings = { checkForUpdates = true, checkForPrereleases = false, autoConnectPlaytestServer = false, - confirmationBehavior = "Initial" :: "Never" | "Initial" | "Always" | "Large Changes" | "Unlisted PlaceId", + confirmationBehavior = "Initial" :: "Never" | "Initial" | "Always" | "Every Change" | "Large Changes" | "Unlisted PlaceId", largeChangesConfirmationThreshold = 5, playSounds = true, typecheckingEnabled = false,