2024-10-23 20:31:47 +00:00
|
|
|
---Create a Resource query that will return the specific ECS world resource.
|
|
|
|
---
|
|
|
|
---@see ResQuery
|
2024-10-20 00:42:28 +00:00
|
|
|
---@param resource table|userdata
|
|
|
|
---@return ResQuery
|
|
|
|
function Res(resource)
|
|
|
|
return ResQuery.new(resource)
|
2024-10-21 01:20:43 +00:00
|
|
|
end
|
|
|
|
|
2024-10-29 18:22:03 +00:00
|
|
|
---@alias Query function|table|userdata
|
|
|
|
|
2024-10-23 20:31:47 +00:00
|
|
|
---Create a `ChangedQuery` query that will return only if the resource or component has changed
|
|
|
|
---since last tick.
|
|
|
|
---
|
|
|
|
---@see ChangedQuery
|
2024-10-22 01:58:22 +00:00
|
|
|
---@param val table|userdata
|
2024-10-21 01:20:43 +00:00
|
|
|
---@return ChangedQuery
|
|
|
|
function Changed(val)
|
|
|
|
return ChangedQuery.new(val)
|
2024-10-23 20:31:47 +00:00
|
|
|
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)
|
2024-10-29 12:48:30 +00:00
|
|
|
end
|
|
|
|
|
2024-10-29 13:19:54 +00:00
|
|
|
---Create a `NotQuery` filter that will allow results if the query returns nothing or
|
|
|
|
---filter denies.
|
2024-10-29 12:48:30 +00:00
|
|
|
---
|
|
|
|
---@see NotQuery
|
2024-10-29 18:22:03 +00:00
|
|
|
---@param val Query
|
2024-10-29 12:48:30 +00:00
|
|
|
---@return NotQuery
|
|
|
|
function Not(val)
|
|
|
|
return NotQuery.new(val)
|
2024-10-29 13:19:54 +00:00
|
|
|
end
|
|
|
|
|
2024-10-30 03:04:00 +00:00
|
|
|
---Create a `AnyQuery` filter that will allow results if any of the queries return something.
|
|
|
|
---
|
2024-10-29 13:19:54 +00:00
|
|
|
---The queries are evaluated in the order they were provided.
|
|
|
|
---
|
2024-10-30 03:04:00 +00:00
|
|
|
---@see AnyQuery
|
2024-10-29 18:22:03 +00:00
|
|
|
---@param ... Query
|
2024-10-30 03:04:00 +00:00
|
|
|
---@return AnyQuery
|
|
|
|
function Any(...)
|
|
|
|
return AnyQuery.new(...)
|
2024-10-29 13:32:32 +00:00
|
|
|
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(...)
|
2024-10-29 18:22:03 +00:00
|
|
|
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)
|
2024-10-20 00:42:28 +00:00
|
|
|
end
|