detach returns boolean now

This commit is contained in:
BlackMATov
2024-11-28 23:45:17 +07:00
parent 104fed6486
commit ed6db0701a
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ registry.has_any -> entity -> entity... -> (boolean)
registry.assign -> entity -> entity -> any -> (boolean)
registry.insert -> entity -> entity -> any -> (boolean)
registry.remove -> entity -> entity... -> (boolean)
registry.detach -> entity -> (entity)
registry.detach -> entity -> (boolean)
registry.query -> entity... -> (query)
registry.include -> query -> entity... -> query
registry.exclude -> query -> entity... -> query
+3 -3
View File
@@ -277,11 +277,11 @@ do
assert(e:alive())
assert(e.__chunk == evo.registry.chunk(f1, f2))
assert(e == e:detach())
assert(e:detach())
assert(e:alive())
assert(e.__chunk == nil)
assert(e == e:detach())
assert(not e:detach())
assert(e:alive())
assert(e.__chunk == nil)
end
@@ -360,7 +360,7 @@ do
assert(not e:alive())
assert(e.__chunk == nil)
assert(e == e:detach())
assert(not e:detach())
assert(not e:alive())
assert(e.__chunk == nil)
end
+4 -4
View File
@@ -591,18 +591,18 @@ function registry.remove(entity, ...)
end
---@param entity evolved.entity
---@return evolved.entity
---@return boolean is_detached
function registry.detach(entity)
if not idpools.alive(__guids, entity.__guid) then
return entity
return false
end
if entity.__chunk == nil then
return entity
return false
end
__detach_entity(entity)
return entity
return true
end
---@param ... evolved.entity fragments