This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
3,344 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Settings = require(script.Parent.Settings) | ||
|
||
local function SyncSnapshots(newSnapshots) | ||
local snapshotsFolder = ReplicatedStorage:FindFirstChild(Settings.SnapshotFolderName) | ||
|
||
if not snapshotsFolder then | ||
snapshotsFolder = Instance.new("Folder") | ||
snapshotsFolder.Name = Settings.SnapshotFolderName | ||
snapshotsFolder.Parent = ReplicatedStorage | ||
end | ||
|
||
for name, value in pairs(newSnapshots) do | ||
local snapshot = Instance.new("ModuleScript") | ||
snapshot.Name = name | ||
snapshot.Source = value | ||
snapshot.Parent = snapshotsFolder | ||
end | ||
end | ||
|
||
local function PluginEditMode(plugin) | ||
local isPluginDeactivated = false | ||
|
||
plugin.Deactivation:Connect(function() | ||
isPluginDeactivated = true | ||
end) | ||
|
||
while not isPluginDeactivated do | ||
local newSnapshots = plugin:GetSetting(Settings.PluginSettingName) | ||
|
||
if newSnapshots then | ||
SyncSnapshots(newSnapshots) | ||
plugin:SetSetting(Settings.PluginSettingName, false) | ||
end | ||
|
||
wait(Settings.SyncDelay) | ||
end | ||
end | ||
|
||
return PluginEditMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Settings = require(script.Parent.Settings) | ||
|
||
local function PluginRunMode(plugin) | ||
plugin.Unloading:Connect(function() | ||
local snapshotsFolder = ReplicatedStorage:FindFirstChild(Settings.SnapshotFolderName) | ||
|
||
local newSnapshots = {} | ||
|
||
if not snapshotsFolder then | ||
return | ||
end | ||
|
||
for _, snapshot in pairs(snapshotsFolder:GetChildren()) do | ||
if snapshot:IsA("StringValue") then | ||
newSnapshots[snapshot.Name] = snapshot.Value | ||
end | ||
end | ||
|
||
plugin:SetSetting(Settings.PluginSettingName, newSnapshots) | ||
end) | ||
end | ||
|
||
return PluginRunMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local function IndexError(_, key) | ||
local message = ("%q (%s) is not a valid member of Settings"):format( | ||
tostring(key), | ||
typeof(key) | ||
) | ||
|
||
error(message, 2) | ||
end | ||
|
||
return setmetatable({ | ||
SnapshotFolderName = "RoactSnapshots", | ||
PluginSettingName = "NewRoactSnapshots", | ||
SyncDelay = 1, | ||
}, { | ||
__index = IndexError, | ||
__newindex = IndexError, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local RunService = game:GetService("RunService") | ||
|
||
local EditModeMain = require(script.EditModeMain) | ||
local RunModeMain = require(script.RunModeMain) | ||
|
||
if RunService:IsEdit() then | ||
EditModeMain(plugin) | ||
else | ||
if RunService:IsClient() then | ||
RunModeMain(plugin) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Snapshots Plugin", | ||
"tree": { | ||
"$path": "SnapshotsPlugin" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.