Serializable component

You can remove the component to tell Concord an Entity shouldn't be serialized.

It's given automatically on Entity creation, but this can be disabled by changing Entity.SERIALIZE_BY_DEFAULT to false.
This commit is contained in:
Pablo Ariel Mayobre 2023-02-14 18:14:24 -03:00
parent 892f4d4700
commit cc0fd1614c
4 changed files with 32 additions and 4 deletions

View file

@ -8,7 +8,13 @@ local Components = require(PATH..".components")
local Type = require(PATH..".type")
local Utils = require(PATH..".utils")
local Entity = {}
-- Initialize built-in Components (as soon as possible)
local Builtins = require(PATH..".builtins")
local Entity = {
SERIALIZE_BY_DEFAULT = true,
}
Entity.__mt = {
__index = Entity,
}
@ -31,6 +37,10 @@ function Entity.new(world)
world:addEntity(e)
end
if Entity.SERIALIZE_BY_DEFAULT then
e:give("serializable")
end
return e
end