@ecsframework/core 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/flamework.build CHANGED
@@ -13,7 +13,8 @@
13
13
  "@ecsframework/core:out/framework/flamecs/registry@Wildcard": "$ecsframework:core:framework/flamecs/registry@Wildcard",
14
14
  "@ecsframework/core:out/framework/components/destroyed-component@DestroyComponent": "$ecsframework:core:framework/components/destroyed-component@DestroyComponent",
15
15
  "@ecsframework/core:out/framework/decorators/inject-type@InjectType": "$ecsframework:core:framework/decorators/inject-type@InjectType",
16
- "@ecsframework/core:out/framework/decorators/tagged@TaggedInstance": "$ecsframework:core:framework/decorators/tagged@TaggedInstance"
16
+ "@ecsframework/core:out/framework/decorators/tagged@TaggedInstance": "$ecsframework:core:framework/decorators/tagged@TaggedInstance",
17
+ "@ecsframework/core:out/framework/flamecs/registry@Tag": "$ecsframework:core:framework/flamecs/registry@Tag"
17
18
  },
18
19
  "metadata": {},
19
20
  "identifierPrefix": "$ecsframework:core",
@@ -22,7 +22,7 @@ export declare abstract class BaseSystem {
22
22
  * @param key - Flamework autogenerated key.
23
23
  * @metadata macro
24
24
  */
25
- AddComponent<T extends Pair<Tag>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): void;
25
+ AddPairRuntime<T extends Pair<Tag>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): void;
26
26
  /**
27
27
  * Adds a fully defined pair to an entity. This is used when both the predicate
28
28
  * and object of the pair are known at compile-time.
@@ -32,7 +32,7 @@ export declare abstract class BaseSystem {
32
32
  * @param key - Flamework autogenerated key.
33
33
  * @metadata macro
34
34
  */
35
- AddComponent<T extends Pair<Tag, defined>>(entity: Entity, key?: ResolveKey<T> | string): void;
35
+ AddPairStatic<T extends Pair<Tag, defined>>(entity: Entity, key?: ResolveKey<T> | string): void;
36
36
  /**
37
37
  * Adds a component to an entity.
38
38
  *
@@ -52,7 +52,7 @@ export declare abstract class BaseSystem {
52
52
  * @param key - Flamework autogenerated key.
53
53
  * @metadata macro
54
54
  */
55
- SetComponent<T extends Pair<defined>>(entity: Entity, object: Entity, value: ResolveValue<T>, key?: ComponentKey<ExtractPredicate<T>> | string): void;
55
+ SetPairRuntime<T extends Pair<defined>>(entity: Entity, object: Entity, value: ResolveValue<T>, key?: ComponentKey<ExtractPredicate<T>> | string): void;
56
56
  /**
57
57
  * Sets a value for a fully defined pair on an entity. This is used when both
58
58
  * the predicate and object of the pair are known at compile-time.
@@ -63,7 +63,7 @@ export declare abstract class BaseSystem {
63
63
  * @param key - Flamework autogenerated key.
64
64
  * @metadata macro
65
65
  */
66
- SetComponent<T extends Pair<defined, defined>>(entity: Entity, value: ResolveValue<T>, key?: ResolveKey<T>): void;
66
+ SetPairStatic<T extends Pair<defined, defined>>(entity: Entity, value: ResolveValue<T>, key?: ResolveKey<T>): void;
67
67
  /**
68
68
  * Sets a value for a component on an entity.
69
69
  *
@@ -114,7 +114,7 @@ export declare abstract class BaseSystem {
114
114
  * @param key - Flamework autogenerated key.
115
115
  * @metadata macro
116
116
  */
117
- RemoveComponent<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): void;
117
+ RemovePairRuntime<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): void;
118
118
  /**
119
119
  * Removes a fully defined pair from an entity. This is used when both the
120
120
  * predicate and object of the pair are known at compile-time.
@@ -124,7 +124,7 @@ export declare abstract class BaseSystem {
124
124
  * @param key - Flamework autogenerated key.
125
125
  * @metadata macro
126
126
  */
127
- RemoveComponent<T extends Pair<defined, defined>>(entity: Entity, key?: ResolveKey<T>): void;
127
+ RemovePairStatic<T extends Pair<defined, defined>>(entity: Entity, key?: ResolveKey<T>): void;
128
128
  /**
129
129
  * Removes a component from an entity.
130
130
  *
@@ -144,7 +144,7 @@ export declare abstract class BaseSystem {
144
144
  * @returns The value associated with the pair relationship.
145
145
  * @metadata macro
146
146
  */
147
- GetComponent<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): ResolveValue<T> | undefined;
147
+ GetPairRuntime<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): ResolveValue<T> | undefined;
148
148
  /**
149
149
  * Retrieves the value of a component or pair for a specific entity.
150
150
  *
@@ -165,7 +165,7 @@ export declare abstract class BaseSystem {
165
165
  * @returns True if the pair relationship exists, false otherwise.
166
166
  * @metadata macro
167
167
  */
168
- HasComponent<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): boolean;
168
+ HasPairRuntime<T extends Pair<defined>>(entity: Entity, object: Entity, key?: ComponentKey<ExtractPredicate<T>> | string): boolean;
169
169
  /**
170
170
  * Checks if a component or pair exists for a specific entity.
171
171
  *
@@ -273,6 +273,8 @@ export declare abstract class BaseSystem {
273
273
  /** @metadata macro */
274
274
  QueryChange<T>(componentTypeId?: ComponentKey<T> | string, key?: Modding.Caller<"uuid">): IterableFunction<[entity: jecs.Entity, record: import("./hooks/query-change").QueryRecord<T>, isDestroyedEntity: boolean]>;
275
275
  /** @metadata macro */
276
+ QueryChanged<T extends Array<unknown> = []>(terms?: ToIds<Calculate<T>["query"]>, filterWithout?: ToIds<Calculate<T>["without"]>, filterWith?: ToIds<Calculate<T>["with"]>, key?: Modding.Caller<"uuid">): QueryHandle<ExtractQueryTypes<T>>["__iter"];
277
+ /** @metadata macro */
276
278
  Each<T>(key?: ResolveKey<T>): IterableFunction<jecs.Entity<unknown>>;
277
279
  OnPreStartup(): void;
278
280
  OnStartup(): void;
@@ -18,6 +18,7 @@ local target = _registry.target
18
18
  local InjectType = TS.import(script, script.Parent, "decorators", "inject-type").InjectType
19
19
  local QueryChange = TS.import(script, script.Parent, "hooks", "query-change").QueryChange
20
20
  local produce = TS.import(script, TS.getModule(script, "@rbxts", "immut").src).produce
21
+ local queryChanged = TS.import(script, script.Parent, "hooks", "query-changed").queryChanged
21
22
  --* @metadata reflect identifier
22
23
  local BaseSystem
23
24
  do
@@ -25,8 +26,20 @@ do
25
26
  function BaseSystem:constructor()
26
27
  self.__hookStates = {}
27
28
  end
28
- function BaseSystem:AddComponent(entity, argument1, argument2)
29
- return add(self.world, entity, argument1, argument2)
29
+ function BaseSystem:AddPairRuntime(entity, object, key)
30
+ return add(self.world, entity, object, key)
31
+ end
32
+ function BaseSystem:AddPairStatic(entity, key)
33
+ return add(self.world, entity, key, "$ecsframework:core:framework/flamecs/registry@Tag")
34
+ end
35
+ function BaseSystem:AddComponent(entity, key)
36
+ return add(self.world, entity, key, "$ecsframework:core:framework/flamecs/registry@Tag")
37
+ end
38
+ function BaseSystem:SetPairRuntime(entity, object, value, key)
39
+ return set(self.world, entity, object, value, key)
40
+ end
41
+ function BaseSystem:SetPairStatic(entity, value, key)
42
+ return set(self.world, entity, value, key, "$p:never")
30
43
  end
31
44
  function BaseSystem:SetComponent(entity, argument1, argument2, argument3)
32
45
  local classComponent = self:GetClassComponent(argument2)
@@ -79,14 +92,26 @@ do
79
92
  end
80
93
  return insert(self.world, entity, argument1, argument2)
81
94
  end
82
- function BaseSystem:RemoveComponent(entity, argument1, argument2)
83
- return remove(self.world, entity, argument1, argument2)
95
+ function BaseSystem:RemovePairRuntime(entity, object, key)
96
+ return remove(self.world, entity, object, key)
97
+ end
98
+ function BaseSystem:RemovePairStatic(entity, key)
99
+ return remove(self.world, entity, key, "@rbxts/compiler-types:types/core@$p:error")
84
100
  end
85
- function BaseSystem:GetComponent(entity, argument1, argument2)
86
- return get(self.world, entity, argument1, argument2)
101
+ function BaseSystem:RemoveComponent(entity, key)
102
+ return remove(self.world, entity, key, "@rbxts/compiler-types:types/core@$p:error")
87
103
  end
88
- function BaseSystem:HasComponent(entity, argument1, argument2)
89
- return has(self.world, entity, argument1, argument2)
104
+ function BaseSystem:GetPairRuntime(entity, object, key)
105
+ return get(self.world, entity, object, key)
106
+ end
107
+ function BaseSystem:GetComponent(entity, key)
108
+ return get(self.world, entity, key, "@rbxts/compiler-types:types/core@$p:error")
109
+ end
110
+ function BaseSystem:HasPairRuntime(entity, object, key)
111
+ return has(self.world, entity, object, key)
112
+ end
113
+ function BaseSystem:HasComponent(entity, key)
114
+ return has(self.world, entity, key, "@rbxts/compiler-types:types/core@$p:error")
90
115
  end
91
116
  function BaseSystem:TargetComponent(entity, key)
92
117
  return target(self.world, entity, key)
@@ -161,6 +186,9 @@ do
161
186
  function BaseSystem:QueryChange(componentTypeId, key)
162
187
  return QueryChange(componentTypeId, key)
163
188
  end
189
+ function BaseSystem:QueryChanged(terms, filterWithout, filterWith, key)
190
+ return queryChanged(terms, filterWithout, filterWith, key)
191
+ end
164
192
  function BaseSystem:Each(key)
165
193
  return self.world:each(getId(self.world, key))
166
194
  end
@@ -3,6 +3,6 @@ import { World } from "@rbxts/jecs";
3
3
  import { DependenciesContainer } from "../dependencies-container";
4
4
  export interface TaggedInstance<T> {
5
5
  Tag: string;
6
- OnCreateData: (instance: Instance, world: World, container: DependenciesContainer) => Partial<T>;
6
+ OnCreateData?: (instance: Instance, world: World, container: DependenciesContainer) => Partial<T>;
7
7
  }
8
8
  export declare function Tagged<T>(options: TaggedInstance<T>): (target: Constructor<T>) => void;
@@ -23,7 +23,7 @@ export type ToIds<T> = T extends [] ? undefined : ResolveKeys<T>;
23
23
  export type ExtractQueryTypes<T extends Array<unknown>> = Reconstruct<ResolveValues<Calculate<T>["query"]>>;
24
24
  export type QueryHandle<T extends Array<unknown>> = {
25
25
  __iter(): IterableFunction<LuaTuple<[Entity, ...T]>>;
26
- registry: ecs.World;
26
+ world: ecs.World;
27
27
  filterWith?: Array<Id>;
28
28
  filterWithout?: Array<Id>;
29
29
  /**
@@ -38,7 +38,9 @@ export type QueryHandle<T extends Array<unknown>> = {
38
38
  */
39
39
  pair<P>(object: Entity, predicate?: ComponentKey<P>): QueryHandle<[...T, Unwrap<P>]>;
40
40
  terms?: Array<Id>;
41
+ querySource: ecs.Query<Array<Id>>;
41
42
  } & IterableFunction<LuaTuple<[Entity, ...T]>>;
43
+ export declare function createQuery<T extends Array<unknown> = []>(world: ecs.World, terms?: ToIds<Calculate<T>["query"]>, filterWithout?: ToIds<Calculate<T>["without"]>, filterWith?: ToIds<Calculate<T>["with"]>): ecs.Query<Array<Id>>;
42
44
  /**
43
45
  * A world contains entities associated with some components. This function
44
46
  * creates a query handle for retrieving entities that match the specified
@@ -8,7 +8,7 @@ local getId = _registry.getId
8
8
  local function queryPair(self, object, predicate)
9
9
  local _predicate = predicate
10
10
  assert(_predicate ~= "" and _predicate)
11
- local id = ecs.pair(component(self.registry, predicate), object)
11
+ local id = ecs.pair(component(self.world, predicate), object)
12
12
  local _result
13
13
  if self.terms then
14
14
  local _array = {}
@@ -27,7 +27,7 @@ local function queryPair(self, object, predicate)
27
27
  end
28
28
  local function queryIter(self)
29
29
  if self.terms then
30
- local ecsQuery = self.registry:query(unpack(self.terms))
30
+ local ecsQuery = self.world:query(unpack(self.terms))
31
31
  if self.filterWithout then
32
32
  ecsQuery = ecsQuery:without(unpack(self.filterWithout))
33
33
  end
@@ -40,6 +40,61 @@ local function queryIter(self)
40
40
  -- Do nothing.
41
41
  end
42
42
  end
43
+ local function createQuery(world, terms, filterWithout, filterWith)
44
+ local _processedTerms = terms
45
+ if _processedTerms ~= nil then
46
+ -- ▼ ReadonlyArray.map ▼
47
+ local _newValue = table.create(#_processedTerms)
48
+ local _callback = function(v)
49
+ return getId(world, v)
50
+ end
51
+ for _k, _v in _processedTerms do
52
+ _newValue[_k] = _callback(_v, _k - 1, _processedTerms)
53
+ end
54
+ -- ▲ ReadonlyArray.map ▲
55
+ _processedTerms = _newValue
56
+ end
57
+ local processedTerms = _processedTerms
58
+ local _processedFilterWithout = filterWithout
59
+ if _processedFilterWithout ~= nil then
60
+ -- ▼ ReadonlyArray.map ▼
61
+ local _newValue = table.create(#_processedFilterWithout)
62
+ local _callback = function(v)
63
+ return getId(world, v)
64
+ end
65
+ for _k, _v in _processedFilterWithout do
66
+ _newValue[_k] = _callback(_v, _k - 1, _processedFilterWithout)
67
+ end
68
+ -- ▲ ReadonlyArray.map ▲
69
+ _processedFilterWithout = _newValue
70
+ end
71
+ local processedFilterWithout = _processedFilterWithout
72
+ local _processedFilterWith = filterWith
73
+ if _processedFilterWith ~= nil then
74
+ -- ▼ ReadonlyArray.map ▼
75
+ local _newValue = table.create(#_processedFilterWith)
76
+ local _callback = function(v)
77
+ return getId(world, v)
78
+ end
79
+ for _k, _v in _processedFilterWith do
80
+ _newValue[_k] = _callback(_v, _k - 1, _processedFilterWith)
81
+ end
82
+ -- ▲ ReadonlyArray.map ▲
83
+ _processedFilterWith = _newValue
84
+ end
85
+ local processedFilterWith = _processedFilterWith
86
+ if processedTerms then
87
+ local ecsQuery = world:query(unpack(processedTerms))
88
+ if processedFilterWithout then
89
+ ecsQuery = ecsQuery:without(unpack(processedFilterWithout))
90
+ end
91
+ if processedFilterWith then
92
+ ecsQuery = ecsQuery:with(unpack(processedFilterWith))
93
+ end
94
+ return ecsQuery
95
+ end
96
+ return world:query()
97
+ end
43
98
  --[[
44
99
  *
45
100
  * A world contains entities associated with some components. This function
@@ -99,7 +154,7 @@ local function query(registry, terms, filterWithout, filterWith)
99
154
  end
100
155
  local processedFilterWith = _processedFilterWith
101
156
  local queryHandle = {
102
- registry = registry,
157
+ world = registry,
103
158
  __iter = queryIter,
104
159
  filterWith = processedFilterWith,
105
160
  filterWithout = processedFilterWithout,
@@ -110,5 +165,6 @@ local function query(registry, terms, filterWithout, filterWith)
110
165
  return queryHandle
111
166
  end
112
167
  return {
168
+ createQuery = createQuery,
113
169
  query = query,
114
170
  }
@@ -0,0 +1,15 @@
1
+ import type { Modding } from "@flamework/core";
2
+ import { Calculate, Id, ToIds } from "../flamecs";
3
+ /**
4
+ * Utility for easy time-based throttling.
5
+ *
6
+ * Accepts a duration and returns `true` if it has been that long since the last
7
+ * time this function returned `true`. Always returns `true` the first time.
8
+ *
9
+ * @param seconds - The number of seconds to throttle for.
10
+ * @param discriminator - An optional value to additionally key by.
11
+ * @param key - An automatically generated key to store the throttle state.
12
+ * @returns - Returns true every x seconds, otherwise false.
13
+ * @metadata macro
14
+ */
15
+ export declare function queryChanged<T extends Array<unknown> = []>(terms?: ToIds<Calculate<T>["query"]>, filterWithout?: ToIds<Calculate<T>["without"]>, filterWith?: ToIds<Calculate<T>["with"]>, key?: Modding.Caller<"uuid">): () => import("@rbxts/jecs").IterFn<Id<unknown>[]>;
@@ -0,0 +1,34 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _flamecs = TS.import(script, script.Parent.Parent, "flamecs")
4
+ local createQuery = _flamecs.createQuery
5
+ local useHookState = _flamecs.useHookState
6
+ local useWorld = _flamecs.useWorld
7
+ local CreateQueryChanged = TS.import(script, script.Parent.Parent, "jecs-utils", "query-changed").CreateQueryChanged
8
+ --[[
9
+ *
10
+ * Utility for easy time-based throttling.
11
+ *
12
+ * Accepts a duration and returns `true` if it has been that long since the last
13
+ * time this function returned `true`. Always returns `true` the first time.
14
+ *
15
+ * @param seconds - The number of seconds to throttle for.
16
+ * @param discriminator - An optional value to additionally key by.
17
+ * @param key - An automatically generated key to store the throttle state.
18
+ * @returns - Returns true every x seconds, otherwise false.
19
+ * @metadata macro
20
+
21
+ ]]
22
+ local function queryChanged(terms, filterWithout, filterWith, key)
23
+ local storage = useHookState(key, nil, function()
24
+ return false
25
+ end)
26
+ local world = useWorld()
27
+ if storage.query == nil then
28
+ storage.query = CreateQueryChanged(createQuery(world, terms, filterWithout, filterWith))
29
+ end
30
+ return storage.query.iter
31
+ end
32
+ return {
33
+ queryChanged = queryChanged,
34
+ }
@@ -0,0 +1,2 @@
1
+ import * as jecs from "@rbxts/jecs";
2
+ export = jecs;
@@ -0,0 +1,4 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local jecs = TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs)
4
+ return jecs
@@ -0,0 +1,353 @@
1
+ --!strict
2
+ local jecs = require(script.Parent["jecs-importer"])
3
+
4
+ type World = jecs.World
5
+ type Query<T...> = jecs.Query<T...>
6
+
7
+ type Id<T = any> = jecs.Id<T>
8
+
9
+ export type Iter<T...> = (Observer<T...>) -> () -> (jecs.Entity, T...)
10
+
11
+ export type Observer<T...> = {
12
+ disconnect: () -> (),
13
+ }
14
+
15
+ export type Monitor<T...> = {
16
+ disconnect: () -> (),
17
+ added: ((jecs.Entity) -> ()) -> (),
18
+ removed: ((jecs.Entity) -> ()) -> (),
19
+ }
20
+
21
+ type QueryInner = jecs.Query<...any> & jecs.QueryInner
22
+
23
+ local function get_matching_archetypes(world: jecs.World, query: jecs.Query<...any>)
24
+ local archetypes = {}
25
+ local first = query.ids[1]
26
+
27
+ for _, archetype in query:archetypes() do
28
+ archetypes[archetype.id] = true
29
+ end
30
+
31
+ local observable = world.observable
32
+ local on_create_action = observable[jecs.ArchetypeCreate :: any]
33
+ if not on_create_action then
34
+ on_create_action = {} :: any
35
+ observable[jecs.ArchetypeCreate :: any] = on_create_action
36
+ end
37
+
38
+ local query_cache_on_create = on_create_action[first]
39
+ if not query_cache_on_create then
40
+ query_cache_on_create = {}
41
+ on_create_action[first] = query_cache_on_create
42
+ end
43
+
44
+ local on_delete_action = observable[jecs.ArchetypeDelete :: any]
45
+ if not on_delete_action then
46
+ on_delete_action = {} :: any
47
+ observable[jecs.ArchetypeDelete :: any] = on_delete_action
48
+ end
49
+ local query_cache_on_delete = on_delete_action[first]
50
+ if not query_cache_on_delete then
51
+ query_cache_on_delete = {}
52
+ on_delete_action[first] = query_cache_on_delete
53
+ end
54
+
55
+ local function on_create_callback(archetype: jecs.Archetype)
56
+ archetypes[archetype.id] = true
57
+ end
58
+
59
+ local function on_delete_callback(archetype: jecs.Archetype)
60
+ archetypes[archetype.id] = nil
61
+ end
62
+
63
+ local observer_for_create = { query = query :: any, callback = on_create_callback }
64
+ local observer_for_delete = { query = query :: any, callback = on_delete_callback }
65
+
66
+ table.insert(query_cache_on_create, observer_for_create)
67
+ table.insert(query_cache_on_delete, observer_for_delete)
68
+
69
+ local function disconnect()
70
+ table.remove(query_cache_on_create, table.find(query_cache_on_create, observer_for_create))
71
+ table.remove(query_cache_on_delete, table.find(query_cache_on_create, observer_for_delete))
72
+ table.clear(archetypes)
73
+ end
74
+
75
+ return archetypes, disconnect
76
+ end
77
+
78
+ local function observers_new<T...>(query: Query<T...>, callback: (jecs.Entity) -> ()): Observer<T...>
79
+ local world = (query :: Query<T...> & { world: World }).world
80
+ callback = callback
81
+
82
+ local terms = query.ids
83
+ local with: { jecs.Entity } = (query :: QueryInner).filter_with
84
+
85
+ local archetypes, disconnect_archetypes = get_matching_archetypes(world, query)
86
+
87
+ local function emplaced<a>(entity: jecs.Entity)
88
+ local r = jecs.record(world, entity)
89
+ local archetype = r.archetype
90
+
91
+ if archetypes[archetype.id] then
92
+ callback(entity)
93
+ end
94
+ end
95
+
96
+ local cleanup = {}
97
+
98
+ for _, term in terms do
99
+ if jecs.IS_PAIR(term) then
100
+ local rel = jecs.ECS_PAIR_FIRST(term)
101
+ local tgt = jecs.ECS_PAIR_SECOND(term)
102
+ local wc = tgt == jecs.Wildcard
103
+
104
+ local onchanged = world:changed(rel, function(entity, id)
105
+ if wc then
106
+ emplaced(entity)
107
+ elseif id == term then
108
+ emplaced(entity)
109
+ end
110
+ end)
111
+ table.insert(cleanup, onchanged)
112
+ else
113
+ local onchanged = world:changed(term, emplaced)
114
+ table.insert(cleanup, onchanged)
115
+ end
116
+ end
117
+
118
+ if with then
119
+ for _, term in with do
120
+ if jecs.IS_PAIR(term) then
121
+ local rel = jecs.ECS_PAIR_FIRST(term)
122
+ local tgt = jecs.ECS_PAIR_SECOND(term)
123
+ local wc = tgt == jecs.Wildcard
124
+
125
+ local onadded = world:added(rel, function(entity, id)
126
+ if wc then
127
+ emplaced(entity)
128
+ elseif id == term then
129
+ emplaced(entity)
130
+ end
131
+ end)
132
+ table.insert(cleanup, onadded)
133
+ else
134
+ local onadded = world:added(term, emplaced)
135
+ table.insert(cleanup, onadded)
136
+ end
137
+ end
138
+ end
139
+
140
+ local without: { jecs.Id<any> } = (query :: QueryInner).filter_without
141
+ if without then
142
+ for _, term in without do
143
+ if jecs.IS_PAIR(term) then
144
+ local rel = jecs.ECS_PAIR_FIRST(term)
145
+
146
+ local onremoved = world:removed(rel, function(entity, id)
147
+ local r = jecs.record(world, entity)
148
+ local archetype = r.archetype
149
+ local dst = jecs.archetype_traverse_remove(world, id, archetype)
150
+
151
+ if archetypes[dst.id] and not archetypes[archetype.id] then
152
+ callback(entity)
153
+ end
154
+ end)
155
+ table.insert(cleanup, onremoved)
156
+ else
157
+ local onremoved = world:removed(term, function(entity, id)
158
+ local r = jecs.record(world, entity)
159
+ local archetype = r.archetype
160
+ local dst = jecs.archetype_traverse_remove(world, id, archetype)
161
+ if archetypes[dst.id] then
162
+ callback(entity)
163
+ end
164
+ end)
165
+ table.insert(cleanup, onremoved)
166
+ end
167
+ end
168
+ end
169
+
170
+ local function disconnect()
171
+ disconnect_archetypes()
172
+
173
+ for _, disconnect in cleanup do
174
+ disconnect()
175
+ end
176
+ end
177
+
178
+ local observer = {
179
+ disconnect = disconnect,
180
+ }
181
+
182
+ return observer
183
+ end
184
+
185
+ local function monitors_new<T...>(query: Query<T...>): Monitor<T...>
186
+ local world = (query :: Query<T...> & { world: World }).world
187
+ local archetypes, disconnect_archetypes = get_matching_archetypes(world, query)
188
+ local terms: { jecs.Entity } = (query :: QueryInner).filter_with or query.ids
189
+
190
+ local callback_added: ((jecs.Entity) -> ())?
191
+ local callback_removed: ((jecs.Entity) -> ())?
192
+
193
+ local function archetype_changed<a>(entity: jecs.Entity, src: jecs.Archetype, dst: jecs.Archetype)
194
+ if archetypes[dst.id] then
195
+ if not archetypes[src.id] then
196
+ if callback_added then
197
+ callback_added(entity)
198
+ end
199
+ end
200
+ else
201
+ if archetypes[src.id] then
202
+ if callback_removed then
203
+ callback_removed(entity)
204
+ end
205
+ end
206
+ end
207
+ end
208
+
209
+ local cleanup = {}
210
+
211
+ for _, term in terms do
212
+ if jecs.IS_PAIR(term) then
213
+ local rel = jecs.ECS_PAIR_FIRST(term)
214
+
215
+ local onadded = world:added(rel, function(entity, id, _, src)
216
+ if callback_added == nil then
217
+ return
218
+ end
219
+ local r = jecs.record(world, entity :: any)
220
+ local dst = r and r.archetype
221
+
222
+ if dst then
223
+ archetype_changed(entity, src, dst)
224
+ end
225
+ end)
226
+ local onremoved = world:removed(rel, function(entity, id)
227
+ if callback_removed == nil then
228
+ return
229
+ end
230
+ local r = jecs.record(world, entity)
231
+ local src = r and r.archetype
232
+ local dst = src and jecs.archetype_traverse_remove(world, id, src)
233
+ if src then
234
+ archetype_changed(entity, src, dst)
235
+ else
236
+ callback_removed(entity)
237
+ end
238
+ end)
239
+ table.insert(cleanup, onadded)
240
+ table.insert(cleanup, onremoved)
241
+ else
242
+ local onadded = world:added(term, function(entity, id, _, src)
243
+ if callback_added == nil then
244
+ return
245
+ end
246
+ local r = jecs.record(world, entity)
247
+ local dst = r and r.archetype
248
+
249
+ if dst then
250
+ archetype_changed(entity, src, dst)
251
+ end
252
+ end)
253
+ local onremoved = world:removed(term, function(entity)
254
+ if callback_removed == nil then
255
+ return
256
+ end
257
+ local r = jecs.record(world, entity)
258
+ local archetype = r and r.archetype
259
+
260
+ if not archetype or archetypes[archetype.id] then
261
+ callback_removed(entity)
262
+ end
263
+ end)
264
+ table.insert(cleanup, onadded)
265
+ table.insert(cleanup, onremoved)
266
+ end
267
+ end
268
+
269
+ local without: { jecs.Id<any> } = (query :: QueryInner).filter_without
270
+ if without then
271
+ for _, term in without do
272
+ if jecs.IS_PAIR(term) then
273
+ local rel = jecs.ECS_PAIR_FIRST(term)
274
+
275
+ local onadded = world:added(rel, function(entity, id, _, src)
276
+ if callback_removed == nil then
277
+ return
278
+ end
279
+ local r = jecs.record(world, entity)
280
+ local dst = r.archetype
281
+
282
+ if dst then
283
+ archetype_changed(entity, src, dst)
284
+ end
285
+ end)
286
+ local onremoved = world:removed(rel, function(entity, id)
287
+ if callback_added == nil then
288
+ return
289
+ end
290
+ local r = jecs.record(world, entity)
291
+ local src = r.archetype
292
+ local dst = src and jecs.archetype_traverse_remove(world, id, src)
293
+ if dst then
294
+ archetype_changed(entity, src, dst)
295
+ end
296
+ end)
297
+ table.insert(cleanup, onadded)
298
+ table.insert(cleanup, onremoved)
299
+ else
300
+ local onadded = world:added(term, function(entity, id, _, src)
301
+ if callback_removed == nil then
302
+ return
303
+ end
304
+
305
+ if archetypes[src.id] then
306
+ callback_removed(entity)
307
+ end
308
+ end)
309
+ local onremoved = world:removed(term, function(entity, id)
310
+ if callback_added == nil then
311
+ return
312
+ end
313
+ local r = jecs.record(world, entity)
314
+ local src = r.archetype
315
+ local dst = src and jecs.archetype_traverse_remove(world, id, src)
316
+ if dst then
317
+ archetype_changed(entity, src, dst)
318
+ end
319
+ end)
320
+ table.insert(cleanup, onadded)
321
+ table.insert(cleanup, onremoved)
322
+ end
323
+ end
324
+ end
325
+
326
+ local function disconnect()
327
+ disconnect_archetypes()
328
+ for _, disconnect in cleanup do
329
+ disconnect()
330
+ end
331
+ end
332
+
333
+ local function monitor_added(callback)
334
+ callback_added = callback
335
+ end
336
+
337
+ local function monitor_removed(callback)
338
+ callback_removed = callback
339
+ end
340
+
341
+ local monitor = {
342
+ disconnect = disconnect,
343
+ added = monitor_added,
344
+ removed = monitor_removed,
345
+ } :: Monitor<T...>
346
+
347
+ return monitor
348
+ end
349
+
350
+ return {
351
+ monitor = monitors_new,
352
+ observer = observers_new,
353
+ }
@@ -0,0 +1,12 @@
1
+ import { Id, IterFn, Query } from "@rbxts/jecs";
2
+
3
+ interface QueryChanged<T extends Id<unknown>[]> {
4
+ __iter: () => IterFn<T>;
5
+ disconnect: () => void;
6
+ iter: () => IterFn<T>;
7
+ }
8
+
9
+ type CreateQueryChanged = <T extends Id<unknown>[]>(query: Query<T>) => QueryChanged<T>;
10
+
11
+ declare const CreateQueryChanged: CreateQueryChanged;
12
+ export { CreateQueryChanged, QueryChanged };
@@ -0,0 +1,67 @@
1
+ local jecs = require(script.Parent["jecs-importer"])
2
+ local observers = require(script.Parent.observers)
3
+
4
+ --- Creates an iterator with all the entities where their entity components have changed.
5
+ --- @param query: the query to get entities from
6
+ --- @return iterator: an iterator with all the entities, can also manually iterate with .iter()
7
+ function query_changed(query: jecs.Query<any>)
8
+ local iter_queue = {} :: { jecs.Entity }
9
+ local iter_indexes = {} :: { [jecs.Entity]: number }
10
+
11
+ local observer = observers.observer(query, function(entity: jecs.Entity)
12
+ local index = iter_indexes[entity]
13
+ if index then
14
+ return
15
+ end
16
+
17
+ table.insert(iter_queue, entity)
18
+ iter_indexes[entity] = #iter_queue
19
+ end)
20
+
21
+ local monitor = observers.monitor(query)
22
+ monitor.removed(function(entity)
23
+ local index = iter_indexes[entity]
24
+ if index == nil then
25
+ return
26
+ end
27
+
28
+ local last = table.remove(iter_queue)
29
+ if last and last ~= entity then
30
+ iter_queue[index] = last
31
+ iter_indexes[last] = index
32
+ end
33
+ iter_indexes[entity] = nil
34
+ end)
35
+
36
+ local function iter()
37
+ local now_queue = iter_queue
38
+ local row = #now_queue
39
+
40
+ iter_queue = {}
41
+ iter_indexes = {}
42
+
43
+ return function(): jecs.Entity
44
+ if row == 0 then
45
+ return nil :: any
46
+ end
47
+ local entity = now_queue[row]
48
+ row -= 1
49
+ return entity
50
+ end
51
+ end
52
+ local function disconnect()
53
+ observer.disconnect()
54
+ monitor.disconnect()
55
+ end
56
+
57
+ return setmetatable({
58
+ iter = iter,
59
+ disconnect = disconnect,
60
+ }, {
61
+ __iter = iter,
62
+ })
63
+ end
64
+
65
+ return {
66
+ CreateQueryChanged = query_changed
67
+ }
@@ -51,7 +51,16 @@ do
51
51
  _condition = self.world:entity()
52
52
  end
53
53
  local entity = _condition
54
- self:SetComponent(entity, options.OnCreateData(instance, self.world, self.container), key)
54
+ local _self = self
55
+ local _result = options.OnCreateData
56
+ if _result ~= nil then
57
+ _result = _result(instance, self.world, self.container)
58
+ end
59
+ local _condition_1 = _result
60
+ if _condition_1 == nil then
61
+ _condition_1 = {}
62
+ end
63
+ _self:SetComponent(entity, _condition_1, key)
55
64
  self:SetComponent(entity, {
56
65
  Instance = instance,
57
66
  }, "$ecsframework:core:framework/components/roblox-instance-component@RobloxInstanceComponent")
@@ -75,7 +84,16 @@ do
75
84
  _condition = self.world:entity()
76
85
  end
77
86
  local entity = _condition
78
- self:SetComponent(entity, options.OnCreateData(instance, self.world, self.container), key)
87
+ local _self = self
88
+ local _result = options.OnCreateData
89
+ if _result ~= nil then
90
+ _result = _result(instance, self.world, self.container)
91
+ end
92
+ local _condition_1 = _result
93
+ if _condition_1 == nil then
94
+ _condition_1 = {}
95
+ end
96
+ _self:SetComponent(entity, _condition_1, key)
79
97
  self:SetComponent(entity, {
80
98
  Instance = instance,
81
99
  }, "$ecsframework:core:framework/components/roblox-instance-component@RobloxInstanceComponent")
@@ -1 +1 @@
1
- {"program":{"fileNames":["../node_modules/@rbxts/t/lib/t.d.ts","../node_modules/@flamework/core/out/modding.d.ts","../node_modules/@flamework/core/out/utility.d.ts","../node_modules/@flamework/core/out/reflect.d.ts","../node_modules/@flamework/core/out/flamework.d.ts","../node_modules/@flamework/core/out/index.d.ts","../node_modules/@rbxts/jecs/jecs.d.ts","../node_modules/@rbxts/services/index.d.ts","../src/framework/flamecs/signal.ts","../src/framework/flamecs/registry.ts","../src/framework/flamecs/query.ts","../src/framework/flamecs/topo.ts","../src/framework/flamecs/index.ts","../src/framework/components/destroyed-component.ts","../src/framework/decorators/inject-type.ts","../src/framework/utilities.ts","../src/framework/hooks/query-change.ts","../node_modules/@rbxts/immut/src/none.d.ts","../node_modules/@rbxts/immut/src/makedraftsafe.d.ts","../node_modules/@rbxts/immut/src/makedraftsafereadonly.d.ts","../node_modules/@rbxts/immut/src/table.d.ts","../node_modules/@rbxts/immut/src/types-internal.d.ts","../node_modules/@rbxts/immut/src/types-external.d.ts","../node_modules/@rbxts/immut/src/index.d.ts","../src/framework/base-system.ts","../src/framework/decorators/component.ts","../src/framework/decorators/system.ts","../src/framework/dependencies-container.ts","../node_modules/@rbxts/planck/out/utils.d.ts","../node_modules/@rbxts/planck/out/conditions.d.ts","../node_modules/@rbxts/planck/out/phase.d.ts","../node_modules/@rbxts/planck/out/pipeline.d.ts","../node_modules/@rbxts/planck/out/scheduler.d.ts","../node_modules/@rbxts/planck/out/index.d.ts","../node_modules/@rbxts/planck-runservice/out/index.d.ts","../src/framework/index.ts","../src/framework/decorators/unaffectable.ts","../src/framework/decorators/tagged.ts","../src/framework/components/roblox-instance-component.ts","../src/framework/systems/roblox-instance-system.ts","../src/framework/hooks/use-added.ts","../src/framework/hooks/use-removed.ts","../src/framework/hooks/use-changed.ts","../src/framework/hooks/use-event.ts","../src/framework/hooks/use-throttle.ts","../src/index.ts","../node_modules/@rbxts/types/include/generated/enums.d.ts","../node_modules/@rbxts/types/include/generated/none.d.ts","../node_modules/@rbxts/types/include/lua.d.ts","../node_modules/@rbxts/types/include/macro_math.d.ts","../node_modules/@rbxts/types/include/roblox.d.ts","../node_modules/@rbxts/compiler-types/types/array.d.ts","../node_modules/@rbxts/compiler-types/types/callmacros.d.ts","../node_modules/@rbxts/compiler-types/types/iterable.d.ts","../node_modules/@rbxts/compiler-types/types/map.d.ts","../node_modules/@rbxts/compiler-types/types/promise.d.ts","../node_modules/@rbxts/compiler-types/types/set.d.ts","../node_modules/@rbxts/compiler-types/types/string.d.ts","../node_modules/@rbxts/compiler-types/types/symbol.d.ts","../node_modules/@rbxts/compiler-types/types/typeutils.d.ts","../node_modules/@rbxts/compiler-types/types/eslintignore.d.ts","../node_modules/@rbxts/compiler-types/types/core.d.ts","../node_modules/@rbxts/maid/maid.d.ts","../node_modules/@rbxts/object-utils/index.d.ts","../node_modules/@rbxts/signal/index.d.ts"],"fileInfos":[{"version":"429178068cb844a452dad87eb0a7a02466f3509fff9e7f1187fdb0595e66b8df","signature":false},{"version":"f984bb5cbefabad3e6279516673ca0cb2098304225cfe61987f2af81daf3f99a","signature":false},{"version":"5ed7aeb5909b9e1607087690870addc6df2d3d7e6e3e16f389fe21da53915526","signature":false},{"version":"1fe834c2d906a0d49917ce932bb495bfbb58912d49ad6b03f66ae0be14ad9def","signature":false},{"version":"99709374cb8bf64c65dad5350c88a805af91e107545e18af91e4839d4336a441","signature":false},{"version":"a1a226a8d6b1039d7d0613381c2f4dec614c30305cf96ee973cc49973d9745e4","signature":false},{"version":"1f0f6e103444aad5f544988f7a8390e351b30481ce6eac8ad7765911c56dda6e","signature":false},{"version":"9e6c13e0c00f23d1e9a40e4652ef4e604bdf6747feab7d7b7ca66b5d6bcfa330","signature":false},{"version":"cff894ef201eb519e33e59b861ceb3766076e4f371734218d331157a3b307a11","signature":false},{"version":"047c564d81915ef34ed7d437bd154ad73052e755277872da34479b77330e0f08","signature":false},{"version":"cf75483180e62aa81e878d688cdd40b6d86b120cd84ea4acff735b13c9a81406","signature":false},{"version":"c2b615b7c60bf38930966af14e64cc1ef33ed23ba0a77bdd8ea09fdc4f5e2683","signature":false},{"version":"3800f61fdda8762cb1f766f6badbc560a94853c8c6a21b67d8e0f746eb15926c","signature":false},{"version":"a3adf1732167824c54869e10749d1d5529167a6dbe6fca946e572fb871d40779","signature":false},{"version":"d067a12923433fce55f6f0a6c1d9cb940845dc0f65b1bc9285e83caa622256d5","signature":false},{"version":"4988bac9e48fcefb7dbc164a2aa624d33600eb53f57ed911208c94e1a3f1a871","signature":false},{"version":"f63d7cdd778a7ea18b0d61359ab48023b001d45096dfb759dc09a101c0c41a72","signature":false},{"version":"d9d14150234c32bc0bf772d69182b166d8de600e0e5207924867da19351aca53","signature":false},{"version":"1a73eb921b7aa92d4c2d86ec95a39f5f73cf170b939314394d1b87bd06ae707b","signature":false},{"version":"5e5db3fb2f4f1a4d5276b9ba8f78df1f5f73754eeae5e2c23028f7830a2b66f9","signature":false},{"version":"3a36f6c843d1b4e91f80d6ff3ef8b5e25e1948fae24b8c62631c5df1faf82e41","signature":false},{"version":"dba94b73dbbe23c5066eeafc9f4f8dbf4430a4ab73d2d0d251fe4c1cd029d90b","signature":false},{"version":"564a52d0f974d976d982a2385ac5b353329f2dadab4f7616ee303678a7f64134","signature":false},{"version":"ff329383f830b2ba7578f67a374e2b8077f0b3d7036bf4d1a24edcc95de45c5d","signature":false},{"version":"d154551505359f56c6cd9d43926435dd86edb5ce5c29b26b5f22230910d4e9d9","signature":false},{"version":"006a579b2cba5f46bed75e9eeee7bdb50455232fa1bb585e0420ad9ddef4a683","signature":false},{"version":"afa4bcb1c950e70212cc4ccf83a6096a25bc4280fb03bf94157f2eea853fad15","signature":false},{"version":"d836c32683f074ffd9a72ef601846fae421827220ccd6a4256bbe6f9f46f6b4e","signature":false},{"version":"6012a8d5986c48029756e1c9ad5153f50af540e8aaa76ddf26ca860835857ce9","signature":false},{"version":"499ab101952e35989d138b092f00c4af72eeecbfc8e8f5cf66bedce4b6ad8d95","signature":false},{"version":"901e5e72e5541e609f179f0ac44db1a057a04c13b535504eb3ea9d59b44d7d1b","signature":false},{"version":"81e5cefd5ad881498e2a6ae98eabd1eae22432f569cf96e7d82dab79fd8399f5","signature":false},{"version":"008dae8f3575ffbef098e31624a1da2b0d5defe667df587db66401c3f8f686dc","signature":false},{"version":"c46bd205c2482e6063d0e411e9425b2a27954a700af9e40fc9b60d121951ad21","signature":false},{"version":"00c835dad309d5d7471f0e55193c146cf5fa5f03107c012e63b4d8f122acba34","signature":false},{"version":"d79cde4c87a511f7219963cdbd32ec32bc3de93b2ca943d6046c1c31e2a3ee62","signature":false},{"version":"531c125862ac8e801bca17eaacc89b21e0d49ef80a76bf7dbd09b006f3e27a4a","signature":false},{"version":"f703bdd004e873c241b6fc448c94f61153d98cf1c332026624655034b118caa8","signature":false},{"version":"be4e6ec9fe788d72a70afbdc4c297ea31d842a9ea301559f5ca42cdf13db1383","signature":false},{"version":"ee38938a23ea98b25d086d346d41061bf2d25b4c266a32656138f7e45e4d463a","signature":false},{"version":"8d1395d7fa6381cf71368706cf815130a32895fddd44acb047751072801f90bb","signature":false},{"version":"cdeedec78d8c66fc7522d13e9a2150edda98b18fd3bb95d0f556b6678d0c3739","signature":false},{"version":"7e8bf6cb0c7e13b34a8b40c4b36e633d639b8c4a3b5dec3a55a08bf26caf9a6b","signature":false},{"version":"27b0c41f2f485e59eaaab0d65c192ca022d7fcea87b2c24c9405a91e8b7a4a79","signature":false},{"version":"20d034b52037a7e5b0268fde45a111ffa9f0ae2e04819549d677262711d9dcf2","signature":false},{"version":"f341311f710d466f9ca2585a6828874bb0f902b121fffaf6f4c68d89b6562986","signature":false},{"version":"6eb7fae75c4a1a6bdee1d48700000f43f9d5cff7987f08bd49f21ed1ac0b7c4b","signature":false,"affectsGlobalScope":true},{"version":"3a5626be0c9a1aae6f75d0d38bcea4d070e5d1381a843a9b4eafd3eab6ed7ef7","signature":false,"affectsGlobalScope":true},{"version":"f6c97e5b3403d6f8683372fff53430b8d93728a60f04623bd3de9e470fe71259","signature":false,"affectsGlobalScope":true},{"version":"bfb3f3bd1d89a54d975a7554c8d12209188d7b849d00b9345fd0d41d79858e38","signature":false,"affectsGlobalScope":true},{"version":"22f424c221d557a69d83386550a272558bfef6f81b1dbacd3d35b4651b128d2b","signature":false,"affectsGlobalScope":true},{"version":"d1461f750f98ba938cf3b43f1095774f6007b92a4550bbfde87451dccc32b3bd","signature":false,"affectsGlobalScope":true},{"version":"c30a7a2198451431d80de5f9ba7197a0c8a56d52b29373e7270115776a28f3f3","signature":false,"affectsGlobalScope":true},{"version":"d4d6595aca02f63e2107a842fdd8f79e147fd802acd0e60900f16bee4f861173","signature":false,"affectsGlobalScope":true},{"version":"2070e277f4e874747a7706f000f19f2f512f9829f65f4caf634a908c07f45117","signature":false,"affectsGlobalScope":true},{"version":"7f53343307db666fa6a82bf5165f961d4b70e268ffb7e4e108f06d953c10c679","signature":false,"affectsGlobalScope":true},{"version":"8d10b5097dc2692979a984b4c56deaa0ad77c3a7b036a066ea0a72ec8c514830","signature":false,"affectsGlobalScope":true},{"version":"a252fd9c3a3e55eab45c1c78d376e7a8d82e736d55a5d95a1b285290881d5f88","signature":false,"affectsGlobalScope":true},{"version":"dde6ecc6409a17b372382192ca43c78c52015f34f49547ead38194c63127793a","signature":false,"affectsGlobalScope":true},{"version":"ed7b23f234388de62c9f86bcecd4608a854067fc20f2b4698b9f14ce0d92f4f2","signature":false,"affectsGlobalScope":true},{"version":"85ce7d3110c6652c276ea4d027bc1887176d97a5b7494f288cbbdfb2b48a11ee","signature":false,"affectsGlobalScope":true},{"version":"52535c5f6ea63e76c537e39df77b0720827e3f8d0fac9e2386352f0b6110a211","signature":false,"affectsGlobalScope":true},{"version":"abfe7c34c18ff9a242d5b7e4aba61dfb14b2db55ce5edce1798aaae365fa9cfe","signature":false},{"version":"7b9707d4934d0b63c71920058db2bd6f815b90c4ace1100ea24915c14c9af895","signature":false},{"version":"f73b1d7270a91ed30c71075ee5e0472465931a37ecdb5834c9d8ebe828847b45","signature":false}],"root":[[9,17],[25,28],[36,46]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"downlevelIteration":true,"experimentalDecorators":true,"jsx":2,"module":1,"outDir":"./","rootDir":"../src","strict":true,"target":99,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"fileIdsList":[[1,2,3],[2,4,5],[1,3],[3],[2],[51],[51,52,53,54,55,56,57,58,59,60,61],[18,21,22,23],[19,20],[22],[34],[29],[30,31,32,33],[31],[29,30,31,32,34],[47,51],[48,62],[47,48,49,50,62],[3,6,7,9,10,13,14,15,17,23,24,36],[13],[26],[3,6,7,16,25],[1,6],[3,6,16,25],[3,7,13,16,28],[6],[3,6,15,16],[10,11,12],[7,10],[6,7,9],[7,25],[6,7,10,13,14,16],[6,10,13,16],[6,13],[3,6,7,8,9,10,13,16,25,26,27,28,34,35],[7,8,10,15,16,25,27,28,38,39],[3,6,7,8,10,13,25],[13,14,15,16,17,25,26,27,28,36,37,38,39,40,41,42,43,44,45]],"referencedMap":[[5,1],[6,2],[2,3],[4,4],[3,5],[52,6],[53,6],[62,7],[61,6],[54,6],[55,6],[56,6],[57,6],[58,6],[59,6],[60,6],[24,8],[21,9],[23,10],[35,11],[30,12],[34,13],[32,14],[33,15],[47,6],[48,16],[49,17],[51,18],[25,19],[14,20],[39,21],[26,22],[15,23],[27,24],[38,25],[37,26],[28,27],[13,28],[11,29],[10,30],[12,31],[17,32],[41,33],[43,33],[44,34],[42,33],[45,34],[36,35],[40,36],[16,37],[46,38]],"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65]},"version":"5.5.3"}
1
+ {"program":{"fileNames":["../node_modules/@rbxts/t/lib/t.d.ts","../node_modules/@flamework/core/out/modding.d.ts","../node_modules/@flamework/core/out/utility.d.ts","../node_modules/@flamework/core/out/reflect.d.ts","../node_modules/@flamework/core/out/flamework.d.ts","../node_modules/@flamework/core/out/index.d.ts","../node_modules/@rbxts/jecs/jecs.d.ts","../node_modules/@rbxts/services/index.d.ts","../src/framework/flamecs/signal.ts","../src/framework/flamecs/registry.ts","../src/framework/flamecs/query.ts","../src/framework/flamecs/topo.ts","../src/framework/flamecs/index.ts","../src/framework/components/destroyed-component.ts","../src/framework/decorators/inject-type.ts","../src/framework/utilities.ts","../src/framework/hooks/query-change.ts","../node_modules/@rbxts/immut/src/none.d.ts","../node_modules/@rbxts/immut/src/makedraftsafe.d.ts","../node_modules/@rbxts/immut/src/makedraftsafereadonly.d.ts","../node_modules/@rbxts/immut/src/table.d.ts","../node_modules/@rbxts/immut/src/types-internal.d.ts","../node_modules/@rbxts/immut/src/types-external.d.ts","../node_modules/@rbxts/immut/src/index.d.ts","../src/framework/jecs-utils/query-changed.d.ts","../src/framework/hooks/query-changed.ts","../src/framework/base-system.ts","../src/framework/decorators/component.ts","../src/framework/decorators/system.ts","../src/framework/dependencies-container.ts","../node_modules/@rbxts/planck/out/utils.d.ts","../node_modules/@rbxts/planck/out/conditions.d.ts","../node_modules/@rbxts/planck/out/phase.d.ts","../node_modules/@rbxts/planck/out/pipeline.d.ts","../node_modules/@rbxts/planck/out/scheduler.d.ts","../node_modules/@rbxts/planck/out/index.d.ts","../node_modules/@rbxts/planck-runservice/out/index.d.ts","../src/framework/index.ts","../src/framework/decorators/unaffectable.ts","../src/framework/decorators/tagged.ts","../src/framework/components/roblox-instance-component.ts","../src/framework/systems/roblox-instance-system.ts","../src/framework/hooks/use-added.ts","../src/framework/hooks/use-removed.ts","../src/framework/hooks/use-changed.ts","../src/framework/hooks/use-event.ts","../src/framework/hooks/use-throttle.ts","../src/index.ts","../src/framework/jecs-utils/jecs-importer.ts","../node_modules/@rbxts/types/include/generated/enums.d.ts","../node_modules/@rbxts/types/include/generated/none.d.ts","../node_modules/@rbxts/types/include/lua.d.ts","../node_modules/@rbxts/types/include/macro_math.d.ts","../node_modules/@rbxts/types/include/roblox.d.ts","../node_modules/@rbxts/compiler-types/types/array.d.ts","../node_modules/@rbxts/compiler-types/types/callmacros.d.ts","../node_modules/@rbxts/compiler-types/types/iterable.d.ts","../node_modules/@rbxts/compiler-types/types/map.d.ts","../node_modules/@rbxts/compiler-types/types/promise.d.ts","../node_modules/@rbxts/compiler-types/types/set.d.ts","../node_modules/@rbxts/compiler-types/types/string.d.ts","../node_modules/@rbxts/compiler-types/types/symbol.d.ts","../node_modules/@rbxts/compiler-types/types/typeutils.d.ts","../node_modules/@rbxts/compiler-types/types/eslintignore.d.ts","../node_modules/@rbxts/compiler-types/types/core.d.ts","../node_modules/@rbxts/maid/maid.d.ts","../node_modules/@rbxts/object-utils/index.d.ts","../node_modules/@rbxts/signal/index.d.ts"],"fileInfos":[{"version":"429178068cb844a452dad87eb0a7a02466f3509fff9e7f1187fdb0595e66b8df","signature":false},{"version":"f984bb5cbefabad3e6279516673ca0cb2098304225cfe61987f2af81daf3f99a","signature":false},{"version":"5ed7aeb5909b9e1607087690870addc6df2d3d7e6e3e16f389fe21da53915526","signature":false},{"version":"1fe834c2d906a0d49917ce932bb495bfbb58912d49ad6b03f66ae0be14ad9def","signature":false},{"version":"99709374cb8bf64c65dad5350c88a805af91e107545e18af91e4839d4336a441","signature":false},{"version":"a1a226a8d6b1039d7d0613381c2f4dec614c30305cf96ee973cc49973d9745e4","signature":false},{"version":"1f0f6e103444aad5f544988f7a8390e351b30481ce6eac8ad7765911c56dda6e","signature":false},{"version":"9e6c13e0c00f23d1e9a40e4652ef4e604bdf6747feab7d7b7ca66b5d6bcfa330","signature":false},{"version":"cff894ef201eb519e33e59b861ceb3766076e4f371734218d331157a3b307a11","signature":false},{"version":"047c564d81915ef34ed7d437bd154ad73052e755277872da34479b77330e0f08","signature":false},{"version":"93ba2aced0dbbfbcc06e41012c390b9cf7323ead4cd08852b98ae926bea9f15e","signature":false},{"version":"c2b615b7c60bf38930966af14e64cc1ef33ed23ba0a77bdd8ea09fdc4f5e2683","signature":false},{"version":"3800f61fdda8762cb1f766f6badbc560a94853c8c6a21b67d8e0f746eb15926c","signature":false},{"version":"a3adf1732167824c54869e10749d1d5529167a6dbe6fca946e572fb871d40779","signature":false},{"version":"d067a12923433fce55f6f0a6c1d9cb940845dc0f65b1bc9285e83caa622256d5","signature":false},{"version":"4988bac9e48fcefb7dbc164a2aa624d33600eb53f57ed911208c94e1a3f1a871","signature":false},{"version":"f63d7cdd778a7ea18b0d61359ab48023b001d45096dfb759dc09a101c0c41a72","signature":false},{"version":"d9d14150234c32bc0bf772d69182b166d8de600e0e5207924867da19351aca53","signature":false},{"version":"1a73eb921b7aa92d4c2d86ec95a39f5f73cf170b939314394d1b87bd06ae707b","signature":false},{"version":"5e5db3fb2f4f1a4d5276b9ba8f78df1f5f73754eeae5e2c23028f7830a2b66f9","signature":false},{"version":"3a36f6c843d1b4e91f80d6ff3ef8b5e25e1948fae24b8c62631c5df1faf82e41","signature":false},{"version":"dba94b73dbbe23c5066eeafc9f4f8dbf4430a4ab73d2d0d251fe4c1cd029d90b","signature":false},{"version":"564a52d0f974d976d982a2385ac5b353329f2dadab4f7616ee303678a7f64134","signature":false},{"version":"ff329383f830b2ba7578f67a374e2b8077f0b3d7036bf4d1a24edcc95de45c5d","signature":false},{"version":"ae03613211b26c4c1c0133ad47ec159705ee634de31020e04f2156354ceb93c6","signature":false},{"version":"6112f176d9ff3ca2bce62080ace03d5e33b2a251eed6397d2aca8adb51cb863b","signature":false},{"version":"5b4edc95e28202fb917555a7013d868e5e0a5f84f2c28e640172019d0d3f2546","signature":false},{"version":"006a579b2cba5f46bed75e9eeee7bdb50455232fa1bb585e0420ad9ddef4a683","signature":false},{"version":"afa4bcb1c950e70212cc4ccf83a6096a25bc4280fb03bf94157f2eea853fad15","signature":false},{"version":"d836c32683f074ffd9a72ef601846fae421827220ccd6a4256bbe6f9f46f6b4e","signature":false},{"version":"6012a8d5986c48029756e1c9ad5153f50af540e8aaa76ddf26ca860835857ce9","signature":false},{"version":"499ab101952e35989d138b092f00c4af72eeecbfc8e8f5cf66bedce4b6ad8d95","signature":false},{"version":"901e5e72e5541e609f179f0ac44db1a057a04c13b535504eb3ea9d59b44d7d1b","signature":false},{"version":"81e5cefd5ad881498e2a6ae98eabd1eae22432f569cf96e7d82dab79fd8399f5","signature":false},{"version":"008dae8f3575ffbef098e31624a1da2b0d5defe667df587db66401c3f8f686dc","signature":false},{"version":"c46bd205c2482e6063d0e411e9425b2a27954a700af9e40fc9b60d121951ad21","signature":false},{"version":"00c835dad309d5d7471f0e55193c146cf5fa5f03107c012e63b4d8f122acba34","signature":false},{"version":"d79cde4c87a511f7219963cdbd32ec32bc3de93b2ca943d6046c1c31e2a3ee62","signature":false},{"version":"531c125862ac8e801bca17eaacc89b21e0d49ef80a76bf7dbd09b006f3e27a4a","signature":false},{"version":"6acaf4af108a108b505c278208684baba2846a7187a713ce312d68f547c103e3","signature":false},{"version":"be4e6ec9fe788d72a70afbdc4c297ea31d842a9ea301559f5ca42cdf13db1383","signature":false},{"version":"fb6f1b9cefef803d680a42968a3b57fefdb28e84f82450489278f78b74d74a81","signature":false},{"version":"8d1395d7fa6381cf71368706cf815130a32895fddd44acb047751072801f90bb","signature":false},{"version":"cdeedec78d8c66fc7522d13e9a2150edda98b18fd3bb95d0f556b6678d0c3739","signature":false},{"version":"7e8bf6cb0c7e13b34a8b40c4b36e633d639b8c4a3b5dec3a55a08bf26caf9a6b","signature":false},{"version":"27b0c41f2f485e59eaaab0d65c192ca022d7fcea87b2c24c9405a91e8b7a4a79","signature":false},{"version":"20d034b52037a7e5b0268fde45a111ffa9f0ae2e04819549d677262711d9dcf2","signature":false},{"version":"f341311f710d466f9ca2585a6828874bb0f902b121fffaf6f4c68d89b6562986","signature":false},{"version":"5f584ea703e64b108be0108238bb46f8c74756bb49cd630a2fc2ecbfbfde9ca6","signature":false},{"version":"6eb7fae75c4a1a6bdee1d48700000f43f9d5cff7987f08bd49f21ed1ac0b7c4b","signature":false,"affectsGlobalScope":true},{"version":"3a5626be0c9a1aae6f75d0d38bcea4d070e5d1381a843a9b4eafd3eab6ed7ef7","signature":false,"affectsGlobalScope":true},{"version":"f6c97e5b3403d6f8683372fff53430b8d93728a60f04623bd3de9e470fe71259","signature":false,"affectsGlobalScope":true},{"version":"bfb3f3bd1d89a54d975a7554c8d12209188d7b849d00b9345fd0d41d79858e38","signature":false,"affectsGlobalScope":true},{"version":"22f424c221d557a69d83386550a272558bfef6f81b1dbacd3d35b4651b128d2b","signature":false,"affectsGlobalScope":true},{"version":"d1461f750f98ba938cf3b43f1095774f6007b92a4550bbfde87451dccc32b3bd","signature":false,"affectsGlobalScope":true},{"version":"c30a7a2198451431d80de5f9ba7197a0c8a56d52b29373e7270115776a28f3f3","signature":false,"affectsGlobalScope":true},{"version":"d4d6595aca02f63e2107a842fdd8f79e147fd802acd0e60900f16bee4f861173","signature":false,"affectsGlobalScope":true},{"version":"2070e277f4e874747a7706f000f19f2f512f9829f65f4caf634a908c07f45117","signature":false,"affectsGlobalScope":true},{"version":"7f53343307db666fa6a82bf5165f961d4b70e268ffb7e4e108f06d953c10c679","signature":false,"affectsGlobalScope":true},{"version":"8d10b5097dc2692979a984b4c56deaa0ad77c3a7b036a066ea0a72ec8c514830","signature":false,"affectsGlobalScope":true},{"version":"a252fd9c3a3e55eab45c1c78d376e7a8d82e736d55a5d95a1b285290881d5f88","signature":false,"affectsGlobalScope":true},{"version":"dde6ecc6409a17b372382192ca43c78c52015f34f49547ead38194c63127793a","signature":false,"affectsGlobalScope":true},{"version":"ed7b23f234388de62c9f86bcecd4608a854067fc20f2b4698b9f14ce0d92f4f2","signature":false,"affectsGlobalScope":true},{"version":"85ce7d3110c6652c276ea4d027bc1887176d97a5b7494f288cbbdfb2b48a11ee","signature":false,"affectsGlobalScope":true},{"version":"52535c5f6ea63e76c537e39df77b0720827e3f8d0fac9e2386352f0b6110a211","signature":false,"affectsGlobalScope":true},{"version":"abfe7c34c18ff9a242d5b7e4aba61dfb14b2db55ce5edce1798aaae365fa9cfe","signature":false},{"version":"7b9707d4934d0b63c71920058db2bd6f815b90c4ace1100ea24915c14c9af895","signature":false},{"version":"f73b1d7270a91ed30c71075ee5e0472465931a37ecdb5834c9d8ebe828847b45","signature":false}],"root":[[9,17],[25,30],[38,49]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"downlevelIteration":true,"experimentalDecorators":true,"jsx":2,"module":1,"outDir":"./","rootDir":"../src","strict":true,"target":99,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"fileIdsList":[[1,2,3],[2,4,5],[1,3],[3],[2],[54],[54,55,56,57,58,59,60,61,62,63,64],[18,21,22,23],[19,20],[22],[36],[31],[32,33,34,35],[33],[31,32,33,34,36],[50,54],[51,65],[50,51,52,53,65],[3,6,7,9,10,13,14,15,17,23,24,25,26,38],[13],[28],[3,6,7,16,27],[1,6],[3,6,16,27],[3,7,13,16,30],[6],[3,6,15,16],[10,11,12],[7,10],[6,7,9],[7,27],[6,7,10,13,14,16],[6,13,25],[6,10,13,16],[6,13],[3,6,7,8,9,10,13,16,27,28,29,30,36,37],[7],[7,8,10,15,16,27,29,30,40,41],[3,6,7,8,10,13,27],[13,14,15,16,17,27,28,29,30,38,39,40,41,42,43,44,45,46,47]],"referencedMap":[[5,1],[6,2],[2,3],[4,4],[3,5],[55,6],[56,6],[65,7],[64,6],[57,6],[58,6],[59,6],[60,6],[61,6],[62,6],[63,6],[24,8],[21,9],[23,10],[37,11],[32,12],[36,13],[34,14],[35,15],[50,6],[51,16],[52,17],[54,18],[27,19],[14,20],[41,21],[28,22],[15,23],[29,24],[40,25],[39,26],[30,27],[13,28],[11,29],[10,30],[12,31],[17,32],[26,33],[43,34],[45,34],[46,35],[44,34],[47,35],[38,36],[49,37],[25,37],[42,38],[16,39],[48,40]],"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]},"version":"5.5.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecsframework/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "",
5
5
  "main": "out/init.lua",
6
6
  "scripts": {