-- Compiled with roblox-ts v3.0.0-dev-834585a local TS = _G[script] local componentNameCtorMap = TS.import(script, script.Parent, "componentNameCtorMap").componentNameCtorMap --[[ * * A hook that should be called each frame. * * Returns a payload that contains all of the changes since the last frame. * * @shared ]] local function useSyncPayload(world) local changes = {} for componentName, component in componentNameCtorMap do for entityId, record in world:queryChanged(component) do local encodedEntityId = tostring(entityId) local components = changes[encodedEntityId] if not components then local newComponents = {} changes[encodedEntityId] = newComponents components = newComponents end if world:contains(entityId) then components[componentName] = { data = record.new, } end end end return { payload = changes, isEmpty = (next(changes)) == nil, } end return { useSyncPayload = useSyncPayload, }