Sync to upstream Jecs 0.6.1-nightly.20250611T001113Z

This commit is contained in:
forgejo-actions 2025-06-11 00:11:32 +00:00 committed by github-actions[bot]
parent d1e5f16bea
commit b734386e7f
8 changed files with 35 additions and 24 deletions

View file

@ -2,6 +2,14 @@
## Unreleased ## 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 ## 0.6.0
### Added ### Added

View file

@ -1,2 +1,2 @@
modified = ["addons/observers.luau", "jecs.luau"] modified = ["CHANGELOG.md", "jecs.luau"]
version = "0.6.0-nightly.20250608T001058Z" version = "0.6.1-nightly.20250611T001113Z"

View file

@ -1,3 +1,4 @@
--!optimize 2 --!optimize 2
--!native --!native
--!strict --!strict
@ -825,7 +826,7 @@ local function world_entity(world: ecs_world_t, entity: i53?): i53
return entity return entity
end end
end end
return entity_index_new_id(entity_index, entity) return entity_index_new_id(entity_index)
end end
local function world_parent(world: ecs_world_t, entity: i53) 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
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 for i, column in columns do
if column ~= NULL_ARRAY then if column ~= NULL_ARRAY then
column[column_count] = nil column[column_count] = nil
@ -1059,7 +1060,7 @@ local function archetype_fast_delete_last(columns: { Column }, column_count: num
end end
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 for i, column in columns do
if column ~= NULL_ARRAY then if column ~= NULL_ARRAY then
column[row] = column[column_count] 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 entities[last] = nil :: any
if row == last then if row == last then
archetype_fast_delete_last(columns, column_count, id_types, delete) archetype_fast_delete_last(columns, column_count)
else else
archetype_fast_delete(columns, column_count, row, id_types, delete) archetype_fast_delete(columns, column_count, row)
end end
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 = idr_r_archetype.records[rel]
local tr_count = idr_r_archetype.counts[rel] local tr_count = idr_r_archetype.counts[rel]
local types = idr_r_archetype.types local types = idr_r_archetype.types
for i = tr, tr_count do for i = tr, tr + tr_count - 1 do
ids[types[tr]] = true ids[types[i]] = true
end end
local n = #entities local n = #entities
table.move(entities, 1, n, count + 1, children) table.move(entities, 1, n, count + 1, children)
count += n count += n
end end
for _, child in children do for _, child in children do
for id in ids do for id in ids do
world_remove(world, child, id) world_remove(world, child, id)
@ -2525,8 +2526,8 @@ end
World.new = world_new World.new = world_new
export type Entity<T = any> = { __T: T } export type Entity<T = any> = number | { __T: T }
export type Id<T = any> = { __T: T } export type Id<T = any> = number | { __T: T }
export type Pair<P, O> = Id<P> export type Pair<P, O> = Id<P>
type ecs_id_t<T=unknown> = Id<T> | Pair<T, "Tag"> | Pair<"Tag", T> type ecs_id_t<T=unknown> = Id<T> | Pair<T, "Tag"> | Pair<"Tag", T>
export type Item<T...> = (self: Query<T...>) -> (Entity, T...) export type Item<T...> = (self: Query<T...>) -> (Entity, T...)
@ -2601,10 +2602,10 @@ export type World = {
& (<T, a, b, c, d>(World, Entity<T>, Id<a>, Id<b>, Id<c>, Id<d>) -> (a?, b?, c?, d?)), & (<T, a, b, c, d>(World, Entity<T>, Id<a>, Id<b>, Id<c>, Id<d>) -> (a?, b?, c?, d?)),
--- Returns whether the entity has the ID. --- Returns whether the entity has the ID.
has: (<T>(World, Entity<T>, Id) -> boolean) has: (<T, a>(World, Entity<T>, Id<a>) -> boolean)
& (<T>(World, Entity<T>, Id, Id) -> boolean) & (<T, a, b >(World, Entity<T>, Id<a>, Id<a>) -> boolean)
& (<T>(World, Entity<T>, Id, Id, Id) -> boolean) & (<T, a, b, c>(World, Entity<T>, Id<a>, Id<b>, Id<c>) -> boolean)
& <T>(World, Entity<T>, Id, Id, Id, Id) -> boolean, & <T, a, b, c, d>(World, Entity<T>, Id<a>, Id<b>, Id<c>, Id<d>) -> boolean,
--- Get parent (target of ChildOf relationship) for entity. If there is no ChildOf relationship pair, it will return nil. --- Get parent (target of ChildOf relationship) for entity. If there is no ChildOf relationship pair, it will return nil.
parent: <T>(self: World, entity: Entity<T>) -> Entity, parent: <T>(self: World, entity: Entity<T>) -> Entity,

View file

@ -3,7 +3,7 @@ includes = ["init.luau", "pesde.toml", "README.md", "CHANGELOG.md", "LICENSE", "
license = "MIT" license = "MIT"
name = "marked/jecs_nightly" name = "marked/jecs_nightly"
repository = "https://git.devmarked.win/marked/jecs-nightly" repository = "https://git.devmarked.win/marked/jecs-nightly"
version = "0.6.0-nightly.20250608T001058Z" version = "0.6.1-nightly.20250611T001113Z"
[indices] [indices]
default = "https://github.com/pesde-pkg/index" default = "https://github.com/pesde-pkg/index"

View file

@ -3,7 +3,7 @@ includes = ["init.luau", "pesde.toml", "README.md", "CHANGELOG.md", "LICENSE", "
license = "MIT" license = "MIT"
name = "marked/jecs_nightly" name = "marked/jecs_nightly"
repository = "https://git.devmarked.win/marked/jecs-nightly" repository = "https://git.devmarked.win/marked/jecs-nightly"
version = "0.6.0-nightly.20250608T001058Z" version = "0.6.1-nightly.20250611T001113Z"
[indices] [indices]
default = "https://github.com/pesde-pkg/index" default = "https://github.com/pesde-pkg/index"

View file

@ -1,2 +1,2 @@
passed = true passed = true
timestamp = "20250610T001109Z" timestamp = "20250611T001114Z"

View file

@ -1,6 +1,7 @@
7.6 us  2 kB│ delete children of entity -------
9.1 us  1 kB│ remove friends of entity 7.5 us  2 kB│ delete children of entity
345 ns  0  B│ simple deletion of entity 8.8 us  1 kB│ remove friends of entity
352 ns  0  B│ simple deletion of entity
repro repro
NONE│  NONE│ 
@ -25,6 +26,7 @@
PASS│ should not exist after delete PASS│ should not exist after delete
world:delete() world:delete()
PASS│ remove (*, R) pairs when relationship is invalidated
PASS│ remove pair when relationship is deleted PASS│ remove pair when relationship is deleted
PASS│ invoke OnRemove hook on all components of deleted entity PASS│ invoke OnRemove hook on all components of deleted entity
PASS│ invoke OnRemove hook on relationship if target was deleted PASS│ invoke OnRemove hook on relationship if target was deleted
@ -121,5 +123,5 @@
PASS│ #2 PASS│ #2
PASS│ #3 PASS│ #3
74/74 test cases passed in 32.600 ms. 75/75 test cases passed in 33.345 ms.
0 fails 0 fails

View file

@ -5,4 +5,4 @@ license = "MIT"
name = "mark-marks/jecs-nightly" name = "mark-marks/jecs-nightly"
realm = "shared" realm = "shared"
registry = "https://github.com/UpliftGames/wally-index" registry = "https://github.com/UpliftGames/wally-index"
version = "0.6.0-nightly.20250608T001058Z" version = "0.6.1-nightly.20250611T001113Z"