Add Component Negation

Fixes #32
This commit is contained in:
Pablo Ariel Mayobre 2023-02-14 18:14:22 -03:00
parent 89eab3fb72
commit 695cc2dfe3
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