@thi.ng/ecs 0.7.191 → 0.7.193
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 +1 -1
- package/ecs.js +4 -4
- package/groups/group.js +4 -4
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 211 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/ecs.js
CHANGED
|
@@ -42,13 +42,13 @@ let ECS = class {
|
|
|
42
42
|
if (comps) {
|
|
43
43
|
if (isArray(comps)) {
|
|
44
44
|
if (!comps.length) return id;
|
|
45
|
-
for (
|
|
45
|
+
for (const cid of comps) {
|
|
46
46
|
const comp = isString(cid) ? this.components.get(cid) : cid;
|
|
47
47
|
assert(!!comp, `unknown component ID: ${cid}`);
|
|
48
48
|
comp.add(id);
|
|
49
49
|
}
|
|
50
50
|
} else {
|
|
51
|
-
for (
|
|
51
|
+
for (const cid in comps) {
|
|
52
52
|
const comp = this.components.get(cid);
|
|
53
53
|
assert(!!comp, `unknown component ID: ${cid}`);
|
|
54
54
|
comp.add(id, comps[cid]);
|
|
@@ -91,7 +91,7 @@ let ECS = class {
|
|
|
91
91
|
deleteID(id) {
|
|
92
92
|
if (this.idgen.free(id)) {
|
|
93
93
|
this.notify({ id: EVENT_PRE_DELETE, target: this, value: id });
|
|
94
|
-
for (
|
|
94
|
+
for (const c of this.componentsForID(id)) {
|
|
95
95
|
c.delete(id);
|
|
96
96
|
}
|
|
97
97
|
return true;
|
|
@@ -107,7 +107,7 @@ let ECS = class {
|
|
|
107
107
|
setCapacity(newCap) {
|
|
108
108
|
this.idgen.capacity = newCap;
|
|
109
109
|
const pool = this.pool;
|
|
110
|
-
for (
|
|
110
|
+
for (const comp of this.components.values()) {
|
|
111
111
|
comp.resize(pool, newCap);
|
|
112
112
|
}
|
|
113
113
|
}
|
package/groups/group.js
CHANGED
|
@@ -89,7 +89,7 @@ class Group {
|
|
|
89
89
|
}
|
|
90
90
|
forEach(fn, ...args) {
|
|
91
91
|
let i = 0;
|
|
92
|
-
for (
|
|
92
|
+
for (const id of this.ids) {
|
|
93
93
|
fn(this.getEntityUnsafe(id), i++, ...args);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -97,7 +97,7 @@ class Group {
|
|
|
97
97
|
return this.owned.length === this.components.length;
|
|
98
98
|
}
|
|
99
99
|
isValidID(id) {
|
|
100
|
-
for (
|
|
100
|
+
for (const comp of this.components) {
|
|
101
101
|
if (!comp.has(id)) return false;
|
|
102
102
|
}
|
|
103
103
|
return true;
|
|
@@ -122,7 +122,7 @@ class Group {
|
|
|
122
122
|
intersectionR(),
|
|
123
123
|
this.components
|
|
124
124
|
);
|
|
125
|
-
for (
|
|
125
|
+
for (const id of existing) {
|
|
126
126
|
this.addID(id, false);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -158,7 +158,7 @@ class Group {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
*nonOwnedValues() {
|
|
161
|
-
for (
|
|
161
|
+
for (const id of this.ids) {
|
|
162
162
|
yield this.getEntityUnsafe(id);
|
|
163
163
|
}
|
|
164
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/ecs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.193",
|
|
4
4
|
"description": "Entity Component System based around typed arrays & sparse sets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/associative": "^7.1.
|
|
44
|
-
"@thi.ng/binary": "^3.4.
|
|
45
|
-
"@thi.ng/checks": "^3.
|
|
46
|
-
"@thi.ng/dcons": "^3.2.
|
|
47
|
-
"@thi.ng/errors": "^2.5.
|
|
48
|
-
"@thi.ng/idgen": "^2.2.
|
|
49
|
-
"@thi.ng/logger": "^3.2.
|
|
50
|
-
"@thi.ng/malloc": "^6.1.
|
|
51
|
-
"@thi.ng/transducers": "^9.6.
|
|
42
|
+
"@thi.ng/api": "^8.12.10",
|
|
43
|
+
"@thi.ng/associative": "^7.1.21",
|
|
44
|
+
"@thi.ng/binary": "^3.4.68",
|
|
45
|
+
"@thi.ng/checks": "^3.8.0",
|
|
46
|
+
"@thi.ng/dcons": "^3.2.178",
|
|
47
|
+
"@thi.ng/errors": "^2.5.50",
|
|
48
|
+
"@thi.ng/idgen": "^2.2.84",
|
|
49
|
+
"@thi.ng/logger": "^3.2.9",
|
|
50
|
+
"@thi.ng/malloc": "^6.1.131",
|
|
51
|
+
"@thi.ng/transducers": "^9.6.19"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@thi.ng/equiv": "^2.1.
|
|
54
|
+
"@thi.ng/equiv": "^2.1.100",
|
|
55
55
|
"esbuild": "^0.27.0",
|
|
56
56
|
"typedoc": "^0.28.14",
|
|
57
57
|
"typescript": "^5.9.3"
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"status": "alpha",
|
|
125
125
|
"year": 2019
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
|
|
128
128
|
}
|