Fixed removed list not being cleared

After an entity has a component removed from it, the apply function wasn't removing it from the removed list.
This had weird side-effects like the inability to readd components after they were removed.

For example:

    entity:give(Foo):apply()
    entity:remove(Foo):apply()
    entity:give(Foo):apply() -- This line would fail to add the Foo component again.
This commit is contained in:
Josh Perry 2018-03-13 17:44:05 +00:00
parent 54af717df8
commit de35fdc450

View file

@ -45,6 +45,7 @@ function Entity:apply()
for component, _ in pairs(self.removed) do
self.components[component] = nil
self.removed[component] = nil
end
return self