@oasys/oecs 0.1.2 → 0.2.1
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/README.md +172 -164
- package/dist/archetype.d.ts +50 -13
- package/dist/archetype.d.ts.map +1 -1
- package/dist/component.d.ts +27 -10
- package/dist/component.d.ts.map +1 -1
- package/dist/ecs.d.ts +104 -0
- package/dist/ecs.d.ts.map +1 -0
- package/dist/entity.d.ts.map +1 -1
- package/dist/event.d.ts +2 -2
- package/dist/event.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +673 -321
- package/dist/query.d.ts +28 -31
- package/dist/query.d.ts.map +1 -1
- package/dist/ref.d.ts +19 -0
- package/dist/ref.d.ts.map +1 -0
- package/dist/resource.d.ts +23 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/schedule.d.ts +3 -3
- package/dist/schedule.d.ts.map +1 -1
- package/dist/store.d.ts +48 -29
- package/dist/store.d.ts.map +1 -1
- package/dist/system.d.ts +2 -2
- package/dist/system.d.ts.map +1 -1
- package/dist/type_primitives/assertions.d.ts +1 -0
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.ts +2 -2
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +9 -0
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +20 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/error.d.ts +2 -9
- package/dist/utils/error.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/world.d.ts +0 -73
- package/dist/world.d.ts.map +0 -1
package/dist/query.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Store } from './store';
|
|
2
2
|
import { Archetype } from './archetype';
|
|
3
3
|
import { EntityID } from './entity';
|
|
4
|
-
import { ComponentDef, ComponentFields, FieldValues
|
|
4
|
+
import { ComponentDef, ComponentSchema, ComponentFields, FieldValues } from './component';
|
|
5
|
+
import { ComponentRef } from './ref';
|
|
5
6
|
import { EventDef, EventReader } from './event';
|
|
7
|
+
import { ResourceDef, ResourceReader } from './resource';
|
|
6
8
|
import { BitSet } from './type_primitives';
|
|
7
|
-
type DefsToColumns<Defs extends readonly ComponentDef<ComponentFields>[]> = {
|
|
8
|
-
[K in keyof Defs]: ColumnsForSchema<Defs[K] extends ComponentDef<infer F> ? F : never>;
|
|
9
|
-
};
|
|
10
|
-
type EachFn<Defs extends readonly ComponentDef<ComponentFields>[]> = (...args: [...DefsToColumns<Defs>, number]) => void;
|
|
11
9
|
export interface QueryCacheEntry {
|
|
12
10
|
include_mask: BitSet;
|
|
13
11
|
exclude_mask: BitSet | null;
|
|
@@ -15,59 +13,58 @@ export interface QueryCacheEntry {
|
|
|
15
13
|
query: Query<any>;
|
|
16
14
|
}
|
|
17
15
|
export interface QueryResolver {
|
|
18
|
-
_resolve_query(include: BitSet, exclude: BitSet | null, any_of: BitSet | null, defs: readonly ComponentDef
|
|
16
|
+
_resolve_query(include: BitSet, exclude: BitSet | null, any_of: BitSet | null, defs: readonly ComponentDef[]): Query<any>;
|
|
19
17
|
}
|
|
20
|
-
export declare class Query<Defs extends readonly ComponentDef
|
|
18
|
+
export declare class Query<Defs extends readonly ComponentDef[]> {
|
|
21
19
|
private readonly _archetypes;
|
|
22
20
|
private readonly _defs;
|
|
23
|
-
readonly _resolver
|
|
24
|
-
readonly _include
|
|
25
|
-
readonly _exclude
|
|
26
|
-
readonly _any_of
|
|
27
|
-
private readonly _args_buf;
|
|
21
|
+
private readonly _resolver;
|
|
22
|
+
private readonly _include;
|
|
23
|
+
private readonly _exclude;
|
|
24
|
+
private readonly _any_of;
|
|
28
25
|
constructor(archetypes: Archetype[], defs: Defs, resolver: QueryResolver, include: BitSet, exclude: BitSet | null, any_of: BitSet | null);
|
|
29
26
|
/** Number of matching archetypes (including empty ones). */
|
|
30
|
-
get
|
|
27
|
+
get archetype_count(): number;
|
|
31
28
|
/** Total entity count across all matching archetypes. */
|
|
32
29
|
count(): number;
|
|
33
30
|
get archetypes(): readonly Archetype[];
|
|
34
31
|
/** Iterate non-empty archetypes. Skips archetypes with zero entities. */
|
|
35
32
|
[Symbol.iterator](): Iterator<Archetype>;
|
|
36
|
-
/**
|
|
37
|
-
* Typed per-archetype iteration. Calls fn once per non-empty archetype
|
|
38
|
-
* with column groups for each queried component, plus the entity count.
|
|
39
|
-
* The system is responsible for the inner loop over entities.
|
|
40
|
-
*/
|
|
41
|
-
each(fn: EachFn<Defs>): void;
|
|
42
33
|
/** Extend required component set. Returns a new (cached) Query. */
|
|
43
|
-
and<D extends ComponentDef
|
|
34
|
+
and<D extends ComponentDef[]>(...comps: D): Query<[...Defs, ...D]>;
|
|
44
35
|
/** Exclude archetypes that have any of these components. */
|
|
45
|
-
not(...comps: ComponentDef
|
|
36
|
+
not(...comps: ComponentDef[]): Query<Defs>;
|
|
46
37
|
/** Require at least one of these components. */
|
|
47
|
-
|
|
38
|
+
any_of(...comps: ComponentDef[]): Query<Defs>;
|
|
48
39
|
}
|
|
49
40
|
export declare class QueryBuilder {
|
|
50
41
|
private readonly _resolver;
|
|
51
42
|
constructor(_resolver: QueryResolver);
|
|
52
|
-
every<T extends ComponentDef
|
|
43
|
+
every<T extends ComponentDef[]>(...defs: T): Query<T>;
|
|
53
44
|
}
|
|
54
45
|
export declare class SystemContext {
|
|
55
46
|
private readonly store;
|
|
56
47
|
constructor(store: Store);
|
|
57
48
|
create_entity(): EntityID;
|
|
58
|
-
get_field<
|
|
59
|
-
set_field<
|
|
49
|
+
get_field<S extends ComponentSchema>(entity_id: EntityID, def: ComponentDef<S>, field: string & keyof S): number;
|
|
50
|
+
set_field<S extends ComponentSchema>(entity_id: EntityID, def: ComponentDef<S>, field: string & keyof S, value: number): void;
|
|
51
|
+
/** Create a cached component reference for a single entity. See ref.ts. */
|
|
52
|
+
ref<S extends ComponentSchema>(def: ComponentDef<S>, entity_id: EntityID): ComponentRef<S>;
|
|
60
53
|
/** Buffer an entity for deferred destruction (applied at phase flush). */
|
|
61
54
|
destroy_entity(id: EntityID): this;
|
|
62
|
-
|
|
63
|
-
add_component(entity_id: EntityID, def: ComponentDef<
|
|
64
|
-
|
|
65
|
-
remove_component(entity_id: EntityID, def: ComponentDef<ComponentFields>): this;
|
|
55
|
+
add_component(entity_id: EntityID, def: ComponentDef<Record<string, never>>): this;
|
|
56
|
+
add_component<S extends ComponentSchema>(entity_id: EntityID, def: ComponentDef<S>, values: FieldValues<S>): this;
|
|
57
|
+
remove_component(entity_id: EntityID, def: ComponentDef): this;
|
|
66
58
|
/** Flush all deferred changes: structural (add/remove) first, then destructions. */
|
|
67
59
|
flush(): void;
|
|
68
60
|
emit(def: EventDef<readonly []>): void;
|
|
69
|
-
emit<F extends ComponentFields>(def: EventDef<F>, values:
|
|
61
|
+
emit<F extends ComponentFields>(def: EventDef<F>, values: {
|
|
62
|
+
readonly [K in F[number]]: number;
|
|
63
|
+
}): void;
|
|
70
64
|
read<F extends ComponentFields>(def: EventDef<F>): EventReader<F>;
|
|
65
|
+
resource<F extends ComponentFields>(def: ResourceDef<F>): ResourceReader<F>;
|
|
66
|
+
set_resource<F extends ComponentFields>(def: ResourceDef<F>, values: {
|
|
67
|
+
readonly [K in F[number]]: number;
|
|
68
|
+
}): void;
|
|
71
69
|
}
|
|
72
|
-
export {};
|
|
73
70
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"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,EACvC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,GAClB,cAAc,CAAC,CAAC,CAAC;IAIb,YAAY,CAAC,CAAC,SAAS,eAAe,EAC3C,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,MAAM,EAAE;QAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM;KAAE,GAC5C,IAAI;CAMR"}
|
package/dist/ref.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentSchema } from './component';
|
|
2
|
+
import { ArchetypeColumnLayout } from './archetype';
|
|
3
|
+
import { GrowableTypedArray, AnyTypedArray } from './type_primitives';
|
|
4
|
+
/** Maps component schema to scalar get/set properties: { x: number, y: number }. */
|
|
5
|
+
export type ComponentRef<S extends ComponentSchema> = {
|
|
6
|
+
-readonly [K in keyof S]: number;
|
|
7
|
+
};
|
|
8
|
+
/** Minimal column group shape needed by create_ref. */
|
|
9
|
+
export interface RefColumnGroup {
|
|
10
|
+
readonly layout: ArchetypeColumnLayout;
|
|
11
|
+
readonly columns: GrowableTypedArray<AnyTypedArray>[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a ComponentRef bound to a specific row in a column group.
|
|
15
|
+
* The prototype is built once per column group and cached; subsequent
|
|
16
|
+
* calls for the same group only allocate a lightweight object.
|
|
17
|
+
*/
|
|
18
|
+
export declare function create_ref<S extends ComponentSchema>(group: RefColumnGroup, row: number): ComponentRef<S>;
|
|
19
|
+
//# sourceMappingURL=ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../src/ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;KAsBK;AAEL,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,oFAAoF;AACpF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,eAAe,IAAI;IACpD,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CACjC,CAAC;AAOF,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;CACvD;AAOD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,EAClD,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,MAAM,GACV,YAAY,CAAC,CAAC,CAAC,CA4BjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Brand } from './type_primitives';
|
|
2
|
+
import { ComponentFields } from './component';
|
|
3
|
+
export type ResourceID = Brand<number, "resource_id">;
|
|
4
|
+
export declare const as_resource_id: (value: number) => ResourceID;
|
|
5
|
+
declare const __resource_schema: unique symbol;
|
|
6
|
+
export type ResourceDef<F extends ComponentFields = ComponentFields> = ResourceID & {
|
|
7
|
+
readonly [__resource_schema]: F;
|
|
8
|
+
};
|
|
9
|
+
export type ResourceReader<F extends ComponentFields> = {
|
|
10
|
+
readonly [K in F[number]]: number;
|
|
11
|
+
};
|
|
12
|
+
export declare class ResourceChannel {
|
|
13
|
+
readonly field_names: string[];
|
|
14
|
+
readonly field_index: Record<string, number>;
|
|
15
|
+
readonly columns: number[][];
|
|
16
|
+
readonly reader: ResourceReader<any>;
|
|
17
|
+
constructor(field_names: string[], initial: Record<string, number>);
|
|
18
|
+
write(values: Record<string, number>): void;
|
|
19
|
+
read_field(field_index: number): number;
|
|
20
|
+
write_field(field_index: number, value: number): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -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/dist/schedule.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export interface SystemEntry {
|
|
|
18
18
|
ordering?: SystemOrdering;
|
|
19
19
|
}
|
|
20
20
|
export declare class Schedule {
|
|
21
|
-
private label_systems;
|
|
22
|
-
private sorted_cache;
|
|
23
|
-
private system_index;
|
|
21
|
+
private readonly label_systems;
|
|
22
|
+
private readonly sorted_cache;
|
|
23
|
+
private readonly system_index;
|
|
24
24
|
private next_insertion_order;
|
|
25
25
|
constructor();
|
|
26
26
|
add_systems(label: SCHEDULE, ...entries: (SystemDescriptor | SystemEntry)[]): void;
|
package/dist/schedule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../src/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAyBK;AAEL,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../src/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAyBK;AAEL,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,oBAAY,QAAQ;IAClB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AAcD,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AASD,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgD;IAC7E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;IAC3E,OAAO,CAAC,oBAAoB,CAAK;;IAY1B,WAAW,CAChB,KAAK,EAAE,QAAQ,EACf,GAAG,OAAO,EAAE,CAAC,gBAAgB,GAAG,WAAW,CAAC,EAAE,GAC7C,IAAI;IA4BA,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IA0B7C,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI;IAMrC,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAMxD,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI5D,iBAAiB,IAAI,OAAO;IAK5B,eAAe,IAAI,gBAAgB,EAAE;IAUrC,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO;IAI7C,KAAK,IAAI,IAAI;IAQpB,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,UAAU;IAWlB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CAyEzB"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import { EntityID } from './entity';
|
|
2
|
-
import { ComponentDef, ComponentFields, FieldValues } from './component';
|
|
2
|
+
import { ComponentDef, ComponentSchema, ComponentFields, FieldValues } from './component';
|
|
3
3
|
import { EventDef, EventReader } from './event';
|
|
4
|
-
import {
|
|
4
|
+
import { ResourceChannel, ResourceDef, ResourceReader } from './resource';
|
|
5
|
+
import { BitSet, TypedArrayTag } from './type_primitives';
|
|
5
6
|
import { Archetype } from './archetype';
|
|
6
7
|
export declare class Store {
|
|
7
|
-
private entity_generations;
|
|
8
|
+
private readonly entity_generations;
|
|
8
9
|
private entity_high_water;
|
|
9
|
-
private entity_free_indices;
|
|
10
|
+
private readonly entity_free_indices;
|
|
10
11
|
private entity_alive_count;
|
|
11
|
-
private component_metas;
|
|
12
|
+
private readonly component_metas;
|
|
12
13
|
private component_count;
|
|
13
|
-
private event_channels;
|
|
14
|
+
private readonly event_channels;
|
|
14
15
|
private event_count;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
16
|
+
private readonly resource_channels;
|
|
17
|
+
private resource_count;
|
|
18
|
+
private readonly archetypes;
|
|
19
|
+
private readonly archetype_map;
|
|
17
20
|
private next_archetype_id;
|
|
18
|
-
private component_index;
|
|
19
|
-
private registered_queries;
|
|
21
|
+
private readonly component_index;
|
|
22
|
+
private readonly registered_queries;
|
|
20
23
|
private empty_archetype_id;
|
|
21
|
-
private entity_archetype;
|
|
22
|
-
private entity_row;
|
|
23
|
-
private pending_destroy;
|
|
24
|
-
private pending_add_ids;
|
|
25
|
-
private pending_add_defs;
|
|
26
|
-
private pending_add_values;
|
|
27
|
-
private pending_remove_ids;
|
|
28
|
-
private pending_remove_defs;
|
|
29
|
-
|
|
24
|
+
private readonly entity_archetype;
|
|
25
|
+
private readonly entity_row;
|
|
26
|
+
private readonly pending_destroy;
|
|
27
|
+
private readonly pending_add_ids;
|
|
28
|
+
private readonly pending_add_defs;
|
|
29
|
+
private readonly pending_add_values;
|
|
30
|
+
private readonly pending_remove_ids;
|
|
31
|
+
private readonly pending_remove_defs;
|
|
32
|
+
private readonly initial_capacity;
|
|
33
|
+
constructor(initial_capacity?: number);
|
|
30
34
|
private arch_get;
|
|
31
35
|
/**
|
|
32
36
|
* Find or create an archetype for the given component mask.
|
|
@@ -48,27 +52,39 @@ export declare class Store {
|
|
|
48
52
|
/** Flush all buffered entity destructions in batch. */
|
|
49
53
|
flush_destroyed(): void;
|
|
50
54
|
get pending_destroy_count(): number;
|
|
51
|
-
add_component_deferred(entity_id: EntityID, def: ComponentDef<
|
|
52
|
-
add_component_deferred<
|
|
53
|
-
remove_component_deferred(entity_id: EntityID, def: ComponentDef
|
|
55
|
+
add_component_deferred(entity_id: EntityID, def: ComponentDef<Record<string, never>>): void;
|
|
56
|
+
add_component_deferred<S extends ComponentSchema>(entity_id: EntityID, def: ComponentDef<S>, values: FieldValues<S>): void;
|
|
57
|
+
remove_component_deferred(entity_id: EntityID, def: ComponentDef): void;
|
|
54
58
|
flush_structural(): void;
|
|
55
59
|
/** Batch-apply all deferred component additions. */
|
|
56
60
|
private _flush_adds;
|
|
57
61
|
/** Batch-apply all deferred component removals. */
|
|
58
62
|
private _flush_removes;
|
|
59
63
|
get pending_structural_count(): number;
|
|
60
|
-
register_component<
|
|
61
|
-
add_component(entity_id: EntityID, def: ComponentDef<
|
|
62
|
-
add_component<
|
|
64
|
+
register_component<S extends Record<string, TypedArrayTag>>(schema: S): ComponentDef<S>;
|
|
65
|
+
add_component(entity_id: EntityID, def: ComponentDef<Record<string, never>>): void;
|
|
66
|
+
add_component<S extends ComponentSchema>(entity_id: EntityID, def: ComponentDef<S>, values: FieldValues<S>): void;
|
|
63
67
|
/** Add multiple components in one transition (resolves final archetype, then moves once). */
|
|
64
68
|
add_components(entity_id: EntityID, entries: {
|
|
65
|
-
def: ComponentDef
|
|
69
|
+
def: ComponentDef;
|
|
66
70
|
values?: Record<string, number>;
|
|
67
71
|
}[]): void;
|
|
68
|
-
remove_component(entity_id: EntityID, def: ComponentDef
|
|
72
|
+
remove_component(entity_id: EntityID, def: ComponentDef): void;
|
|
69
73
|
/** Remove multiple components in one transition (resolves final archetype, then moves once). */
|
|
70
|
-
remove_components(entity_id: EntityID, defs: ComponentDef
|
|
71
|
-
has_component(entity_id: EntityID, def: ComponentDef
|
|
74
|
+
remove_components(entity_id: EntityID, defs: ComponentDef[]): void;
|
|
75
|
+
has_component(entity_id: EntityID, def: ComponentDef): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Bulk add a component to ALL entities in the given archetype.
|
|
78
|
+
* Uses TypedArray.set() for O(columns) instead of O(N×columns).
|
|
79
|
+
* The archetype must not already contain this component.
|
|
80
|
+
*/
|
|
81
|
+
batch_add_component(src_arch: Archetype, def: ComponentDef, values?: Record<string, number>): void;
|
|
82
|
+
/**
|
|
83
|
+
* Bulk remove a component from ALL entities in the given archetype.
|
|
84
|
+
* Uses TypedArray.set() for O(columns) instead of O(N×columns).
|
|
85
|
+
* The archetype must contain this component.
|
|
86
|
+
*/
|
|
87
|
+
batch_remove_component(src_arch: Archetype, def: ComponentDef): void;
|
|
72
88
|
get_entity_archetype(entity_id: EntityID): Archetype;
|
|
73
89
|
get_entity_row(entity_id: EntityID): number;
|
|
74
90
|
/**
|
|
@@ -88,5 +104,8 @@ export declare class Store {
|
|
|
88
104
|
emit_signal(def: EventDef<readonly []>): void;
|
|
89
105
|
get_event_reader<F extends ComponentFields>(def: EventDef<F>): EventReader<F>;
|
|
90
106
|
clear_events(): void;
|
|
107
|
+
register_resource<F extends readonly string[]>(fields: F, initial: Record<string, number>): ResourceDef<F>;
|
|
108
|
+
get_resource_reader<F extends ComponentFields>(def: ResourceDef<F>): ResourceReader<F>;
|
|
109
|
+
get_resource_channel(def: ResourceDef<ComponentFields>): ResourceChannel;
|
|
91
110
|
}
|
|
92
111
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;KAuBK;AAEL,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAe,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|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AAE,WAAW,CAAC,eAAe,CAAC,GAChC,eAAe;CAYnB"}
|
package/dist/system.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Brand } from './type_primitives';
|
|
2
2
|
import { SystemContext } from './query';
|
|
3
|
-
import { Store } from './store';
|
|
4
3
|
export type SystemID = Brand<number, "system_id">;
|
|
5
4
|
export declare const as_system_id: (value: number) => SystemID;
|
|
6
5
|
export type SystemFn = (ctx: SystemContext, delta_time: number) => void;
|
|
7
6
|
export interface SystemConfig {
|
|
8
7
|
fn: SystemFn;
|
|
9
|
-
|
|
8
|
+
name?: string;
|
|
9
|
+
on_added?: (ctx: SystemContext) => void;
|
|
10
10
|
on_removed?: () => void;
|
|
11
11
|
dispose?: () => void;
|
|
12
12
|
}
|
package/dist/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;KAcK;AAEL,OAAO,EACL,KAAK,EAGN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;KAcK;AAEL,OAAO,EACL,KAAK,EAGN,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAElD,eAAO,MAAM,YAAY,UAAW,MAAM,aAKvC,CAAC;AAEJ,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,QAAQ,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,QAAQ,CAAC,YAAY,CAAC;IAC9D,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;CACvB"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
***/
|
|
10
10
|
export declare const is_non_negative_integer: (v: number) => boolean;
|
|
11
|
+
export declare const is_non_null: (v: unknown) => boolean;
|
|
11
12
|
export declare function assert<T, Result extends T = T>(value: T, condition: (v: T) => v is Result, err_message: string): asserts value is Result;
|
|
12
13
|
export declare function validate_and_cast<T, Result extends T = T>(value: T, validator: (v: T) => boolean, err_message: string): Result;
|
|
13
14
|
export declare function unsafe_cast<T>(value: unknown): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/type_primitives/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;KAQK;AAIL,eAAO,MAAM,uBAAuB,MAAO,MAAM,KAAG,OACrB,CAAC;AAEhC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,EAC5C,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,KAAK,IAAI,MAAM,CAOzB;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,EACvD,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAC5B,WAAW,EAAE,MAAM,GAClB,MAAM,CAQR;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAEhD"}
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/type_primitives/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;KAQK;AAIL,eAAO,MAAM,uBAAuB,MAAO,MAAM,KAAG,OACrB,CAAC;AAEhC,eAAO,MAAM,WAAW,MAAO,OAAO,KAAG,OAAqB,CAAC;AAE/D,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,EAC5C,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,KAAK,IAAI,MAAM,CAOzB;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,EACvD,KAAK,EAAE,CAAC,EACR,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAC5B,WAAW,EAAE,MAAM,GAClB,MAAM,CAQR;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAEhD"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* words = ceil(maxComponentId / 32).
|
|
8
8
|
*
|
|
9
9
|
* Bit layout within each 32-bit word:
|
|
10
|
-
* word_index = bit >>>
|
|
11
|
-
* bit_offset = bit &
|
|
10
|
+
* word_index = bit >>> BITS_PER_WORD_SHIFT (divide by 32)
|
|
11
|
+
* bit_offset = bit & BITS_PER_WORD_MASK (mod 32)
|
|
12
12
|
* test: word & (1 << offset)
|
|
13
13
|
* set: word |= (1 << offset)
|
|
14
14
|
* clear: word &= ~(1 << offset)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitset.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/bitset/bitset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;KAeK;
|
|
1
|
+
{"version":3,"file":"bitset.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/bitset/bitset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;KAeK;AAWL,qBAAa,MAAM;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;gBAEZ,KAAK,CAAC,EAAE,MAAM,EAAE;IAIrB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAMzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMtB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM/B,8EAA8E;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAUvC,+EAA+E;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAehC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAa9B,IAAI,IAAI,MAAM;IAId,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAUlC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAS3C,0GAA0G;IACnG,IAAI,IAAI,MAAM;IAarB,0DAA0D;IACnD,QAAQ,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAmBhD,OAAO,CAAC,IAAI;CAOb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparse_map.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/sparse_map/sparse_map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAE/B,
|
|
1
|
+
{"version":3,"file":"sparse_map.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/sparse_map/sparse_map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAE/B,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,IAAI,SAAS,MAAM,EAAE,CAEnC;IAEM,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAUhC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAa5B,KAAK,IAAI,IAAI;IAMb,QAAQ,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI;IAM1D,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CAa3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparse_set.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/sparse_set/sparse_set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAE/B,
|
|
1
|
+
{"version":3,"file":"sparse_set.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/sparse_set/sparse_set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAE/B,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,MAAM,IAAI,SAAS,MAAM,EAAE,CAErC;IAEM,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMtB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAW5B,KAAK,IAAI,IAAI;IAKpB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC;CAGtC"}
|
|
@@ -40,6 +40,15 @@ export declare class GrowableTypedArray<T extends AnyTypedArray> {
|
|
|
40
40
|
*/
|
|
41
41
|
view(): T;
|
|
42
42
|
[Symbol.iterator](): Iterator<number>;
|
|
43
|
+
/** Ensure the backing buffer can hold at least `capacity` elements without growing. */
|
|
44
|
+
ensure_capacity(capacity: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Append `count` elements from `src` starting at `src_offset`.
|
|
47
|
+
* Grows if needed. Equivalent to push() in a loop but uses TypedArray.set().
|
|
48
|
+
*/
|
|
49
|
+
bulk_append(src: T, src_offset: number, count: number): void;
|
|
50
|
+
/** Append `count` zeroes. Grows if needed. */
|
|
51
|
+
bulk_append_zeroes(count: number): void;
|
|
43
52
|
private _grow;
|
|
44
53
|
}
|
|
45
54
|
export declare class GrowableFloat32Array extends GrowableTypedArray<Float32Array> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed_arrays.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/typed_arrays/typed_arrays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;
|
|
1
|
+
{"version":3,"file":"typed_arrays.d.ts","sourceRoot":"","sources":["../../../src/type_primitives/typed_arrays/typed_arrays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAOL,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,YAAY,GACZ,SAA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AQ,kBAAkB,CAAC,SAAS,CAAC;gBACtD,gBAAgB,SAA2B;CAGxD;AAED,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,UAAU,CAAC;gBACxD,gBAAgB,SAA2B;CAGxD;AAED,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,UAAU,CAAC;gBACxD,gBAAgB,SAA2B;CAGxD;AAED,qBAAa,kBAAmB,SAAQ,kBAAkB,CAAC,UAAU,CAAC;gBACxD,gBAAgB,SAA2B;CAGxD;AAED,qBAAa,mBAAoB,SAAQ,kBAAkB,CAAC,WAAW,CAAC;gBAC1D,gBAAgB,SAA2B;CAGxD;AAED,qBAAa,mBAAoB,SAAQ,kBAAkB,CAAC,WAAW,CAAC;gBAC1D,gBAAgB,SAA2B;CAGxD;AAED,eAAO,MAAM,aAAa;;;;;;;;;CAYzB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const UNASSIGNED = -1;
|
|
2
|
+
export declare const NO_SWAP = -1;
|
|
3
|
+
export declare const EMPTY_VALUES: Record<string, number>;
|
|
4
|
+
export declare const BITS_PER_WORD_SHIFT = 5;
|
|
5
|
+
export declare const BITS_PER_WORD_MASK = 31;
|
|
6
|
+
export declare const BITS_PER_WORD = 32;
|
|
7
|
+
export declare const FNV_OFFSET_BASIS = 2166136261;
|
|
8
|
+
export declare const FNV_PRIME = 16777619;
|
|
9
|
+
export declare const HASH_GOLDEN_RATIO = 2654435769;
|
|
10
|
+
export declare const HASH_SECONDARY_PRIME = 1367130551;
|
|
11
|
+
export declare const DEFAULT_INITIAL_CAPACITY = 16;
|
|
12
|
+
export declare const GROWTH_FACTOR = 2;
|
|
13
|
+
export declare const DEFAULT_COLUMN_CAPACITY = 1024;
|
|
14
|
+
export declare const RESOURCE_ROW = 0;
|
|
15
|
+
export declare const INITIAL_GENERATION = 0;
|
|
16
|
+
export declare const TOTAL_PACKED_BITS = 31;
|
|
17
|
+
export declare const DEFAULT_FIXED_TIMESTEP: number;
|
|
18
|
+
export declare const DEFAULT_MAX_FIXED_STEPS = 4;
|
|
19
|
+
export declare const STARTUP_DELTA_TIME = 0;
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,OAAO,KAAK,CAAC;AAC1B,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAsC,CAAC;AAGvF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,aAAa,KAAK,CAAC;AAGhC,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,SAAS,WAAa,CAAC;AAGpC,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAC5C,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAG/C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,aAAa,IAAI,CAAC;AAG/B,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAG5C,eAAO,MAAM,YAAY,IAAI,CAAC;AAG9B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAGpC,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAGzC,eAAO,MAAM,kBAAkB,IAAI,CAAC"}
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/***
|
|
2
|
-
* Error — Base error types and ECS error categories.
|
|
3
|
-
*
|
|
4
|
-
* AppError is the base class for all application errors, carrying an
|
|
5
|
-
* is_operational flag (recoverable vs programmer error) and optional context.
|
|
6
|
-
* ECSError extends it with an ECS_ERROR category enum for structured matching.
|
|
7
|
-
*
|
|
8
|
-
***/
|
|
9
1
|
export declare abstract class AppError extends Error {
|
|
10
2
|
readonly is_operational: boolean;
|
|
11
3
|
readonly context?: Record<string, unknown> | undefined;
|
|
@@ -18,7 +10,8 @@ export declare enum ECS_ERROR {
|
|
|
18
10
|
ENTITY_NOT_ALIVE = "ENTITY_NOT_ALIVE",
|
|
19
11
|
CIRCULAR_SYSTEM_DEPENDENCY = "CIRCULAR_SYSTEM_DEPENDENCY",
|
|
20
12
|
DUPLICATE_SYSTEM = "DUPLICATE_SYSTEM",
|
|
21
|
-
ARCHETYPE_NOT_FOUND = "ARCHETYPE_NOT_FOUND"
|
|
13
|
+
ARCHETYPE_NOT_FOUND = "ARCHETYPE_NOT_FOUND",
|
|
14
|
+
RESOURCE_NOT_REGISTERED = "RESOURCE_NOT_REGISTERED"
|
|
22
15
|
}
|
|
23
16
|
export declare class ECSError extends AppError {
|
|
24
17
|
readonly category: ECS_ERROR;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA,8BAAsB,QAAS,SAAQ,KAAK;aAGxB,cAAc,EAAE,OAAO;aACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjD,OAAO,EAAE,MAAM,EACC,cAAc,EAAE,OAAO,EACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAMpD;AAED,oBAAY,SAAS;IACnB,sBAAsB,2BAA2B;IACjD,oBAAoB,yBAAyB;IAC7C,wBAAwB,6BAA6B;IACrD,gBAAgB,qBAAqB;IACrC,0BAA0B,+BAA+B;IACzD,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,uBAAuB,4BAA4B;CACpD;AAED,qBAAa,QAAS,SAAQ,QAAQ;aAElB,QAAQ,EAAE,SAAS;gBAAnB,QAAQ,EAAE,SAAS,EACnC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAIpC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oasys/oecs",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Archetype-based Entity Component System",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"dev": "vite",
|
|
27
27
|
"build": "vite build",
|
|
28
28
|
"test": "vitest",
|
|
29
|
+
"bench": "vitest bench",
|
|
29
30
|
"prepublishOnly": "pnpm build"
|
|
30
31
|
},
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/oasys-works/oecs.git"
|
|
34
|
+
"url": "git+https://github.com/oasys-works/oecs.git"
|
|
34
35
|
},
|
|
35
36
|
"homepage": "https://github.com/oasys-works/oecs#readme",
|
|
36
37
|
"bugs": {
|
package/dist/world.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { SCHEDULE, SystemEntry } from './schedule';
|
|
2
|
-
import { SystemContext, Query, QueryBuilder, QueryResolver } from './query';
|
|
3
|
-
import { EntityID } from './entity';
|
|
4
|
-
import { ComponentDef, ComponentFields, FieldValues } from './component';
|
|
5
|
-
import { EventDef } from './event';
|
|
6
|
-
import { SystemConfig, SystemDescriptor } from './system';
|
|
7
|
-
import { BitSet } from './type_primitives';
|
|
8
|
-
export interface WorldOptions {
|
|
9
|
-
fixed_timestep?: number;
|
|
10
|
-
max_fixed_steps?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare class World implements QueryResolver {
|
|
13
|
-
private readonly store;
|
|
14
|
-
private readonly schedule;
|
|
15
|
-
private readonly ctx;
|
|
16
|
-
private systems;
|
|
17
|
-
private next_system_id;
|
|
18
|
-
private _fixed_timestep;
|
|
19
|
-
private _accumulator;
|
|
20
|
-
private _max_fixed_steps;
|
|
21
|
-
private query_cache;
|
|
22
|
-
private scratch_mask;
|
|
23
|
-
constructor(options?: WorldOptions);
|
|
24
|
-
get fixed_timestep(): number;
|
|
25
|
-
set fixed_timestep(value: number);
|
|
26
|
-
get fixed_alpha(): number;
|
|
27
|
-
register_component<F extends readonly string[]>(fields: F): ComponentDef<F>;
|
|
28
|
-
register_tag(): ComponentDef<readonly []>;
|
|
29
|
-
register_event<F extends readonly string[]>(fields: F): EventDef<F>;
|
|
30
|
-
register_signal(): EventDef<readonly []>;
|
|
31
|
-
create_entity(): EntityID;
|
|
32
|
-
destroy_entity(id: EntityID): void;
|
|
33
|
-
is_alive(id: EntityID): boolean;
|
|
34
|
-
get entity_count(): number;
|
|
35
|
-
add_component(entity_id: EntityID, def: ComponentDef<readonly []>): void;
|
|
36
|
-
add_component<F extends ComponentFields>(entity_id: EntityID, def: ComponentDef<F>, values: FieldValues<F>): void;
|
|
37
|
-
add_components(entity_id: EntityID, entries: {
|
|
38
|
-
def: ComponentDef<ComponentFields>;
|
|
39
|
-
values?: Record<string, number>;
|
|
40
|
-
}[]): void;
|
|
41
|
-
remove_component(entity_id: EntityID, def: ComponentDef<ComponentFields>): this;
|
|
42
|
-
remove_components(entity_id: EntityID, ...defs: ComponentDef<ComponentFields>[]): void;
|
|
43
|
-
has_component(entity_id: EntityID, def: ComponentDef<ComponentFields>): boolean;
|
|
44
|
-
get_field<F extends ComponentFields>(def: ComponentDef<F>, entity_id: EntityID, field: F[number]): number;
|
|
45
|
-
emit(def: EventDef<readonly []>): void;
|
|
46
|
-
emit<F extends ComponentFields>(def: EventDef<F>, values: FieldValues<F>): void;
|
|
47
|
-
query<T extends ComponentDef<ComponentFields>[]>(...defs: T): Query<T>;
|
|
48
|
-
/** QueryResolver implementation — creates or retrieves a cached Query. */
|
|
49
|
-
_resolve_query(include: BitSet, exclude: BitSet | null, any_of: BitSet | null, defs: readonly ComponentDef<ComponentFields>[]): Query<any>;
|
|
50
|
-
private _find_cached;
|
|
51
|
-
/**
|
|
52
|
-
* Register a system with a typed query.
|
|
53
|
-
*
|
|
54
|
-
* world.register_system(
|
|
55
|
-
* (q, ctx, dt) => q.each((pos, vel, n) => { ... }),
|
|
56
|
-
* (qb) => qb.every(Pos, Vel),
|
|
57
|
-
* );
|
|
58
|
-
*
|
|
59
|
-
* Or with a raw config for systems that don't need a query:
|
|
60
|
-
*
|
|
61
|
-
* world.register_system({ fn(ctx, dt) { ... } });
|
|
62
|
-
*/
|
|
63
|
-
register_system<Defs extends readonly ComponentDef<ComponentFields>[]>(fn: (q: Query<Defs>, ctx: SystemContext, dt: number) => void, query_fn: (qb: QueryBuilder) => Query<Defs>): SystemDescriptor;
|
|
64
|
-
register_system(config: SystemConfig): SystemDescriptor;
|
|
65
|
-
add_systems(label: SCHEDULE, ...entries: (SystemDescriptor | SystemEntry)[]): this;
|
|
66
|
-
remove_system(system: SystemDescriptor): void;
|
|
67
|
-
get system_count(): number;
|
|
68
|
-
startup(): void;
|
|
69
|
-
update(delta_time: number): void;
|
|
70
|
-
flush(): void;
|
|
71
|
-
dispose(): void;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=world.d.ts.map
|
package/dist/world.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CK;AAGL,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,aAAa,EACb,KAAK,EACL,YAAY,EACZ,KAAK,aA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