-- Compiled with roblox-ts v3.0.0-dev-834585a local TS = _G[script] local componentNameCtorMap = TS.import(script, script.Parent, "componentNameCtorMap").componentNameCtorMap --[[ * * Returns the payload that represents the whole syncable state of the world. * * If the components payload of the entity is empty, it will be ommited from the result payload. * * @shared ]] local function getHydratePayload(world) local entities = {} for entityId, entityData in world do local encodedEntityId = tostring(entityId) local components = {} for component, componentData in entityData do local encodedComponentName = tostring(component) if componentNameCtorMap[encodedComponentName] ~= nil then if not (entities[encodedEntityId] ~= nil) then entities[encodedEntityId] = components end components[encodedComponentName] = componentData end end end return { payload = entities, isEmpty = (next(entities)) == nil, } end return { getHydratePayload = getHydratePayload, }