From 5e0bb21faf3ed9d4e535954254f2ccb3008a9ff7 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sat, 23 Nov 2024 07:48:07 +0700 Subject: [PATCH] simple api reference --- README.md | 33 ++++++++++++++++++++++++++++++++- ROADMAP.md | 1 + evolved/registry.lua | 6 ------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 893f3e6..873f6c7 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,39 @@ ## API Reference +### Module `registry` + ``` -coming soon... +registry.entity -> (entity) +registry.is_alive -> entity -> (boolean) +registry.destroy -> entity -> () +registry.get -> entity -> entity -> (any) +registry.get_or -> entity -> entity -> any -> (any) +registry.has -> entity -> entity -> (boolean) +registry.has_all -> entity -> entity -> entity... -> (boolean) +registry.has_any -> entity -> entity -> entity... -> (boolean) +registry.assign -> entity -> entity -> any -> () +registry.insert -> entity -> entity -> any -> () +registry.remove -> entity -> entity -> () +registry.query -> entity -> entity... -> (query) +registry.execute -> query -> (() -> (chunk?)) +registry.chunk -> entity -> entity... -> (chunk) +``` + +### Module `singles` + +``` +singles.single -> any -> (entity) +singles.get -> entity -> (any) +singles.has -> entity -> (boolean) +singles.assign -> entity -> any -> () +``` + +### Module `vectors` + +``` +vectors.vector2 -> number -> number -> (vector2) +vectors.is_vector2 -> any -> (boolean) ``` ## [License (MIT)](./LICENSE.md) diff --git a/ROADMAP.md b/ROADMAP.md index 4d26aa8..7e5b415 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,6 +2,7 @@ ## Backlog +- add oop-like api for entities and queries - cache matched chunks in queries - cache transitions between chunks - chunk's children should be sorted by id and stored in an array instead of a table \ No newline at end of file diff --git a/evolved/registry.lua b/evolved/registry.lua index 48ed4a1..aa03a3a 100644 --- a/evolved/registry.lua +++ b/evolved/registry.lua @@ -471,12 +471,6 @@ function registry.execute(query) end end ---- ---- ---- ---- ---- - ---@param fragment evolved.entity ---@param ... evolved.entity ---@return evolved.chunk