mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
refactor: refine types and code
This commit is contained in:
parent
33ecae2f50
commit
382bc3a904
6 changed files with 30 additions and 26 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue