Fix small bug when adding entities.

This commit is contained in:
bakpakin
2015-04-19 14:22:51 +08:00
parent d1e5ad731a
commit beb043be49
+4
View File
@@ -318,6 +318,10 @@ function tiny.manageEntities(world)
local filter = sys.filter local filter = sys.filter
if filter then if filter then
local matches = filter(e) and true or nil local matches = filter(e) and true or nil
local onRemove = sys.onRemove
if not matches and es[e] and onRemove then
onRemove(e)
end
local onAdd = sys.onAdd local onAdd = sys.onAdd
if onAdd and matches and not es[e] then if onAdd and matches and not es[e] then
onAdd(e) onAdd(e)