@quenty/saveslot 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/LICENSE.md +21 -0
- package/README.md +23 -0
- package/default.project.json +14 -0
- package/package.json +55 -0
- package/src/Client/Binders/HasSaveSlotsClient.lua +128 -0
- package/src/Client/Cmdr/SaveSlotCmdrServiceClient.lua +49 -0
- package/src/Client/SaveSlotServiceClient.lua +55 -0
- package/src/Server/Binders/HasSaveSlots.lua +479 -0
- package/src/Server/Cmdr/SaveSlotCmdrService.lua +183 -0
- package/src/Server/SaveSlotService.lua +229 -0
- package/src/Shared/Cmdr/SaveSlotCmdrUtils.lua +33 -0
- package/src/Shared/Data/HasSaveSlotsData.lua +14 -0
- package/src/Shared/Data/SaveSlotData.lua +32 -0
- package/src/Shared/HasSaveSlotsBase.lua +50 -0
- package/src/Shared/HasSaveSlotsInterface.lua +29 -0
- package/src/Shared/SaveSlotConstants.lua +16 -0
- package/src/Shared/SaveSlotDataService.lua +157 -0
- package/src/node_modules.project.json +7 -0
- package/test/default.project.json +29 -0
- package/test/scripts/Client/ClientMain.client.lua +12 -0
- package/test/scripts/Server/ServerMain.server.lua +14 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.1.0 (2026-05-29)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Save slots ([55c926a](https://github.com/Quenty/NevermoreEngine/commit/55c926a29d6e304971b8d0123bb3a684be496899))
|
|
11
|
+
|
|
12
|
+
# v1.1.0 (Fri May 29 2026)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Enhancement
|
|
15
|
+
|
|
16
|
+
- feat: Save slots [#692](https://github.com/Quenty/NevermoreEngine/pull/692) ([@alex-y-z](https://github.com/alex-y-z))
|
|
17
|
+
- feat: Save slots ([@alex-y-z](https://github.com/alex-y-z))
|
|
18
|
+
|
|
19
|
+
#### 🐛 Bug Fix
|
|
20
|
+
|
|
21
|
+
- chore: Docs link ([@alex-y-z](https://github.com/alex-y-z))
|
|
22
|
+
- chore: Rename store key ([@alex-y-z](https://github.com/alex-y-z))
|
|
23
|
+
- refactor: Cleaner state/lifetime management ([@alex-y-z](https://github.com/alex-y-z))
|
|
24
|
+
- refactor: Reactive summaries ([@alex-y-z](https://github.com/alex-y-z))
|
|
25
|
+
- refactor: Type SlotId ([@alex-y-z](https://github.com/alex-y-z))
|
|
26
|
+
- chore: Set command feedback ([@alex-y-z](https://github.com/alex-y-z))
|
|
27
|
+
- refactor: Switch to GUIDs, default to root store ([@alex-y-z](https://github.com/alex-y-z))
|
|
28
|
+
- chore: Lint ([@alex-y-z](https://github.com/alex-y-z))
|
|
29
|
+
|
|
30
|
+
#### Authors: 1
|
|
31
|
+
|
|
32
|
+
- Alex Turner ([@alex-y-z](https://github.com/alex-y-z))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2026 James Onnen (Quenty)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## SaveSlot
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
5
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://discord.gg/mhtGUS8">
|
|
8
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
11
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
PlayerDataStoreService wrapper for save slots
|
|
16
|
+
|
|
17
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/SaveSlot">View docs →</a></div>
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm install @quenty/saveslot --save
|
|
23
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quenty/saveslot",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "PlayerDataStoreService wrapper for save slots",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Roblox",
|
|
7
|
+
"Nevermore",
|
|
8
|
+
"Lua",
|
|
9
|
+
"saveslot"
|
|
10
|
+
],
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Quenty/NevermoreEngine/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/Quenty/NevermoreEngine.git",
|
|
17
|
+
"directory": "src/saveslot/"
|
|
18
|
+
},
|
|
19
|
+
"funding": {
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://www.patreon.com/quenty"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"preinstall": "npx only-allow pnpm"
|
|
26
|
+
},
|
|
27
|
+
"contributors": [
|
|
28
|
+
"Quenty"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@quenty/adorneedata": "7.34.0",
|
|
32
|
+
"@quenty/baseobject": "10.13.0",
|
|
33
|
+
"@quenty/binder": "14.36.0",
|
|
34
|
+
"@quenty/brio": "14.30.0",
|
|
35
|
+
"@quenty/cmdrservice": "13.45.0",
|
|
36
|
+
"@quenty/datastore": "13.39.0",
|
|
37
|
+
"@quenty/instanceutils": "13.30.0",
|
|
38
|
+
"@quenty/loader": "10.11.0",
|
|
39
|
+
"@quenty/maid": "3.9.0",
|
|
40
|
+
"@quenty/playerbinder": "14.36.0",
|
|
41
|
+
"@quenty/promise": "10.18.0",
|
|
42
|
+
"@quenty/propertyvalue": "7.30.0",
|
|
43
|
+
"@quenty/remoting": "12.32.0",
|
|
44
|
+
"@quenty/rx": "13.28.2",
|
|
45
|
+
"@quenty/servicebag": "11.18.0",
|
|
46
|
+
"@quenty/signal": "7.13.0",
|
|
47
|
+
"@quenty/table": "3.9.2",
|
|
48
|
+
"@quenty/tie": "10.40.0",
|
|
49
|
+
"@quenty/valueobject": "13.31.0"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "b5f6dec41739b68f1a5f75ab6ba96aa6a7f03916"
|
|
55
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
--!strict
|
|
2
|
+
--[=[
|
|
3
|
+
@class HasSaveSlotsClient
|
|
4
|
+
]=]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local Players = game:GetService("Players")
|
|
9
|
+
|
|
10
|
+
local Binder = require("Binder")
|
|
11
|
+
local HasSaveSlotsBase = require("HasSaveSlotsBase")
|
|
12
|
+
local HasSaveSlotsInterface = require("HasSaveSlotsInterface")
|
|
13
|
+
local Promise = require("Promise")
|
|
14
|
+
local Remoting = require("Remoting")
|
|
15
|
+
local SaveSlotData = require("SaveSlotData")
|
|
16
|
+
local ServiceBag = require("ServiceBag")
|
|
17
|
+
|
|
18
|
+
local HasSaveSlotsClient = setmetatable({}, HasSaveSlotsBase)
|
|
19
|
+
HasSaveSlotsClient.ClassName = "HasSaveSlotsClient"
|
|
20
|
+
HasSaveSlotsClient.__index = HasSaveSlotsClient
|
|
21
|
+
|
|
22
|
+
export type HasSaveSlotsClient =
|
|
23
|
+
typeof(setmetatable(
|
|
24
|
+
{} :: {
|
|
25
|
+
_obj: Player,
|
|
26
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
27
|
+
_remoting: any,
|
|
28
|
+
},
|
|
29
|
+
{} :: typeof({ __index = HasSaveSlotsClient })
|
|
30
|
+
))
|
|
31
|
+
& HasSaveSlotsBase.HasSaveSlotsBase
|
|
32
|
+
|
|
33
|
+
function HasSaveSlotsClient.new(player: Player, serviceBag: ServiceBag.ServiceBag): HasSaveSlotsClient
|
|
34
|
+
if player ~= Players.LocalPlayer then
|
|
35
|
+
return nil :: any
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
local self: HasSaveSlotsClient = setmetatable(HasSaveSlotsBase.new(player, serviceBag) :: any, HasSaveSlotsClient)
|
|
39
|
+
|
|
40
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
41
|
+
|
|
42
|
+
self._remoting = self._maid:Add(Remoting.Client.new(self._obj, "HasSaveSlots"))
|
|
43
|
+
|
|
44
|
+
self._maid:GiveTask(HasSaveSlotsInterface.Client:Implement(self._obj, self))
|
|
45
|
+
|
|
46
|
+
return self
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
--[=[
|
|
50
|
+
Returns whether the slot with the given ID exists
|
|
51
|
+
]=]
|
|
52
|
+
function HasSaveSlotsClient.PromiseHasSlot(
|
|
53
|
+
self: HasSaveSlotsClient,
|
|
54
|
+
slotId: SaveSlotData.SlotId?
|
|
55
|
+
): Promise.Promise<boolean>
|
|
56
|
+
return self._remoting.PromiseHasSlot:PromiseInvokeServer(slotId)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
--[=[
|
|
60
|
+
Selects the slot with the given ID
|
|
61
|
+
]=]
|
|
62
|
+
function HasSaveSlotsClient.PromiseSelectSlot(
|
|
63
|
+
self: HasSaveSlotsClient,
|
|
64
|
+
slotId: SaveSlotData.SlotId
|
|
65
|
+
): Promise.Promise<any>
|
|
66
|
+
return self._remoting.PromiseSelectSlot:PromiseInvokeServer(slotId)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
--[=[
|
|
70
|
+
Creates a slot at the given index
|
|
71
|
+
]=]
|
|
72
|
+
function HasSaveSlotsClient.PromiseCreateSlot(
|
|
73
|
+
self: HasSaveSlotsClient,
|
|
74
|
+
slotIndex: number,
|
|
75
|
+
metadata: SaveSlotData.SaveSlotMetadata?
|
|
76
|
+
): Promise.Promise<any>
|
|
77
|
+
return self._remoting.PromiseCreateSlot:PromiseInvokeServer(slotIndex, metadata)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
--[=[
|
|
81
|
+
Deletes the slot with the given ID
|
|
82
|
+
]=]
|
|
83
|
+
function HasSaveSlotsClient.PromiseDeleteSlot(
|
|
84
|
+
self: HasSaveSlotsClient,
|
|
85
|
+
slotId: SaveSlotData.SlotId
|
|
86
|
+
): Promise.Promise<any>
|
|
87
|
+
return self._remoting.PromiseDeleteSlot:PromiseInvokeServer(slotId)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
--[=[
|
|
91
|
+
Sets the metadata for the slot with the given ID
|
|
92
|
+
]=]
|
|
93
|
+
function HasSaveSlotsClient.PromiseSetSlotMetadata(
|
|
94
|
+
self: HasSaveSlotsClient,
|
|
95
|
+
slotId: SaveSlotData.SlotId,
|
|
96
|
+
data: SaveSlotData.SaveSlotMetadata
|
|
97
|
+
): Promise.Promise<any>
|
|
98
|
+
return self._remoting.PromiseSetSlotMetadata:PromiseInvokeServer(slotId, data)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
--[=[
|
|
102
|
+
Gets the metadata for the slot with the given ID
|
|
103
|
+
]=]
|
|
104
|
+
function HasSaveSlotsClient.PromiseGetSlotMetadata(
|
|
105
|
+
self: HasSaveSlotsClient,
|
|
106
|
+
slotId: SaveSlotData.SlotId
|
|
107
|
+
): Promise.Promise<SaveSlotData.SaveSlotMetadata?>
|
|
108
|
+
return self._remoting.PromiseGetSlotMetadata:PromiseInvokeServer(slotId)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
--[=[
|
|
112
|
+
Gets the last active slot ID
|
|
113
|
+
]=]
|
|
114
|
+
function HasSaveSlotsClient.PromiseLastActiveSlotId(self: HasSaveSlotsClient): Promise.Promise<SaveSlotData.SlotId?>
|
|
115
|
+
return self._remoting.PromiseLastActiveSlotId:PromiseInvokeServer()
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
--[=[
|
|
119
|
+
Returns the slot ID from the given index
|
|
120
|
+
]=]
|
|
121
|
+
function HasSaveSlotsClient.PromiseSlotIdFromIndex(
|
|
122
|
+
self: HasSaveSlotsClient,
|
|
123
|
+
slotIndex: number
|
|
124
|
+
): Promise.Promise<SaveSlotData.SlotId?>
|
|
125
|
+
return self._remoting.PromiseSlotIdFromIndex:PromiseInvokeServer(slotIndex)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
return Binder.new("HasSaveSlots", HasSaveSlotsClient :: any) :: Binder.Binder<HasSaveSlotsClient>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--!strict
|
|
2
|
+
--[=[
|
|
3
|
+
@class SaveSlotCmdrServiceClient
|
|
4
|
+
]=]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local CmdrServiceClient = require("CmdrServiceClient")
|
|
9
|
+
local Maid = require("Maid")
|
|
10
|
+
local SaveSlotCmdrUtils = require("SaveSlotCmdrUtils")
|
|
11
|
+
local SaveSlotDataService = require("SaveSlotDataService")
|
|
12
|
+
local ServiceBag = require("ServiceBag")
|
|
13
|
+
|
|
14
|
+
local SaveSlotCmdrServiceClient = {}
|
|
15
|
+
SaveSlotCmdrServiceClient.ServiceName = "SaveSlotCmdrServiceClient"
|
|
16
|
+
|
|
17
|
+
export type SaveSlotCmdrServiceClient = typeof(setmetatable(
|
|
18
|
+
{} :: {
|
|
19
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
20
|
+
_maid: Maid.Maid,
|
|
21
|
+
_cmdrServiceClient: any,
|
|
22
|
+
_saveSlotDataService: any,
|
|
23
|
+
},
|
|
24
|
+
{} :: typeof({ __index = SaveSlotCmdrServiceClient })
|
|
25
|
+
))
|
|
26
|
+
|
|
27
|
+
function SaveSlotCmdrServiceClient.Init(self: SaveSlotCmdrServiceClient, serviceBag: ServiceBag.ServiceBag)
|
|
28
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
29
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
30
|
+
self._maid = Maid.new()
|
|
31
|
+
|
|
32
|
+
-- External
|
|
33
|
+
self._cmdrServiceClient = self._serviceBag:GetService(CmdrServiceClient)
|
|
34
|
+
|
|
35
|
+
-- Internal
|
|
36
|
+
self._saveSlotDataService = self._serviceBag:GetService(SaveSlotDataService)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
function SaveSlotCmdrServiceClient.Start(self: SaveSlotCmdrServiceClient)
|
|
40
|
+
self._maid:GivePromise(self._cmdrServiceClient:PromiseCmdr()):Then(function(cmdr)
|
|
41
|
+
SaveSlotCmdrUtils.registerSlotIndexType(cmdr, self._saveSlotDataService)
|
|
42
|
+
end)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
function SaveSlotCmdrServiceClient.Destroy(self: SaveSlotCmdrServiceClient): ()
|
|
46
|
+
self._maid:Destroy()
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
return SaveSlotCmdrServiceClient
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
--!strict
|
|
2
|
+
--[=[
|
|
3
|
+
@class SaveSlotServiceClient
|
|
4
|
+
]=]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
9
|
+
|
|
10
|
+
local Maid = require("Maid")
|
|
11
|
+
local Remoting = require("Remoting")
|
|
12
|
+
local ServiceBag = require("ServiceBag")
|
|
13
|
+
|
|
14
|
+
local SaveSlotServiceClient = {}
|
|
15
|
+
SaveSlotServiceClient.ServiceName = "SaveSlotServiceClient"
|
|
16
|
+
|
|
17
|
+
export type SaveSlotServiceClient = typeof(setmetatable(
|
|
18
|
+
{} :: {
|
|
19
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
20
|
+
_maid: Maid.Maid,
|
|
21
|
+
_remoting: any,
|
|
22
|
+
},
|
|
23
|
+
{} :: typeof({ __index = SaveSlotServiceClient })
|
|
24
|
+
))
|
|
25
|
+
|
|
26
|
+
function SaveSlotServiceClient.Init(self: SaveSlotServiceClient, serviceBag: ServiceBag.ServiceBag)
|
|
27
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
28
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
29
|
+
self._maid = Maid.new()
|
|
30
|
+
|
|
31
|
+
-- Internal
|
|
32
|
+
self._serviceBag:GetService(require("SaveSlotCmdrServiceClient"))
|
|
33
|
+
self._serviceBag:GetService(require("SaveSlotDataService"))
|
|
34
|
+
|
|
35
|
+
-- Binders
|
|
36
|
+
self._serviceBag:GetService(require("HasSaveSlotsClient"))
|
|
37
|
+
|
|
38
|
+
self._remoting = self._maid:Add(Remoting.Client.new(ReplicatedStorage, "SaveSlotService"))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
--[=[
|
|
42
|
+
Returns whether explicit slot selection is required
|
|
43
|
+
]=]
|
|
44
|
+
function SaveSlotServiceClient.GetExplicitSelectionRequiredAsync(self: SaveSlotServiceClient): boolean
|
|
45
|
+
return self._remoting.GetExplicitSelectionRequired:InvokeServer()
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
--[=[
|
|
49
|
+
Destroys the service
|
|
50
|
+
]=]
|
|
51
|
+
function SaveSlotServiceClient.Destroy(self: SaveSlotServiceClient): ()
|
|
52
|
+
self._maid:Destroy()
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
return SaveSlotServiceClient
|