@inglorious/engine 12.0.0 → 13.0.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "A JavaScript game engine written with global state, immutability, and pure functions in mind. Have fun(ctional programming) with it!",
|
|
5
5
|
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@inglorious/
|
|
35
|
-
"@inglorious/
|
|
34
|
+
"@inglorious/utils": "3.7.0",
|
|
35
|
+
"@inglorious/store": "7.1.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@inglorious/store": "7.
|
|
38
|
+
"@inglorious/store": "7.1.0",
|
|
39
39
|
"@inglorious/utils": "3.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
package/src/core/engine.js
CHANGED
|
@@ -65,10 +65,17 @@ export class Engine {
|
|
|
65
65
|
)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
this._store = createStore({
|
|
68
|
+
this._store = createStore({
|
|
69
|
+
...this._config,
|
|
70
|
+
middlewares,
|
|
71
|
+
updateMode: "manual",
|
|
72
|
+
})
|
|
69
73
|
this._loop = new Loop[this._config.loop.type]()
|
|
70
74
|
|
|
71
|
-
this._devtools = createDevtools({
|
|
75
|
+
this._devtools = createDevtools({
|
|
76
|
+
blacklist: coreEvents,
|
|
77
|
+
updateMode: "manual",
|
|
78
|
+
})
|
|
72
79
|
if (this._devMode) {
|
|
73
80
|
this._devtools.connect(this._store)
|
|
74
81
|
}
|
|
@@ -6,7 +6,6 @@ import { EntityPools } from "./entity-pools"
|
|
|
6
6
|
export function entityPoolMiddleware() {
|
|
7
7
|
return (store) => {
|
|
8
8
|
const pools = new EntityPools()
|
|
9
|
-
const types = store.getTypes()
|
|
10
9
|
const eventMap = new EventMap()
|
|
11
10
|
|
|
12
11
|
store.extras ??= {}
|
|
@@ -23,14 +22,14 @@ export function entityPoolMiddleware() {
|
|
|
23
22
|
switch (event.type) {
|
|
24
23
|
case "spawn": {
|
|
25
24
|
const entity = pools.acquire(event.payload)
|
|
26
|
-
const type =
|
|
25
|
+
const type = store.getType(entity.type)
|
|
27
26
|
eventMap.addEntity(entity.id, type)
|
|
28
27
|
break
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
case "despawn": {
|
|
32
31
|
const entity = pools.recycle(event.payload)
|
|
33
|
-
const type =
|
|
32
|
+
const type = store.getType(entity.type)
|
|
34
33
|
eventMap.removeEntity(entity.id, type)
|
|
35
34
|
break
|
|
36
35
|
}
|
|
@@ -39,7 +38,7 @@ export function entityPoolMiddleware() {
|
|
|
39
38
|
const entityIds = eventMap.getEntitiesForEvent(event.type)
|
|
40
39
|
for (const id of entityIds) {
|
|
41
40
|
const entity = pools.activeEntitiesById.get(id)
|
|
42
|
-
const type =
|
|
41
|
+
const type = store.getType(entity.type)
|
|
43
42
|
const handle = type[event.type]
|
|
44
43
|
handle?.(entity, event.payload, api)
|
|
45
44
|
}
|