Add Component Negation

Fixes #32
This commit is contained in:
Pablo Ariel Mayobre 2021-01-09 00:22:35 -03:00
parent dd155588a0
commit 8f57cadce9
No known key found for this signature in database
GPG key ID: 5ACD9E6858BEB0A9
4 changed files with 51 additions and 20 deletions

View file

@ -30,10 +30,14 @@ end
-- @tparam Entity e Entity to check
-- @treturn boolean
function Pool:eligible(e)
for i=#self.__filter, 1, -1 do
local component = self.__filter[i].__name
for i=#self.__filter.require, 1, -1 do
local name = self.__filter.require[i]
if not e[name] then return false end
end
if not e[component] then return false end
for i=#self.__filter.reject, 1, -1 do
local name = self.__filter.reject[i]
if e[name] then return false end
end
return true