@quenty/saveslot 1.6.0 → 1.8.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 +17 -0
- package/package.json +5 -4
- package/src/Client/Binders/HasSaveSlotsClient.lua +14 -0
- package/src/Client/SaveSlotServiceClient.lua +17 -0
- package/src/Server/Binders/HasSaveSlots.lua +135 -0
- package/src/Server/Binders/HasSaveSlots.spec.lua +446 -8
- package/src/Server/Cmdr/SaveSlotCmdrService.lua +83 -16
- package/src/Server/SaveSlotService.lua +47 -12
- package/src/Server/SaveSlotService.spec.lua +109 -7
- package/src/Shared/Data/HasSaveSlotsData.lua +1 -0
- package/src/Shared/HasSaveSlotsBase.lua +54 -0
- package/src/Shared/HasSaveSlotsInterface.lua +11 -0
- package/src/Shared/SaveSlotDataService.lua +15 -0
|
@@ -10,6 +10,7 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
|
10
10
|
local Brio = require("Brio")
|
|
11
11
|
local DataStoreStage = require("DataStoreStage")
|
|
12
12
|
local HasSaveSlots = require("HasSaveSlots")
|
|
13
|
+
local HasSaveSlotsData = require("HasSaveSlotsData")
|
|
13
14
|
local Maid = require("Maid")
|
|
14
15
|
local Observable = require("Observable")
|
|
15
16
|
local Promise = require("Promise")
|
|
@@ -18,6 +19,7 @@ local RxBrioUtils = require("RxBrioUtils")
|
|
|
18
19
|
local SaveSlotConstants = require("SaveSlotConstants")
|
|
19
20
|
local SaveSlotData = require("SaveSlotData")
|
|
20
21
|
local ServiceBag = require("ServiceBag")
|
|
22
|
+
local TeleportDataService = require("TeleportDataService")
|
|
21
23
|
|
|
22
24
|
local SaveSlotService = {}
|
|
23
25
|
SaveSlotService.ServiceName = "SaveSlotService"
|
|
@@ -31,6 +33,7 @@ export type SaveSlotService = typeof(setmetatable(
|
|
|
31
33
|
_maxSlotCount: number,
|
|
32
34
|
_defaultSummaryProvider: HasSaveSlots.SaveSlotSummaryProvider?,
|
|
33
35
|
_remoting: any,
|
|
36
|
+
_teleportDataService: any,
|
|
34
37
|
},
|
|
35
38
|
{} :: typeof({ __index = SaveSlotService })
|
|
36
39
|
))
|
|
@@ -42,6 +45,7 @@ function SaveSlotService.Init(self: SaveSlotService, serviceBag: ServiceBag.Serv
|
|
|
42
45
|
|
|
43
46
|
-- External
|
|
44
47
|
self._serviceBag:GetService(require("PlayerDataStoreService"))
|
|
48
|
+
self._teleportDataService = self._serviceBag:GetService(TeleportDataService)
|
|
45
49
|
|
|
46
50
|
-- Internal
|
|
47
51
|
self._serviceBag:GetService(require("SaveSlotCmdrService"))
|
|
@@ -61,6 +65,23 @@ function SaveSlotService.Init(self: SaveSlotService, serviceBag: ServiceBag.Serv
|
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
function SaveSlotService.Start(self: SaveSlotService)
|
|
68
|
+
-- Every teleport built through TeleportDataService for a single player carries that player's
|
|
69
|
+
-- active slot id, so cross-place teleports resume on the same slot without each teleport site
|
|
70
|
+
-- re-attaching it by hand.
|
|
71
|
+
self._maid:GiveTask(
|
|
72
|
+
self._teleportDataService:RegisterTeleportDataProvider(function(players: { Player }): { [string]: any }?
|
|
73
|
+
if #players ~= 1 then
|
|
74
|
+
return nil
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
local slotId = HasSaveSlotsData.ActiveSlotId:Get(players[1])
|
|
78
|
+
if type(slotId) == "string" then
|
|
79
|
+
return { [SaveSlotConstants.TELEPORT_DATA_SLOT_KEY] = slotId }
|
|
80
|
+
end
|
|
81
|
+
return nil
|
|
82
|
+
end)
|
|
83
|
+
)
|
|
84
|
+
|
|
64
85
|
self._maid:GiveTask(self._hasSaveSlotsBinder:ObserveAllBrio():Subscribe(function(brio)
|
|
65
86
|
if brio:IsDead() then
|
|
66
87
|
return
|
|
@@ -74,19 +95,11 @@ function SaveSlotService.Start(self: SaveSlotService)
|
|
|
74
95
|
hasSaveSlots:SetSummaryProvider(self._defaultSummaryProvider)
|
|
75
96
|
end
|
|
76
97
|
|
|
77
|
-
-- Select
|
|
98
|
+
-- Select the slot the player teleported in with, or proceed with the default flow
|
|
78
99
|
maid:GivePromise(hasSaveSlots:PromiseSlotsLoaded()):Then(function()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if type(incomingSlotId) ~= "string" then
|
|
84
|
-
return self:_promiseSelectDefaultSlot(hasSaveSlots)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
return hasSaveSlots:PromiseHasSlot(incomingSlotId):Then(function(hasSlot: boolean)
|
|
88
|
-
if hasSlot then
|
|
89
|
-
return hasSaveSlots:PromiseSelectSlot(incomingSlotId)
|
|
100
|
+
return hasSaveSlots:PromiseLoadSaveSlotFromTeleport():Then(function(loadedSlotId)
|
|
101
|
+
if loadedSlotId then
|
|
102
|
+
return -- Teleported in with a valid slot; it is now selected
|
|
90
103
|
end
|
|
91
104
|
return self:_promiseSelectDefaultSlot(hasSaveSlots)
|
|
92
105
|
end)
|
|
@@ -141,6 +154,19 @@ function SaveSlotService.GetExplicitSelectionRequired(self: SaveSlotService): bo
|
|
|
141
154
|
return self._selectionRequired
|
|
142
155
|
end
|
|
143
156
|
|
|
157
|
+
--[=[
|
|
158
|
+
Returns whether the player teleported in carrying a save-slot id -- i.e. arrived via an internal
|
|
159
|
+
slot teleport rather than a fresh join. This is the sync, presence-only signal (it does not
|
|
160
|
+
validate the slot still exists); use [HasSaveSlots.PromiseHasSaveSlotFromTeleport] when existence
|
|
161
|
+
matters.
|
|
162
|
+
|
|
163
|
+
@param player Player
|
|
164
|
+
@return boolean
|
|
165
|
+
]=]
|
|
166
|
+
function SaveSlotService.IsInternalTeleport(self: SaveSlotService, player: Player): boolean
|
|
167
|
+
return self._teleportDataService:HasArrivedValue(player, SaveSlotConstants.TELEPORT_DATA_SLOT_KEY)
|
|
168
|
+
end
|
|
169
|
+
|
|
144
170
|
--[=[
|
|
145
171
|
Sets the max slot count
|
|
146
172
|
]=]
|
|
@@ -150,6 +176,15 @@ function SaveSlotService.SetMaxSlotCount(self: SaveSlotService, maxSlotCount: nu
|
|
|
150
176
|
self._maxSlotCount = maxSlotCount
|
|
151
177
|
end
|
|
152
178
|
|
|
179
|
+
--[=[
|
|
180
|
+
Removes the slot ceiling, so [HasSaveSlots.PromiseSelectNewSaveSlot] always
|
|
181
|
+
allocates the next free index. A thin alias over [SaveSlotService.SetMaxSlotCount]
|
|
182
|
+
with an unbounded count; same before-Start guard applies.
|
|
183
|
+
]=]
|
|
184
|
+
function SaveSlotService.SetUnlimitedSlots(self: SaveSlotService): ()
|
|
185
|
+
self:SetMaxSlotCount(math.huge)
|
|
186
|
+
end
|
|
187
|
+
|
|
153
188
|
--[=[
|
|
154
189
|
Sets the default slot summary provider
|
|
155
190
|
]=]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[[
|
|
3
3
|
Coverage for SaveSlotService's ServiceBag-driven configuration surface — the parts reachable
|
|
4
4
|
without a bound Player (a headless cloud test server has none). The player-driven slot
|
|
@@ -11,7 +11,11 @@ local require = require(script.Parent.loader).load(script)
|
|
|
11
11
|
|
|
12
12
|
local DataStoreMock = require("DataStoreMock")
|
|
13
13
|
local Jest = require("Jest")
|
|
14
|
+
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
15
|
+
local SaveSlotConstants = require("SaveSlotConstants")
|
|
16
|
+
local SaveSlotService = require("SaveSlotService")
|
|
14
17
|
local ServiceBag = require("ServiceBag")
|
|
18
|
+
local TeleportDataService = require("TeleportDataService")
|
|
15
19
|
|
|
16
20
|
local describe = Jest.Globals.describe
|
|
17
21
|
local expect = Jest.Globals.expect
|
|
@@ -21,11 +25,22 @@ local it = Jest.Globals.it
|
|
|
21
25
|
-- touches a real datastore. Returns the bag + service; the caller decides when to Start.
|
|
22
26
|
local function newServiceBag()
|
|
23
27
|
local serviceBag = ServiceBag.new()
|
|
24
|
-
local playerDataStoreService =
|
|
25
|
-
|
|
28
|
+
local playerDataStoreService = (
|
|
29
|
+
serviceBag:GetService(PlayerDataStoreService) :: any
|
|
30
|
+
) :: PlayerDataStoreService.PlayerDataStoreService
|
|
31
|
+
local saveSlotService = (serviceBag:GetService(SaveSlotService) :: any) :: SaveSlotService.SaveSlotService
|
|
32
|
+
local teleportDataService = (
|
|
33
|
+
serviceBag:GetService(TeleportDataService) :: any
|
|
34
|
+
) :: TeleportDataService.TeleportDataService
|
|
26
35
|
serviceBag:Init()
|
|
27
36
|
playerDataStoreService:SetRobloxDataStore(DataStoreMock.new())
|
|
28
|
-
return serviceBag, saveSlotService
|
|
37
|
+
return serviceBag, saveSlotService, teleportDataService
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
-- A Folder is an Instance, so it satisfies the player guards and can carry the ActiveSlotId
|
|
41
|
+
-- attribute the provider reads, standing in for a Player without a real join.
|
|
42
|
+
local function fakePlayer(): Player
|
|
43
|
+
return (Instance.new("Folder") :: any) :: Player
|
|
29
44
|
end
|
|
30
45
|
|
|
31
46
|
describe("SaveSlotService initialization", function()
|
|
@@ -103,11 +118,33 @@ describe("SaveSlotService configuration guards", function()
|
|
|
103
118
|
serviceBag:Destroy()
|
|
104
119
|
end)
|
|
105
120
|
|
|
121
|
+
it("should accept SetUnlimitedSlots before Start", function()
|
|
122
|
+
local serviceBag, saveSlotService = newServiceBag()
|
|
123
|
+
|
|
124
|
+
expect(function()
|
|
125
|
+
saveSlotService:SetUnlimitedSlots()
|
|
126
|
+
end).never.toThrow()
|
|
127
|
+
|
|
128
|
+
serviceBag:Destroy()
|
|
129
|
+
end)
|
|
130
|
+
|
|
131
|
+
it("should reject SetUnlimitedSlots after Start", function()
|
|
132
|
+
local serviceBag, saveSlotService = newServiceBag()
|
|
133
|
+
serviceBag:Start()
|
|
134
|
+
|
|
135
|
+
-- Delegates to SetMaxSlotCount, so it surfaces the same before-Start guard
|
|
136
|
+
expect(function()
|
|
137
|
+
saveSlotService:SetUnlimitedSlots()
|
|
138
|
+
end).toThrow("SetMaxSlotCount must be called before Start")
|
|
139
|
+
|
|
140
|
+
serviceBag:Destroy()
|
|
141
|
+
end)
|
|
142
|
+
|
|
106
143
|
it("should reject a non-function summary provider", function()
|
|
107
144
|
local serviceBag, saveSlotService = newServiceBag()
|
|
108
145
|
|
|
109
146
|
expect(function()
|
|
110
|
-
saveSlotService:SetDefaultSummaryProvider("not a function")
|
|
147
|
+
saveSlotService:SetDefaultSummaryProvider("not a function" :: any)
|
|
111
148
|
end).toThrow("Bad provider")
|
|
112
149
|
|
|
113
150
|
serviceBag:Destroy()
|
|
@@ -117,11 +154,76 @@ describe("SaveSlotService configuration guards", function()
|
|
|
117
154
|
local serviceBag, saveSlotService = newServiceBag()
|
|
118
155
|
|
|
119
156
|
expect(function()
|
|
120
|
-
saveSlotService:SetDefaultSummaryProvider(function()
|
|
157
|
+
saveSlotService:SetDefaultSummaryProvider((function()
|
|
121
158
|
return nil
|
|
122
|
-
end)
|
|
159
|
+
end) :: any)
|
|
123
160
|
end).never.toThrow()
|
|
124
161
|
|
|
125
162
|
serviceBag:Destroy()
|
|
126
163
|
end)
|
|
127
164
|
end)
|
|
165
|
+
|
|
166
|
+
describe("SaveSlotService internal teleport", function()
|
|
167
|
+
it("should register a provider that carries a single player's active slot id", function()
|
|
168
|
+
local serviceBag, _saveSlotService, teleportDataService = newServiceBag()
|
|
169
|
+
serviceBag:Start()
|
|
170
|
+
|
|
171
|
+
local player = fakePlayer()
|
|
172
|
+
player:SetAttribute("ActiveSlotId", "slot-xyz")
|
|
173
|
+
|
|
174
|
+
local data = teleportDataService:BuildTeleportData({ player })
|
|
175
|
+
expect(data[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toEqual("slot-xyz")
|
|
176
|
+
|
|
177
|
+
player:Destroy()
|
|
178
|
+
serviceBag:Destroy()
|
|
179
|
+
end)
|
|
180
|
+
|
|
181
|
+
it("should not carry a slot id when the single player has no active slot", function()
|
|
182
|
+
local serviceBag, _saveSlotService, teleportDataService = newServiceBag()
|
|
183
|
+
serviceBag:Start()
|
|
184
|
+
|
|
185
|
+
local player = fakePlayer()
|
|
186
|
+
|
|
187
|
+
local data = teleportDataService:BuildTeleportData({ player })
|
|
188
|
+
expect(data[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toBeNil()
|
|
189
|
+
|
|
190
|
+
player:Destroy()
|
|
191
|
+
serviceBag:Destroy()
|
|
192
|
+
end)
|
|
193
|
+
|
|
194
|
+
it("should not carry a slot id for a multi-player teleport", function()
|
|
195
|
+
local serviceBag, _saveSlotService, teleportDataService = newServiceBag()
|
|
196
|
+
serviceBag:Start()
|
|
197
|
+
|
|
198
|
+
local playerA = fakePlayer()
|
|
199
|
+
local playerB = fakePlayer()
|
|
200
|
+
playerA:SetAttribute("ActiveSlotId", "slot-a")
|
|
201
|
+
playerB:SetAttribute("ActiveSlotId", "slot-b")
|
|
202
|
+
|
|
203
|
+
local data = teleportDataService:BuildTeleportData({ playerA, playerB })
|
|
204
|
+
expect(data[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toBeNil()
|
|
205
|
+
|
|
206
|
+
playerA:Destroy()
|
|
207
|
+
playerB:Destroy()
|
|
208
|
+
serviceBag:Destroy()
|
|
209
|
+
end)
|
|
210
|
+
|
|
211
|
+
it("should report IsInternalTeleport from the arrived teleport data", function()
|
|
212
|
+
local serviceBag, saveSlotService, teleportDataService = newServiceBag()
|
|
213
|
+
serviceBag:Start()
|
|
214
|
+
|
|
215
|
+
local arrived = fakePlayer()
|
|
216
|
+
teleportDataService:SetArrivedTeleportDataForTesting(arrived, {
|
|
217
|
+
[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY] = "slot-1",
|
|
218
|
+
})
|
|
219
|
+
expect(saveSlotService:IsInternalTeleport(arrived)).toEqual(true)
|
|
220
|
+
|
|
221
|
+
local fresh = fakePlayer()
|
|
222
|
+
teleportDataService:SetArrivedTeleportDataForTesting(fresh, {})
|
|
223
|
+
expect(saveSlotService:IsInternalTeleport(fresh)).toEqual(false)
|
|
224
|
+
|
|
225
|
+
arrived:Destroy()
|
|
226
|
+
fresh:Destroy()
|
|
227
|
+
serviceBag:Destroy()
|
|
228
|
+
end)
|
|
229
|
+
end)
|
|
@@ -10,5 +10,6 @@ local AdorneeDataEntry = require("AdorneeDataEntry")
|
|
|
10
10
|
|
|
11
11
|
return AdorneeData.new({
|
|
12
12
|
ActiveSlotId = AdorneeDataEntry.optionalAttribute("string", "ActiveSlotId"),
|
|
13
|
+
LastActiveSlotId = AdorneeDataEntry.optionalAttribute("string", "LastActiveSlotId"),
|
|
13
14
|
MaxSlotCount = math.huge,
|
|
14
15
|
})
|
|
@@ -7,6 +7,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
|
|
8
8
|
local BaseObject = require("BaseObject")
|
|
9
9
|
local HasSaveSlotsData = require("HasSaveSlotsData")
|
|
10
|
+
local Promise = require("Promise")
|
|
10
11
|
local SaveSlotData = require("SaveSlotData")
|
|
11
12
|
local ServiceBag = require("ServiceBag")
|
|
12
13
|
local Signal = require("Signal")
|
|
@@ -24,6 +25,7 @@ export type HasSaveSlotsBase =
|
|
|
24
25
|
_attributes: any,
|
|
25
26
|
|
|
26
27
|
ActiveSlotId: ValueObject.ValueObject<SaveSlotData.SlotId?>,
|
|
28
|
+
LastActiveSlotId: ValueObject.ValueObject<SaveSlotData.SlotId?>,
|
|
27
29
|
MaxSlotCount: ValueObject.ValueObject<number>,
|
|
28
30
|
|
|
29
31
|
SlotChanged: Signal.Signal<SaveSlotData.SlotId>,
|
|
@@ -40,6 +42,7 @@ function HasSaveSlotsBase.new(player: Player, serviceBag: ServiceBag.ServiceBag)
|
|
|
40
42
|
self._attributes = HasSaveSlotsData:Create(self._obj)
|
|
41
43
|
|
|
42
44
|
self.ActiveSlotId = self._attributes.ActiveSlotId
|
|
45
|
+
self.LastActiveSlotId = self._attributes.LastActiveSlotId
|
|
43
46
|
self.MaxSlotCount = self._attributes.MaxSlotCount
|
|
44
47
|
|
|
45
48
|
self.SlotChanged = self.ActiveSlotId.Changed
|
|
@@ -47,4 +50,55 @@ function HasSaveSlotsBase.new(player: Player, serviceBag: ServiceBag.ServiceBag)
|
|
|
47
50
|
return self
|
|
48
51
|
end
|
|
49
52
|
|
|
53
|
+
--[=[
|
|
54
|
+
Returns the save-slot id the player teleported in with, or nil. Realm hook: the server reads it
|
|
55
|
+
from the join data, the client from the local player's teleport data (both via
|
|
56
|
+
[TeleportDataService]). The base default returns nil so a realm that never sets one degrades to
|
|
57
|
+
"no incoming slot".
|
|
58
|
+
|
|
59
|
+
@return SaveSlotData.SlotId?
|
|
60
|
+
]=]
|
|
61
|
+
function HasSaveSlotsBase._getIncomingSlotId(_self: HasSaveSlotsBase): SaveSlotData.SlotId?
|
|
62
|
+
return nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
--[=[
|
|
66
|
+
Returns whether the player teleported in carrying a save-slot id that still exists for them.
|
|
67
|
+
This is the existence-validated form of "internal teleport".
|
|
68
|
+
|
|
69
|
+
@return Promise<boolean>
|
|
70
|
+
]=]
|
|
71
|
+
function HasSaveSlotsBase.PromiseHasSaveSlotFromTeleport(self: HasSaveSlotsBase): Promise.Promise<boolean>
|
|
72
|
+
local slotId = self:_getIncomingSlotId()
|
|
73
|
+
if type(slotId) ~= "string" then
|
|
74
|
+
return (Promise :: any).resolved(false)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
return (self :: any):PromiseHasSlot(slotId)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
--[=[
|
|
81
|
+
Selects the save slot the player teleported in with when it still exists, resolving to that slot
|
|
82
|
+
id -- or nil when there was no incoming slot or it no longer exists. Reuses the realm's own
|
|
83
|
+
`PromiseHasSlot`/`PromiseSelectSlot`, so it works identically on server and client.
|
|
84
|
+
|
|
85
|
+
@return Promise<SaveSlotData.SlotId?>
|
|
86
|
+
]=]
|
|
87
|
+
function HasSaveSlotsBase.PromiseLoadSaveSlotFromTeleport(self: HasSaveSlotsBase): Promise.Promise<SaveSlotData.SlotId?>
|
|
88
|
+
local slotId = self:_getIncomingSlotId()
|
|
89
|
+
if type(slotId) ~= "string" then
|
|
90
|
+
return (Promise :: any).resolved(nil)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
return (self :: any):PromiseHasSlot(slotId):Then(function(hasSlot: boolean)
|
|
94
|
+
if not hasSlot then
|
|
95
|
+
return nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
return (self :: any):PromiseSelectSlot(slotId):Then(function()
|
|
99
|
+
return slotId
|
|
100
|
+
end)
|
|
101
|
+
end)
|
|
102
|
+
end
|
|
103
|
+
|
|
50
104
|
return HasSaveSlotsBase
|
|
@@ -9,6 +9,7 @@ local TieDefinition = require("TieDefinition")
|
|
|
9
9
|
|
|
10
10
|
return TieDefinition.new("HasSaveSlots", {
|
|
11
11
|
ActiveSlotId = TieDefinition.Types.PROPERTY,
|
|
12
|
+
LastActiveSlotId = TieDefinition.Types.PROPERTY,
|
|
12
13
|
MaxSlotCount = TieDefinition.Types.PROPERTY,
|
|
13
14
|
|
|
14
15
|
PromiseHasSlot = TieDefinition.Types.METHOD,
|
|
@@ -20,10 +21,20 @@ return TieDefinition.new("HasSaveSlots", {
|
|
|
20
21
|
PromiseSlotIdFromIndex = TieDefinition.Types.METHOD,
|
|
21
22
|
PromiseLastActiveSlotId = TieDefinition.Types.METHOD,
|
|
22
23
|
|
|
24
|
+
-- Answered from the teleport data the player arrived with (see HasSaveSlotsBase); both realms
|
|
25
|
+
-- resolve the incoming slot id from their own [TeleportDataService].
|
|
26
|
+
PromiseHasSaveSlotFromTeleport = TieDefinition.Types.METHOD,
|
|
27
|
+
PromiseLoadSaveSlotFromTeleport = TieDefinition.Types.METHOD,
|
|
28
|
+
|
|
23
29
|
SlotChanged = TieDefinition.Types.SIGNAL,
|
|
24
30
|
|
|
25
31
|
[TieDefinition.Realms.SERVER] = {
|
|
26
32
|
ObserveActiveSlotStoreBrio = TieDefinition.Types.METHOD,
|
|
27
33
|
PromiseActiveSlotStore = TieDefinition.Types.METHOD,
|
|
34
|
+
PromiseSlotsLoaded = TieDefinition.Types.METHOD,
|
|
35
|
+
PromiseDeselectSlot = TieDefinition.Types.METHOD,
|
|
36
|
+
PromiseSelectLastSaveSlot = TieDefinition.Types.METHOD,
|
|
37
|
+
PromiseSelectNewSaveSlot = TieDefinition.Types.METHOD,
|
|
38
|
+
PromiseDeleteAllSlots = TieDefinition.Types.METHOD,
|
|
28
39
|
},
|
|
29
40
|
})
|
|
@@ -53,6 +53,21 @@ function SaveSlotDataService.ObserveActiveSlotId(
|
|
|
53
53
|
})
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
--[=[
|
|
57
|
+
Observes the player's last active slot ID (the slot they can continue on)
|
|
58
|
+
]=]
|
|
59
|
+
function SaveSlotDataService.ObserveLastActiveSlotId(
|
|
60
|
+
self: SaveSlotDataService,
|
|
61
|
+
player: Player
|
|
62
|
+
): Observable.Observable<SaveSlotData.SlotId?>
|
|
63
|
+
return (HasSaveSlotsInterface:ObserveBrio(player, self._realm) :: any):Pipe({
|
|
64
|
+
RxBrioUtils.switchMapBrio(function(hasSaveSlots)
|
|
65
|
+
return hasSaveSlots.LastActiveSlotId:Observe()
|
|
66
|
+
end),
|
|
67
|
+
RxBrioUtils.emitOnDeath(nil),
|
|
68
|
+
})
|
|
69
|
+
end
|
|
70
|
+
|
|
56
71
|
--[=[
|
|
57
72
|
Returns the player's active slot ID
|
|
58
73
|
]=]
|