Sync to released Jecs 0.5.5-nightly.20250427T001102Z (#46)
Reviewed-on: #46
This commit is contained in:
parent
78c16084de
commit
5acca197e0
7 changed files with 31 additions and 25 deletions
|
@ -1,2 +1,2 @@
|
||||||
modified = ["addons/observers.luau", "CHANGELOG.md", "jecs.luau"]
|
modified = ["jecs.luau"]
|
||||||
version = "0.5.5-nightly.20250426T001101Z"
|
version = "0.5.5-nightly.20250427T001102Z"
|
||||||
|
|
|
@ -1437,19 +1437,24 @@ local function world_delete(world: ecs_world_t, entity: i53)
|
||||||
end
|
end
|
||||||
|
|
||||||
local dense_array = entity_index.dense_array
|
local dense_array = entity_index.dense_array
|
||||||
local index_of_deleted_entity = record.dense
|
local dense = record.dense
|
||||||
local index_of_last_alive_entity = entity_index.alive_count
|
local i_swap = entity_index.alive_count
|
||||||
entity_index.alive_count = index_of_last_alive_entity - 1
|
entity_index.alive_count = i_swap - 1
|
||||||
|
|
||||||
local last_alive_entity = dense_array[index_of_last_alive_entity]
|
local e_swap = dense_array[i_swap]
|
||||||
local r_swap = entity_index_try_get_any(entity_index, last_alive_entity) :: ecs_record_t
|
local r_swap = entity_index_try_get_any(entity_index, e_swap) :: ecs_record_t
|
||||||
r_swap.dense = index_of_deleted_entity
|
|
||||||
|
r_swap.dense = dense
|
||||||
record.archetype = nil :: any
|
record.archetype = nil :: any
|
||||||
record.row = nil :: any
|
record.row = nil :: any
|
||||||
record.dense = index_of_last_alive_entity
|
record.dense = i_swap
|
||||||
|
|
||||||
dense_array[index_of_deleted_entity] = last_alive_entity
|
dense_array[dense] = e_swap
|
||||||
dense_array[index_of_last_alive_entity] = ECS_GENERATION_INC(entity)
|
dense_array[i_swap] = ECS_GENERATION_INC(entity)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function world_exists(world: ecs_world_t, entity): boolean
|
||||||
|
return entity_index_try_get_any(world.entity_index, entity) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local function world_contains(world: ecs_world_t, entity): boolean
|
local function world_contains(world: ecs_world_t, entity): boolean
|
||||||
|
@ -2443,6 +2448,7 @@ World.has = world_has
|
||||||
World.target = world_target
|
World.target = world_target
|
||||||
World.parent = world_parent
|
World.parent = world_parent
|
||||||
World.contains = world_contains
|
World.contains = world_contains
|
||||||
|
World.exists = world_exists
|
||||||
World.cleanup = world_cleanup
|
World.cleanup = world_cleanup
|
||||||
World.each = world_each
|
World.each = world_each
|
||||||
World.children = world_children
|
World.children = world_children
|
||||||
|
@ -2482,12 +2488,6 @@ local function world_new()
|
||||||
entity_index_new_id(entity_index)
|
entity_index_new_id(entity_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = EcsRest + 1, ecs_max_tag_id do
|
|
||||||
-- Initialize built-in components
|
|
||||||
entity_index_new_id(entity_index)
|
|
||||||
print("hm...", i)
|
|
||||||
end
|
|
||||||
|
|
||||||
world_add(self, EcsName, EcsComponent)
|
world_add(self, EcsName, EcsComponent)
|
||||||
world_add(self, EcsOnChange, EcsComponent)
|
world_add(self, EcsOnChange, EcsComponent)
|
||||||
world_add(self, EcsOnAdd, EcsComponent)
|
world_add(self, EcsOnAdd, EcsComponent)
|
||||||
|
@ -2510,6 +2510,10 @@ local function world_new()
|
||||||
|
|
||||||
world_add(self, EcsChildOf, ECS_PAIR(EcsOnDeleteTarget, EcsDelete))
|
world_add(self, EcsChildOf, ECS_PAIR(EcsOnDeleteTarget, EcsDelete))
|
||||||
|
|
||||||
|
for i = EcsRest + 1, ecs_max_tag_id do
|
||||||
|
entity_index_new_id(entity_index)
|
||||||
|
end
|
||||||
|
|
||||||
for i, bundle in ecs_metadata do
|
for i, bundle in ecs_metadata do
|
||||||
for ty, value in bundle do
|
for ty, value in bundle do
|
||||||
if value == NULL then
|
if value == NULL then
|
||||||
|
@ -2612,6 +2616,9 @@ export type World = {
|
||||||
--- Checks if the world contains the given entity
|
--- Checks if the world contains the given entity
|
||||||
contains:(self: World, entity: Entity) -> boolean,
|
contains:(self: World, entity: Entity) -> boolean,
|
||||||
|
|
||||||
|
--- Checks if the entity exists
|
||||||
|
exists: (self: World, entity: Entity) -> boolean,
|
||||||
|
|
||||||
each: <T>(self: World, id: Id<T>) -> () -> Entity,
|
each: <T>(self: World, id: Id<T>) -> () -> Entity,
|
||||||
|
|
||||||
children: <T>(self: World, id: Id<T>) -> () -> Entity,
|
children: <T>(self: World, id: Id<T>) -> () -> Entity,
|
||||||
|
|
|
@ -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.5.5-nightly.20250426T001101Z"
|
version = "0.5.5-nightly.20250427T001102Z"
|
||||||
|
|
||||||
[indices]
|
[indices]
|
||||||
default = "https://github.com/pesde-pkg/index"
|
default = "https://github.com/pesde-pkg/index"
|
||||||
|
|
|
@ -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.5.5-nightly.20250426T001101Z"
|
version = "0.5.5-nightly.20250427T001102Z"
|
||||||
|
|
||||||
[indices]
|
[indices]
|
||||||
default = "https://github.com/pesde-pkg/index"
|
default = "https://github.com/pesde-pkg/index"
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
passed = true
|
passed = true
|
||||||
timestamp = "20250426T001103Z"
|
timestamp = "20250427T001104Z"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
hm... 271
|
[38;1m7.2[0m [33;1mus[0m [38;1m 2[0m [33;1mkB[0m[38;1m│[0m [38;1mdelete children of entity[0m
|
||||||
[38;1m7.7[0m [33;1mus[0m [38;1m 3[0m [33;1mkB[0m[38;1m│[0m [38;1mdelete children of entity[0m
|
[38;1m9.2[0m [33;1mus[0m [38;1m 1[0m [33;1mkB[0m[38;1m│[0m [38;1mremove friends of entity[0m
|
||||||
[38;1m9.3[0m [33;1mus[0m [38;1m 1[0m [33;1mkB[0m[38;1m│[0m [38;1mremove friends of entity[0m
|
|
||||||
[38;1m349[0m [32;1mns[0m [38;1m 0[0m [32;1m B[0m[38;1m│[0m [38;1msimple deletion of entity[0m
|
[38;1m349[0m [32;1mns[0m [38;1m 0[0m [32;1m B[0m[38;1m│[0m [38;1msimple deletion of entity[0m
|
||||||
*created [32;1me1000[0m[33;1mv0[0m
|
*created [32;1me1000[0m[33;1mv0[0m
|
||||||
[37;1mworld:add()[0m
|
[37;1mworld:add()[0m
|
||||||
|
@ -119,5 +118,5 @@ hm... 271
|
||||||
[32;1mPASS[0m[38;1m│[0m [38;1m#2[0m
|
[32;1mPASS[0m[38;1m│[0m [38;1m#2[0m
|
||||||
[32;1mPASS[0m[38;1m│[0m [38;1m#3[0m
|
[32;1mPASS[0m[38;1m│[0m [38;1m#3[0m
|
||||||
|
|
||||||
[38;1m72/72 test cases passed in 31.076 ms.[0m
|
[38;1m72/72 test cases passed in 32.525 ms.[0m
|
||||||
[32;1m0 fails[0m
|
[32;1m0 fails[0m
|
||||||
|
|
|
@ -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.5.5-nightly.20250426T001101Z"
|
version = "0.5.5-nightly.20250427T001102Z"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue