From 5fa58c94289955451f7391f170d56b416a268cb7 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sat, 21 Dec 2024 14:53:58 +0700 Subject: [PATCH] update roadmap --- .vscode/settings.json | 2 +- ROADMAP.md | 3 ++- evolved.lua | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e01d82d..e77c781 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "[json][jsonc][lua]": { + "[json][jsonc][lua][markdown]": { "editor.formatOnSave": true, "files.insertFinalNewline": true, "files.trimFinalNewlines": true, diff --git a/ROADMAP.md b/ROADMAP.md index 9f010d8..070cda7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,4 +2,5 @@ ## Backlog -- add tag-fragment trait \ No newline at end of file +- add tag-fragment trait +- allow structural changes in ON_REMOVE hooks diff --git a/evolved.lua b/evolved.lua index 3e55b1c..ae3b6d5 100644 --- a/evolved.lua +++ b/evolved.lua @@ -13,8 +13,8 @@ local evolved = {} ---@field __entities evolved.entity[] ---@field __fragments table ---@field __components table ----@field __with_fragment_cache table ----@field __without_fragment_cache table +---@field __with_fragment_edges table +---@field __without_fragment_edges table --- --- @@ -191,8 +191,8 @@ local function __root_chunk(fragment) __entities = {}, __fragments = { [fragment] = true }, __components = { [fragment] = {} }, - __with_fragment_cache = {}, - __without_fragment_cache = {}, + __with_fragment_edges = {}, + __without_fragment_edges = {}, } do @@ -223,8 +223,8 @@ local function __chunk_with_fragment(chunk, fragment) end do - local cached_chunk = chunk.__with_fragment_cache[fragment] - if cached_chunk then return cached_chunk end + local with_fragment_chunk = chunk.__with_fragment_edges[fragment] + if with_fragment_chunk then return with_fragment_chunk end end if fragment == chunk.__fragment then @@ -236,8 +236,8 @@ local function __chunk_with_fragment(chunk, fragment) __chunk_with_fragment(chunk.__parent, fragment), chunk.__fragment) - chunk.__with_fragment_cache[fragment] = sibling_chunk - sibling_chunk.__without_fragment_cache[fragment] = chunk + chunk.__with_fragment_edges[fragment] = sibling_chunk + sibling_chunk.__without_fragment_edges[fragment] = chunk return sibling_chunk end @@ -250,8 +250,8 @@ local function __chunk_with_fragment(chunk, fragment) __entities = {}, __fragments = { [fragment] = true }, __components = { [fragment] = {} }, - __with_fragment_cache = {}, - __without_fragment_cache = {}, + __with_fragment_edges = {}, + __without_fragment_edges = {}, } for f, _ in pairs(chunk.__components) do @@ -265,8 +265,8 @@ local function __chunk_with_fragment(chunk, fragment) end do - chunk.__with_fragment_cache[fragment] = child_chunk - child_chunk.__without_fragment_cache[fragment] = chunk + chunk.__with_fragment_edges[fragment] = child_chunk + child_chunk.__without_fragment_edges[fragment] = chunk end do @@ -293,8 +293,8 @@ local function __chunk_without_fragment(chunk, fragment) end do - local cached_chunk = chunk.__without_fragment_cache[fragment] - if cached_chunk then return cached_chunk end + local without_fragment_edge = chunk.__without_fragment_edges[fragment] + if without_fragment_edge then return without_fragment_edge end end if fragment == chunk.__fragment then @@ -306,8 +306,8 @@ local function __chunk_without_fragment(chunk, fragment) __chunk_without_fragment(chunk.__parent, fragment), chunk.__fragment) - chunk.__without_fragment_cache[fragment] = sibling_chunk - sibling_chunk.__with_fragment_cache[fragment] = chunk + chunk.__without_fragment_edges[fragment] = sibling_chunk + sibling_chunk.__with_fragment_edges[fragment] = chunk return sibling_chunk end