Compare commits

..

3 commits

Author SHA1 Message Date
Clown
96dc0e4ac3
Merge 96bed9bd7e into a6ae67250c 2025-07-13 21:51:34 -04:00
Ukendio
a6ae67250c Use old interface
Some checks are pending
analysis / Run Luau Analyze (push) Waiting to run
deploy-docs / build (push) Waiting to run
deploy-docs / Deploy (push) Blocked by required conditions
publish-npm / publish (push) Waiting to run
unit-testing / Run Luau Tests (push) Waiting to run
2025-07-14 00:47:20 +02:00
Ukendio
9ae32bcce8 Update hook retrieval 2025-07-14 00:45:01 +02:00

View file

@ -1,20 +1,35 @@
--!strict
local jecs = require("@jecs")
type Description<T...> = jecs.Query<T...>
type ObserverArm = (<a>(
PatchedWorld,
{
query: jecs.Query<a>,
callback: ((jecs.Entity) -> ())?
}
) -> () -> () -> (jecs.Entity)) & (<a, b>(
PatchedWorld,
{
query: jecs.Query<a, b>,
callback: ((jecs.Entity) -> ())?
}
) -> () -> () -> (jecs.Entity)) & (<a, b, c>(
PatchedWorld,
{
query: jecs.Query<a, b, c>,
callback: ((jecs.Entity) -> ())?
}
) -> () -> () -> (jecs.Entity))
export type PatchedWorld = jecs.World & {
added: <T>(PatchedWorld, jecs.Id<T>, <e>(e: jecs.Entity<e>, id: jecs.Id<T>, value: T?) -> ()) -> () -> (),
removed: <T>(PatchedWorld, jecs.Id<T>, (e: jecs.Entity, id: jecs.Id) -> ()) -> () -> (),
changed: <T>(PatchedWorld, jecs.Id<T>, <e>(e: jecs.Entity<e>, id: jecs.Id<T>, value: T) -> ()) -> () -> (),
observer: <T...>(
PatchedWorld,
jecs.Query<T...>,
(<a>(jecs.Entity, jecs.Id<a>, a) -> ())?
) -> () -> (jecs.Entity),
monitor: (
PatchedWorld,
any,
(<a>(jecs.Entity, jecs.Id<a>) -> ())?
) -> ()
observer: ObserverArm & any,
monitor: ObserverArm & any
}
local function observers_new(
@ -46,8 +61,7 @@ local function observers_new(
id: jecs.Id<a>,
value: a?
)
local r = jecs.entity_index_try_get_fast(
entity_index, entity :: any) :: jecs.Record
local r = entity_index.sparse_array[jecs.ECS_ID(entity)]
local archetype = r.archetype