feat: Save slots#692
Conversation
Test Results
8 tested, 8 passed, 0 failed in 22.5s · View logs Deploy Results
1 deployed, 1 passed, 0 failed in 2.4s · View logs |
Quenty
left a comment
There was a problem hiding this comment.
Looks good overall. Left a ton of comments.
| Gets the last active slot ID | ||
| ]=] | ||
| function HasSaveSlotsClient.PromiseLastActiveSlotId(self: HasSaveSlotsClient): Promise.Promise<string?> | ||
| return self._remoting.PromiseLastActiveSlotId:PromiseInvokeServer() |
There was a problem hiding this comment.
Might be worth some fancier cache management, potentially internally a Boolean attribute for loaded and an attribute for the slot id, so that we're effectively cached on the client instead of requesting server a lot.
This will happen on initial game load, potentially many systems may promise the slot id.
There was a problem hiding this comment.
Maybe it would be cleaner for the client to wait for the slots to be replicated, then we can do most of the remote queries synchronously from the data model.
| local data = { | ||
| SlotId = slotId, | ||
| SlotIndex = slotIndex, | ||
| SlotName = (metadata and metadata.SlotName) or `Slot {slotIndex}`, |
There was a problem hiding this comment.
Should maybe rename to UnfilteredSlotName so we remember to filter the text.
Maybe not a big deal though.
There was a problem hiding this comment.
Is it necessary to filter a string that will not be shown to anyone but the originating user?
| slotId: string, | ||
| data: SaveSlotData.SaveSlotMetadata | ||
| ): Promise.Promise<any> | ||
| if data.SlotId and (data.SlotId ~= slotId) then |
There was a problem hiding this comment.
Just use SaveSlotData:IsStrictData() call here to fully check and get a good error message.
There was a problem hiding this comment.
I think this check would still be needed to prevent accidental override of the immutable slot ID.
PlayerDataStoreService wrapper for save slots.
Provides an interface for creating, manipulating, and observing slots such that consumers can seamlessly react to slot switching.