@inglorious/engine 13.0.3 → 14.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 +4 -4
- package/src/behaviors/camera.js +1 -3
- package/src/behaviors/controls/dynamic/modern.js +2 -4
- package/src/behaviors/controls/dynamic/shooter.js +2 -4
- package/src/behaviors/controls/dynamic/tank.js +2 -4
- package/src/behaviors/controls/kinematic/modern.js +2 -4
- package/src/behaviors/controls/kinematic/shooter.js +2 -4
- package/src/behaviors/controls/kinematic/tank.js +2 -4
- package/src/behaviors/fps.js +1 -3
- package/src/behaviors/fsm.js +2 -4
- package/src/behaviors/input/gamepad.js +1 -3
- package/src/behaviors/input/keyboard.js +1 -3
- package/src/behaviors/input/mouse.js +1 -3
- package/src/behaviors/physics/bouncy.js +2 -4
- package/src/behaviors/physics/clamped.js +2 -4
- package/src/behaviors/physics/jumpable.js +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.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": "8.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@inglorious/store": "
|
|
38
|
+
"@inglorious/store": "8.0.0",
|
|
39
39
|
"@inglorious/utils": "3.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
package/src/behaviors/camera.js
CHANGED
|
@@ -22,9 +22,7 @@ export function camera(params) {
|
|
|
22
22
|
params = extend(DEFAULT_PARAMS, params)
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
|
-
create(entity
|
|
26
|
-
if (entityId !== entity.id) return
|
|
27
|
-
|
|
25
|
+
create(entity) {
|
|
28
26
|
defaults(entity, params)
|
|
29
27
|
entity.targetZoom = entity.zoom
|
|
30
28
|
// Cache the initial size to calculate the viewport in dev mode
|
|
@@ -23,10 +23,8 @@ export function modernAcceleration(params) {
|
|
|
23
23
|
"moveUpDown",
|
|
24
24
|
]),
|
|
25
25
|
|
|
26
|
-
create(entity,
|
|
27
|
-
type.create?.(entity,
|
|
28
|
-
|
|
29
|
-
if (entityId !== entity.id) return
|
|
26
|
+
create(entity, payload, api) {
|
|
27
|
+
type.create?.(entity, payload, api)
|
|
30
28
|
|
|
31
29
|
entity.maxAcceleration ??= params.maxAcceleration
|
|
32
30
|
entity.movement ??= {}
|
|
@@ -32,10 +32,8 @@ export function shooterControls(params) {
|
|
|
32
32
|
"turn",
|
|
33
33
|
]),
|
|
34
34
|
|
|
35
|
-
create(entity,
|
|
36
|
-
type.create?.(entity,
|
|
37
|
-
|
|
38
|
-
if (entityId !== entity.id) return
|
|
35
|
+
create(entity, payload, api) {
|
|
36
|
+
type.create?.(entity, payload, api)
|
|
39
37
|
|
|
40
38
|
entity.maxSpeed ??= params.maxSpeed
|
|
41
39
|
entity.maxAngularSpeed ??= params.maxAngularSpeed
|
|
@@ -26,10 +26,8 @@ export function tankControls(params) {
|
|
|
26
26
|
"turn",
|
|
27
27
|
]),
|
|
28
28
|
|
|
29
|
-
create(entity,
|
|
30
|
-
type.create?.(entity,
|
|
31
|
-
|
|
32
|
-
if (entityId !== entity.id) return
|
|
29
|
+
create(entity, payload, api) {
|
|
30
|
+
type.create?.(entity, payload, api)
|
|
33
31
|
|
|
34
32
|
entity.maxSpeed ??= params.maxSpeed
|
|
35
33
|
entity.maxAngularSpeed ??= params.maxAngularSpeed
|
|
@@ -23,10 +23,8 @@ export function modernVelocity(params) {
|
|
|
23
23
|
"moveUpDown",
|
|
24
24
|
]),
|
|
25
25
|
|
|
26
|
-
create(entity,
|
|
27
|
-
type.create?.(entity,
|
|
28
|
-
|
|
29
|
-
if (entityId !== entity.id) return
|
|
26
|
+
create(entity, payload, api) {
|
|
27
|
+
type.create?.(entity, payload, api)
|
|
30
28
|
|
|
31
29
|
entity.maxSpeed ??= params.maxSpeed
|
|
32
30
|
entity.movement ??= {}
|
|
@@ -31,10 +31,8 @@ export function shooterControls(params) {
|
|
|
31
31
|
"turn",
|
|
32
32
|
]),
|
|
33
33
|
|
|
34
|
-
create(entity,
|
|
35
|
-
type.create?.(entity,
|
|
36
|
-
|
|
37
|
-
if (entityId !== entity.id) return
|
|
34
|
+
create(entity, payload, api) {
|
|
35
|
+
type.create?.(entity, payload, api)
|
|
38
36
|
|
|
39
37
|
entity.maxSpeed ??= params.maxSpeed
|
|
40
38
|
entity.maxAngularSpeed ??= params.maxAngularSpeed
|
|
@@ -25,10 +25,8 @@ export function tankControls(params) {
|
|
|
25
25
|
"turn",
|
|
26
26
|
]),
|
|
27
27
|
|
|
28
|
-
create(entity,
|
|
29
|
-
type.create?.(entity,
|
|
30
|
-
|
|
31
|
-
if (entityId !== entity.id) return
|
|
28
|
+
create(entity, payload, api) {
|
|
29
|
+
type.create?.(entity, payload, api)
|
|
32
30
|
|
|
33
31
|
entity.maxSpeed ??= params.maxSpeed
|
|
34
32
|
entity.maxAngularSpeed ??= params.maxAngularSpeed
|
package/src/behaviors/fps.js
CHANGED
package/src/behaviors/fsm.js
CHANGED
|
@@ -7,10 +7,8 @@ export function fsm(states) {
|
|
|
7
7
|
|
|
8
8
|
return (type) => {
|
|
9
9
|
return {
|
|
10
|
-
create(entity,
|
|
11
|
-
type.create?.(entity,
|
|
12
|
-
|
|
13
|
-
if (entityId !== entity.id) return
|
|
10
|
+
create(entity, payload, api) {
|
|
11
|
+
type.create?.(entity, payload, api)
|
|
14
12
|
|
|
15
13
|
entity.state ??= DEFAULT_STATE
|
|
16
14
|
},
|
|
@@ -3,9 +3,7 @@ export function keyboard() {
|
|
|
3
3
|
let currentDocument = null
|
|
4
4
|
|
|
5
5
|
return {
|
|
6
|
-
create(entity,
|
|
7
|
-
if (entityId !== entity.id) return
|
|
8
|
-
|
|
6
|
+
create(entity, payload, api) {
|
|
9
7
|
currentDocument = document.body.ownerDocument || document
|
|
10
8
|
|
|
11
9
|
handleKeyDown = createKeyboardHandler("keyboardKeyDown", api)
|
|
@@ -4,9 +4,7 @@ import { zero } from "@inglorious/utils/math/vector.js"
|
|
|
4
4
|
|
|
5
5
|
export function mouse() {
|
|
6
6
|
return {
|
|
7
|
-
create(entity
|
|
8
|
-
if (entityId !== entity.id) return
|
|
9
|
-
|
|
7
|
+
create(entity) {
|
|
10
8
|
entity.collisions ??= {}
|
|
11
9
|
entity.collisions.bounds ??= { shape: "point" }
|
|
12
10
|
},
|
|
@@ -9,10 +9,8 @@ export function bouncy(params) {
|
|
|
9
9
|
params = extend(DEFAULT_PARAMS, params)
|
|
10
10
|
|
|
11
11
|
return (type) => ({
|
|
12
|
-
create(entity,
|
|
13
|
-
type.create?.(entity,
|
|
14
|
-
|
|
15
|
-
if (entityId !== entity.id) return
|
|
12
|
+
create(entity, payload, api) {
|
|
13
|
+
type.create?.(entity, payload, api)
|
|
16
14
|
|
|
17
15
|
defaults(entity, params)
|
|
18
16
|
},
|
|
@@ -10,10 +10,8 @@ export function clamped(params) {
|
|
|
10
10
|
params = extend(DEFAULT_PARAMS, params)
|
|
11
11
|
|
|
12
12
|
return (type) => ({
|
|
13
|
-
create(entity,
|
|
14
|
-
type.create?.(entity,
|
|
15
|
-
|
|
16
|
-
if (entityId !== entity.id) return
|
|
13
|
+
create(entity, payload, api) {
|
|
14
|
+
type.create?.(entity, payload, api)
|
|
17
15
|
|
|
18
16
|
entity.collisions ??= {}
|
|
19
17
|
entity.collisions[params.collisionGroup] ??= {}
|
|
@@ -22,10 +22,8 @@ export function jumpable(params) {
|
|
|
22
22
|
params = extend(DEFAULT_PARAMS, params)
|
|
23
23
|
|
|
24
24
|
return (type) => ({
|
|
25
|
-
create(entity,
|
|
26
|
-
type.create?.(entity,
|
|
27
|
-
|
|
28
|
-
if (entityId !== entity.id) return
|
|
25
|
+
create(entity, payload, api) {
|
|
26
|
+
type.create?.(entity, payload, api)
|
|
29
27
|
|
|
30
28
|
defaults(entity, params)
|
|
31
29
|
entity.jumpsLeft ??= entity.maxJumps
|