refactor: refine types and code

This commit is contained in:
Richard 2024-03-27 23:49:33 -07:00
parent 33ecae2f50
commit 382bc3a904
6 changed files with 30 additions and 26 deletions

View file

@ -42,10 +42,12 @@ local function server(options: ServerOptions): ServerSyncer
state = getState()
if state ~= previous then
local diffs = patch.diff(previous, state)
for _, player in Players:GetPlayers() do
callback(player, {
type = "patch",
data = patch.diff(previous, state),
data = diffs,
})
end
end
@ -66,7 +68,7 @@ local function server(options: ServerOptions): ServerSyncer
assert(sync, "connect() must be called before hydrate()")
sync(player, {
type = "set",
type = "init",
data = getState(),
})
end