Add Component Negation

Fixes #32
This commit is contained in:
Pablo Ariel Mayobre 2023-02-14 18:14:22 -03:00 committed by Pablo Mayobre
parent 1c99d534c2
commit ea59529ddc
No known key found for this signature in database
GPG key ID: 13A2F589D013E0E7
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