From 8a2c15a3833f3a43aa21f6ea3f023efd256a54c5 Mon Sep 17 00:00:00 2001 From: marked <+marked@users.noreply.github.com> Date: Sat, 18 Jan 2025 15:11:04 +0000 Subject: [PATCH] Sync to upstream Jecs 0.5.3 --- init.luau | 10 ++++++---- pesde.toml | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/init.luau b/init.luau index 940e4b7..d80cd00 100644 --- a/init.luau +++ b/init.luau @@ -619,7 +619,7 @@ local function archetype_create(world: World, id_types: { i24 }, ty, prev: i53?) end end - for _, id in id_types do + for id in records do local observer_list = find_observers(world, EcsOnArchetypeCreate, id) if not observer_list then continue @@ -957,8 +957,10 @@ local function archetype_delete(world: World, archetype: Archetype, row: number, -- TODO: if last == 0 then deactivate table + local component_index = world.componentIndex for _, id in id_types do - local on_remove: (entity: i53) -> () = world_get_one_inline(world, id, EcsOnRemove) + local idr = component_index[id] + local on_remove = idr.hooks.on_remove if on_remove then on_remove(delete) end @@ -1156,7 +1158,6 @@ do local idr_t_archetype = archetypes[archetype_id] local idr_t_types = idr_t_archetype.types - local on_remove = idr_t.hooks.on_remove for _, child in idr_t_archetype.entities do table.insert(children, child) @@ -1178,6 +1179,7 @@ do end break else + local on_remove = id_record.hooks.on_remove local to = archetype_traverse_remove(world, id, idr_t_archetype) if on_remove then for _, child in children do @@ -2311,7 +2313,7 @@ export type World = { } return { - World = World, + World = World :: { new: () -> World }, OnAdd = EcsOnAdd :: Entity<(entity: Entity) -> ()>, OnRemove = EcsOnRemove :: Entity<(entity: Entity) -> ()>, diff --git a/pesde.toml b/pesde.toml index a7a3a55..623c65f 100644 --- a/pesde.toml +++ b/pesde.toml @@ -11,7 +11,7 @@ includes = [ license = "MIT" name = "mark_marks/jecs_pesde" repository = "https://git.devmarked.win/marked/jecs-pesde" -version = "0.5.2" +version = "0.5.3" [indices] default = "https://github.com/pesde-pkg/index"