71 lines
1.8 KiB
Lua
71 lines
1.8 KiB
Lua
---Create a Resource query that will return the specific ECS world resource.
|
|
---
|
|
---@see ResQuery
|
|
---@param resource table|userdata
|
|
---@return ResQuery
|
|
function Res(resource)
|
|
return ResQuery.new(resource)
|
|
end
|
|
|
|
---@alias Query function|table|userdata
|
|
|
|
---Create a `ChangedQuery` query that will return only if the resource or component has changed
|
|
---since last tick.
|
|
---
|
|
---@see ChangedQuery
|
|
---@param val table|userdata
|
|
---@return ChangedQuery
|
|
function Changed(val)
|
|
return ChangedQuery.new(val)
|
|
end
|
|
|
|
---Create a `HasQuery` filter that will return only if the entity has a specific component.
|
|
---
|
|
---@see HasQuery
|
|
---@param val table|userdata
|
|
---@return HasQuery
|
|
function Has(val)
|
|
return HasQuery.new(val)
|
|
end
|
|
|
|
---Create a `NotQuery` filter that will allow results if the query returns nothing or
|
|
---filter denies.
|
|
---
|
|
---@see NotQuery
|
|
---@param val Query
|
|
---@return NotQuery
|
|
function Not(val)
|
|
return NotQuery.new(val)
|
|
end
|
|
|
|
---Create a `OrQuery` filter that will allow results if any of the queries return something.
|
|
---The queries are evaluated in the order they were provided.
|
|
---
|
|
---@see OrQuery
|
|
---@param ... Query
|
|
---@return OrQuery
|
|
function Or(...)
|
|
return OrQuery.new(...)
|
|
end
|
|
|
|
---Create a `TickOfQuery` for retrieving the tick of the resource or component on the entity.
|
|
---
|
|
---@see TickOfQuery
|
|
---@param ... table|userdata
|
|
---@return TickOfQuery
|
|
function TickOf(...)
|
|
return TickOfQuery.new(...)
|
|
end
|
|
|
|
---Create any `OptionalQuery` that allows for a query to return nothing.
|
|
---
|
|
---If the query is a filter, its result will essentially be ignored. If the query returns `None`
|
|
---or `AlwaysNone`, this query will return `Nil`. If the query results in a value, its value
|
|
---will be the result of this query.
|
|
---
|
|
---@see OptionalQuery
|
|
---@param q Query
|
|
---@return OptionalQuery
|
|
function Optional(q)
|
|
return OptionalQuery.new(q)
|
|
end |