diff --git a/README.md b/README.md index d009228..76ca474 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/develop/untests/registry_untests.lua b/develop/untests/registry_untests.lua index 6a9dfa5..438c982 100644 --- a/develop/untests/registry_untests.lua +++ b/develop/untests/registry_untests.lua @@ -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 diff --git a/evolved/registry.lua b/evolved/registry.lua index 6bba15d..5bc057b 100644 --- a/evolved/registry.lua +++ b/evolved/registry.lua @@ -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