Merge pull request #53 from flamendless/experimental

Fixed bug with serialization/deserialization
This commit is contained in:
Pablo Ariel Mayobre 2021-11-03 00:40:11 -03:00 committed by GitHub
commit 64513ca16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -19,7 +19,7 @@ local Key = Component("key", function (self, key)
end)
function Key:deserialize (data)
self.value = getKey(self, data.value)
self.value = getKey(self, data)
end
function Key:removed (replaced)
@ -28,10 +28,10 @@ function Key:removed (replaced)
if entity:inWorld() then
local world = entity:getWorld()
return world:__clearKey(entity)
end
end
end
return Key
return Key

View file

@ -398,7 +398,8 @@ function World:deserialize(data, startClean, ignoreGenerator)
if data[i].key then
local component = Components.key:__new(entity)
entity.key = component:deserialize(data[i].key)
component:deserialize(data[i].key)
entity.key = component
entity:__dirty()
end