From 19031103e2d8e5cc7d79dc0871496e2b67171e4b Mon Sep 17 00:00:00 2001 From: marked Date: Wed, 11 Jun 2025 02:11:34 +0200 Subject: [PATCH] Sync to released Jecs 0.6.1-nightly.20250611T001113Z (#91) Reviewed-on: https://git.devmarked.win/marked/jecs-nightly/pulls/91 --- jecs/CHANGELOG.md | 8 ++++++++ jecs/build.txt | 4 ++-- jecs/jecs.luau | 29 +++++++++++++++-------------- jecs/pesde-rbx.toml | 2 +- jecs/pesde.toml | 2 +- jecs/test.txt | 2 +- jecs/test_fulllog.txt | 10 ++++++---- jecs/wally.toml | 2 +- 8 files changed, 35 insertions(+), 24 deletions(-) diff --git a/jecs/CHANGELOG.md b/jecs/CHANGELOG.md index 12cd1ad..28a4d81 100644 --- a/jecs/CHANGELOG.md +++ b/jecs/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +## 0.6.1 + +### Changed +- Entity types now unions with numbers should allow for easier time casting while not causing regressing previous behaviours + +### Fixed +- Fixed a critical bug with `(*, R)` pairs not being removed when `R` is deleted + ## 0.6.0 ### Added diff --git a/jecs/build.txt b/jecs/build.txt index bc0a745..f478e19 100644 --- a/jecs/build.txt +++ b/jecs/build.txt @@ -1,2 +1,2 @@ -modified = ["addons/observers.luau", "jecs.luau"] -version = "0.6.0-nightly.20250608T001058Z" +modified = ["CHANGELOG.md", "jecs.luau"] +version = "0.6.1-nightly.20250611T001113Z" diff --git a/jecs/jecs.luau b/jecs/jecs.luau index e5faf96..416bc1f 100644 --- a/jecs/jecs.luau +++ b/jecs/jecs.luau @@ -1,3 +1,4 @@ + --!optimize 2 --!native --!strict @@ -825,7 +826,7 @@ local function world_entity(world: ecs_world_t, entity: i53?): i53 return entity end end - return entity_index_new_id(entity_index, entity) + return entity_index_new_id(entity_index) end local function world_parent(world: ecs_world_t, entity: i53) @@ -1051,7 +1052,7 @@ local function world_remove(world: ecs_world_t, entity: i53, id: i53) end end -local function archetype_fast_delete_last(columns: { Column }, column_count: number, types: { i53 }, entity: i53) +local function archetype_fast_delete_last(columns: { Column }, column_count: number) for i, column in columns do if column ~= NULL_ARRAY then column[column_count] = nil @@ -1059,7 +1060,7 @@ local function archetype_fast_delete_last(columns: { Column }, column_count: num end end -local function archetype_fast_delete(columns: { Column }, column_count: number, row, types, entity) +local function archetype_fast_delete(columns: { Column }, column_count: number, row: number) for i, column in columns do if column ~= NULL_ARRAY then column[row] = column[column_count] @@ -1101,9 +1102,9 @@ local function archetype_delete(world: ecs_world_t, archetype: ecs_archetype_t, entities[last] = nil :: any if row == last then - archetype_fast_delete_last(columns, column_count, id_types, delete) + archetype_fast_delete_last(columns, column_count) else - archetype_fast_delete(columns, column_count, row, id_types, delete) + archetype_fast_delete(columns, column_count, row) end end @@ -1409,14 +1410,14 @@ local function world_delete(world: ecs_world_t, entity: i53) local tr = idr_r_archetype.records[rel] local tr_count = idr_r_archetype.counts[rel] local types = idr_r_archetype.types - for i = tr, tr_count do - ids[types[tr]] = true + for i = tr, tr + tr_count - 1 do + ids[types[i]] = true end + local n = #entities table.move(entities, 1, n, count + 1, children) count += n end - for _, child in children do for id in ids do world_remove(world, child, id) @@ -2525,8 +2526,8 @@ end World.new = world_new -export type Entity = { __T: T } -export type Id = { __T: T } +export type Entity = number | { __T: T } +export type Id = number | { __T: T } export type Pair = Id

type ecs_id_t = Id | Pair | Pair<"Tag", T> export type Item = (self: Query) -> (Entity, T...) @@ -2601,10 +2602,10 @@ export type World = { & ((World, Entity, Id, Id, Id, Id) -> (a?, b?, c?, d?)), --- Returns whether the entity has the ID. - has: ((World, Entity, Id) -> boolean) - & ((World, Entity, Id, Id) -> boolean) - & ((World, Entity, Id, Id, Id) -> boolean) - & (World, Entity, Id, Id, Id, Id) -> boolean, + has: ((World, Entity, Id) -> boolean) + & ((World, Entity, Id, Id) -> boolean) + & ((World, Entity, Id, Id, Id) -> boolean) + & (World, Entity, Id, Id, Id, Id) -> boolean, --- Get parent (target of ChildOf relationship) for entity. If there is no ChildOf relationship pair, it will return nil. parent: (self: World, entity: Entity) -> Entity, diff --git a/jecs/pesde-rbx.toml b/jecs/pesde-rbx.toml index 2ccb5a5..fc09004 100644 --- a/jecs/pesde-rbx.toml +++ b/jecs/pesde-rbx.toml @@ -3,7 +3,7 @@ includes = ["init.luau", "pesde.toml", "README.md", "CHANGELOG.md", "LICENSE", " license = "MIT" name = "marked/jecs_nightly" repository = "https://git.devmarked.win/marked/jecs-nightly" -version = "0.6.0-nightly.20250608T001058Z" +version = "0.6.1-nightly.20250611T001113Z" [indices] default = "https://github.com/pesde-pkg/index" diff --git a/jecs/pesde.toml b/jecs/pesde.toml index 05676ef..7b55c9a 100644 --- a/jecs/pesde.toml +++ b/jecs/pesde.toml @@ -3,7 +3,7 @@ includes = ["init.luau", "pesde.toml", "README.md", "CHANGELOG.md", "LICENSE", " license = "MIT" name = "marked/jecs_nightly" repository = "https://git.devmarked.win/marked/jecs-nightly" -version = "0.6.0-nightly.20250608T001058Z" +version = "0.6.1-nightly.20250611T001113Z" [indices] default = "https://github.com/pesde-pkg/index" diff --git a/jecs/test.txt b/jecs/test.txt index 88728dd..1102df3 100644 --- a/jecs/test.txt +++ b/jecs/test.txt @@ -1,2 +1,2 @@ passed = true -timestamp = "20250610T001109Z" +timestamp = "20250611T001114Z" diff --git a/jecs/test_fulllog.txt b/jecs/test_fulllog.txt index 9498fe4..60b2f05 100644 --- a/jecs/test_fulllog.txt +++ b/jecs/test_fulllog.txt @@ -1,6 +1,7 @@ -7.6 us  2 kB│ delete children of entity -9.1 us  1 kB│ remove friends of entity -345 ns  0  B│ simple deletion of entity +------- +7.5 us  2 kB│ delete children of entity +8.8 us  1 kB│ remove friends of entity +352 ns  0  B│ simple deletion of entity repro NONE│  @@ -25,6 +26,7 @@ PASS│ should not exist after delete world:delete() +PASS│ remove (*, R) pairs when relationship is invalidated PASS│ remove pair when relationship is deleted PASS│ invoke OnRemove hook on all components of deleted entity PASS│ invoke OnRemove hook on relationship if target was deleted @@ -121,5 +123,5 @@ PASS│ #2 PASS│ #3 -74/74 test cases passed in 32.600 ms. +75/75 test cases passed in 33.345 ms. 0 fails diff --git a/jecs/wally.toml b/jecs/wally.toml index 9654f72..705b997 100644 --- a/jecs/wally.toml +++ b/jecs/wally.toml @@ -5,4 +5,4 @@ license = "MIT" name = "mark-marks/jecs-nightly" realm = "shared" registry = "https://github.com/UpliftGames/wally-index" -version = "0.6.0-nightly.20250608T001058Z" +version = "0.6.1-nightly.20250611T001113Z"