diff --git a/.lune/build.luau b/.lune/build.luau index ea82a48..6bfc7a7 100644 --- a/.lune/build.luau +++ b/.lune/build.luau @@ -3,4 +3,4 @@ local spawn = require("util/spawn") spawn.start("rojo sourcemap dev.project.json -o sourcemap.json") spawn.start("darklua process --config .darklua.json lib/ dist/", { env = { ROBLOX_DEV = "false" } }) -spawn.start("rojo build build.project.json -o build.rbxm") +spawn.start("rojo build default.project.json -o build.rbxm") diff --git a/.lune/dev.luau b/.lune/dev.luau index 62050a7..af12920 100644 --- a/.lune/dev.luau +++ b/.lune/dev.luau @@ -26,7 +26,7 @@ while true do local commit_title = stdio.prompt("text", "Commit title -- leave blank to stop committing") if not commit_title or commit_title == "" then print("Stopping commit") - break + continue end local commit_messages = "" diff --git a/build.project.json b/build.project.json deleted file mode 100644 index 047a782..0000000 --- a/build.project.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "jecs-utils", - "tree": { - "$path": "dist" - } -} diff --git a/default.project.json b/default.project.json index c1b2026..047a782 100644 --- a/default.project.json +++ b/default.project.json @@ -1,6 +1,6 @@ { "name": "jecs-utils", "tree": { - "$path": "lib" + "$path": "dist" } } diff --git a/lib/jecs.luau b/lib/jecs.luau index 35f2682..bd92479 100644 --- a/lib/jecs.luau +++ b/lib/jecs.luau @@ -727,7 +727,6 @@ local function world_add(world: World, entity: i53, id: i53): () end end --- Symmetric like `World.add` but idempotent local function world_set(world: World, entity: i53, id: i53, data: unknown): () local entityIndex = world.entityIndex local record = entityIndex.sparse[entity] @@ -1020,38 +1019,38 @@ do if idr_t then for archetype_id in idr_t.cache do local children = {} - local idr_o_archetype = archetypes[archetype_id] + local idr_t_archetype = archetypes[archetype_id] - local idr_o_types = idr_o_archetype.types + local idr_t_types = idr_t_archetype.types - for _, child in idr_o_archetype.entities do + for _, child in idr_t_archetype.entities do table.insert(children, child) end - for _, id in idr_o_types do + for _, id in idr_t_types do if not ECS_IS_PAIR(id) then continue end - - local id_record = component_index[id] - - if id_record then + local object = ECS_ENTITY_T_LO(id) + if object == delete then + local id_record = component_index[id] local flags = id_record.flags if bit32.band(flags, ECS_ID_DELETE) ~= 0 then for _, child in children do -- Cascade deletions of it has Delete as component trait world_delete(world, child, destruct) end + + break else - local object = ECS_ENTITY_T_LO(id) - if object == delete then - for _, child in children do - world_remove(world, child, id) - end + for _, child in children do + world_remove(world, child, id) end end end end + + archetype_destroy(world, idr_t_archetype) end end diff --git a/wally.toml b/wally.toml index 8f3a060..8341d61 100644 --- a/wally.toml +++ b/wally.toml @@ -1,6 +1,6 @@ [package] name = "mark-marks/jecs-utils" -version = "0.1.1" +version = "0.1.2" registry = "https://github.com/UpliftGames/wally-index" realm = "shared" license = "MIT"