is_alive, is_empty -> alive, empty

This commit is contained in:
BlackMATov
2025-04-24 08:26:38 +07:00
parent 3fb1467e79
commit 777b80b3b4
5 changed files with 355 additions and 355 deletions

View File

@@ -70,13 +70,13 @@ commit :: boolean
spawn :: <fragment, component>? -> entity spawn :: <fragment, component>? -> entity
clone :: entity -> <fragment, component>? -> entity clone :: entity -> <fragment, component>? -> entity
is_alive :: entity -> boolean alive :: entity -> boolean
is_alive_all :: entity... -> boolean alive_all :: entity... -> boolean
is_alive_any :: entity... -> boolean alive_any :: entity... -> boolean
is_empty :: entity -> boolean empty :: entity -> boolean
is_empty_all :: entity... -> boolean empty_all :: entity... -> boolean
is_empty_any :: entity... -> boolean empty_any :: entity... -> boolean
has :: entity, fragment -> boolean has :: entity, fragment -> boolean
has_all :: entity, fragment... -> boolean has_all :: entity, fragment... -> boolean
@@ -108,8 +108,8 @@ collect_garbage :: ()
``` ```
chunk :: fragment, fragment... -> chunk, entity[], integer chunk :: fragment, fragment... -> chunk, entity[], integer
chunk:is_alive :: boolean chunk:alive :: boolean
chunk:is_empty :: boolean chunk:empty :: boolean
chunk:has :: fragment -> boolean chunk:has :: fragment -> boolean
chunk:has_all :: fragment... -> boolean chunk:has_all :: fragment... -> boolean

View File

@@ -108,7 +108,7 @@ for chunk in evo.execute(all_chunk_query) do
end end
for _, destroyed_entity in ipairs(should_be_destroyed_entity_list) do for _, destroyed_entity in ipairs(should_be_destroyed_entity_list) do
assert(not evo.is_alive(destroyed_entity)) assert(not evo.alive(destroyed_entity))
end end
--- ---

View File

@@ -110,11 +110,11 @@ for chunk in evo.execute(all_chunk_query) do
end end
for _, destroying_entity in ipairs(destroying_entity_list) do for _, destroying_entity in ipairs(destroying_entity_list) do
assert(not evo.is_alive(destroying_entity)) assert(not evo.alive(destroying_entity))
end end
for _, destroyed_entity in ipairs(should_be_destroyed_entity_list) do for _, destroyed_entity in ipairs(should_be_destroyed_entity_list) do
assert(not evo.is_alive(destroyed_entity)) assert(not evo.alive(destroyed_entity))
end end
--- ---

File diff suppressed because it is too large Load Diff

View File

@@ -697,13 +697,13 @@ local __evolved_commit
local __evolved_spawn local __evolved_spawn
local __evolved_clone local __evolved_clone
local __evolved_is_alive local __evolved_alive
local __evolved_is_alive_all local __evolved_alive_all
local __evolved_is_alive_any local __evolved_alive_any
local __evolved_is_empty local __evolved_empty
local __evolved_is_empty_all local __evolved_empty_all
local __evolved_is_empty_any local __evolved_empty_any
local __evolved_has local __evolved_has
local __evolved_has_all local __evolved_has_all
@@ -3488,7 +3488,7 @@ end
---@param entity evolved.entity ---@param entity evolved.entity
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_alive(entity) function __evolved_alive(entity)
local entity_index = entity % 0x100000 local entity_index = entity % 0x100000
return __freelist_ids[entity_index] == entity return __freelist_ids[entity_index] == entity
end end
@@ -3496,7 +3496,7 @@ end
---@param ... evolved.entity entities ---@param ... evolved.entity entities
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_alive_all(...) function __evolved_alive_all(...)
local argument_count = __lua_select('#', ...) local argument_count = __lua_select('#', ...)
if argument_count == 0 then if argument_count == 0 then
@@ -3520,7 +3520,7 @@ end
---@param ... evolved.entity entities ---@param ... evolved.entity entities
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_alive_any(...) function __evolved_alive_any(...)
local argument_count = __lua_select('#', ...) local argument_count = __lua_select('#', ...)
if argument_count == 0 then if argument_count == 0 then
@@ -3544,7 +3544,7 @@ end
---@param entity evolved.entity ---@param entity evolved.entity
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_empty(entity) function __evolved_empty(entity)
local entity_index = entity % 0x100000 local entity_index = entity % 0x100000
return __freelist_ids[entity_index] ~= entity or not __entity_chunks[entity_index] return __freelist_ids[entity_index] ~= entity or not __entity_chunks[entity_index]
end end
@@ -3552,7 +3552,7 @@ end
---@param ... evolved.entity entities ---@param ... evolved.entity entities
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_empty_all(...) function __evolved_empty_all(...)
local argument_count = __lua_select('#', ...) local argument_count = __lua_select('#', ...)
if argument_count == 0 then if argument_count == 0 then
@@ -3576,7 +3576,7 @@ end
---@param ... evolved.entity entities ---@param ... evolved.entity entities
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __evolved_is_empty_any(...) function __evolved_empty_any(...)
local argument_count = __lua_select('#', ...) local argument_count = __lua_select('#', ...)
if argument_count == 0 then if argument_count == 0 then
@@ -4479,13 +4479,13 @@ end
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __debug_fns.chunk_mt:is_alive() function __debug_fns.chunk_mt:alive()
return not self.__unreachable_or_collected return not self.__unreachable_or_collected
end end
---@return boolean ---@return boolean
---@nodiscard ---@nodiscard
function __debug_fns.chunk_mt:is_empty() function __debug_fns.chunk_mt:empty()
return self.__unreachable_or_collected or self.__entity_count == 0 return self.__unreachable_or_collected or self.__entity_count == 0
end end
@@ -5332,13 +5332,13 @@ evolved.commit = __evolved_commit
evolved.spawn = __evolved_spawn evolved.spawn = __evolved_spawn
evolved.clone = __evolved_clone evolved.clone = __evolved_clone
evolved.is_alive = __evolved_is_alive evolved.alive = __evolved_alive
evolved.is_alive_all = __evolved_is_alive_all evolved.alive_all = __evolved_alive_all
evolved.is_alive_any = __evolved_is_alive_any evolved.alive_any = __evolved_alive_any
evolved.is_empty = __evolved_is_empty evolved.empty = __evolved_empty
evolved.is_empty_all = __evolved_is_empty_all evolved.empty_all = __evolved_empty_all
evolved.is_empty_any = __evolved_is_empty_any evolved.empty_any = __evolved_empty_any
evolved.get = __evolved_get evolved.get = __evolved_get