@woosh/meep-engine 2.52.0 → 2.54.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/editor/actions/concrete/WriteGridValueAction.js +1 -1
- package/editor/ecs/component/prototypeObjectEditor.js +1 -1
- package/editor/process/ObstacleGridDisplayProcess.js +2 -2
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
- package/editor/tools/GridPaintTool.js +2 -2
- package/package.json +4 -3
- package/samples/generation/SampleGenerator0.js +1 -1
- package/samples/generation/generators/interactive/mir_generator_place_buff_objects.js +1 -1
- package/samples/generation/generators/mir_generator_place_bases.js +1 -1
- package/samples/generation/generators/mir_generator_place_road_decorators.js +1 -1
- package/samples/generation/generators/mir_generator_place_starting_point.js +1 -1
- package/samples/generation/main.js +2 -2
- package/samples/generation/rules/matcher_play_area.js +1 -1
- package/samples/generation/rules/matcher_tag_occupied.js +1 -1
- package/samples/generation/rules/matcher_tag_traversable.js +1 -1
- package/samples/generation/themes/SampleTheme0.js +5 -5
- package/src/core/collection/table/RowFirstTableSpec.js +8 -4
- package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.spec.js +10 -0
- package/src/engine/Engine.spec.js +4 -0
- package/src/engine/EngineConfiguration.js +24 -25
- package/src/engine/ecs/EntityBlueprint.js +2 -4
- package/src/engine/ecs/EntityComponentDataset.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.spec.js +77 -0
- package/src/engine/ecs/EntityObserver.spec.js +1 -1
- package/src/engine/ecs/dynamic_actions/actions/definition/{WhiteToBlackboardActionDescription.js → WriteToBlackboardActionDescription.js} +2 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/deserializeActionFromJSON.js +2 -2
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +21 -0
- package/src/engine/ecs/parent/EntityNode.js +1 -1
- package/src/engine/ecs/parent/EntityNode.spec.js +104 -0
- package/src/engine/ecs/speaker/Voice.js +4 -0
- package/src/engine/ecs/team/Team.js +0 -44
- package/src/engine/ecs/team/TeamSerializationAdapter.js +46 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.spec.js +6 -0
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +79 -76
- package/src/engine/ecs/terrain/tiles/TerrainTile.spec.js +25 -0
- package/src/engine/ecs/transform/Transform.js +1 -1
- package/src/engine/ecs/transform/Transform.spec.js +24 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -2
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +2 -2
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -2
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/src/engine/graphics/texture/TextureBackedMemoryRegion.js +4 -1
- package/src/engine/graphics/texture/sampler/filter/filter_lanczos3.js +7 -2
- package/src/engine/grid/{components → grid2transform}/GridPosition2Transform.js +0 -41
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationUpgrader_0_1.js +40 -0
- package/src/engine/grid/{systems → grid2transform}/GridPosition2TransformSystem.js +3 -3
- package/src/engine/grid/{components → position}/GridPosition.js +4 -0
- package/src/engine/grid/{systems → position}/GridPositionSystem.js +1 -1
- package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
- package/src/engine/input/devices/PointerDevice.spec.js +5 -0
- package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +5 -1
- package/src/engine/navigation/ecs/path_following/PathFollower.js +40 -32
- package/src/engine/navigation/ecs/path_following/PathFollower.spec.js +27 -0
- package/src/engine/platform/EnginePlatform.js +0 -4
- package/src/generation/filtering/CellFilter.js +6 -9
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +1 -4
- package/src/generation/filtering/core/CellFilterBinaryOperation.js +12 -15
- package/src/generation/filtering/core/CellFilterOperationTertiary.js +15 -19
- package/src/generation/filtering/numeric/CellFilterLiteralFloat.js +6 -9
- package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.js +1 -1
- package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.js +2 -2
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
- package/src/engine/InputEngine.js +0 -94
- package/src/engine/PointerLock.js +0 -60
- package/src/engine/ecs/terrain/ecs/layers/loadLegacyTerrainLayers.js +0 -99
- package/src/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +0 -73
- package/src/engine/graphics/texture/ExportCanvasAsPNG.js +0 -7
- package/src/engine/navigation/PathFinder.js +0 -172
- package/src/engine/navigation/PathWorker.js +0 -78
- package/src/engine/navigation/ecs/systems/PathFinderSystem.js +0 -63
- package/src/engine/navigation/ecs/systems/PathSystem.js +0 -19
- package/src/engine/navigation/funnel/Funnel.js +0 -196
- package/src/generation/ZoneNode.js +0 -9
- /package/{src/generation → samples/generation/grid}/GridTags.js +0 -0
- /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformFlags.js +0 -0
- /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacle.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacle.spec.js +0 -0
- /package/src/engine/grid/{components → obstacle}/GridObstacleSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → position}/GridPositionSerializationAdapter.js +0 -0
- /package/src/engine/grid/{components → position}/GridPositionSerializationUpdater_0_1.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import GridObstacle from "../../../src/engine/grid/
|
|
1
|
+
import GridObstacle from "../../../src/engine/grid/obstacle/GridObstacle.js";
|
|
2
2
|
import { Action } from "../../../src/core/process/undo/Action.js";
|
|
3
3
|
|
|
4
4
|
class WriteGridValueAction extends Action {
|
|
@@ -47,7 +47,7 @@ import { ParticleEmitterEditor } from "./editors/ecs/ParticleEmitterEditor.js";
|
|
|
47
47
|
import Vector4 from "../../../src/core/geom/Vector4.js";
|
|
48
48
|
import { Vector4Editor } from "./editors/geom/Vector4Editor.js";
|
|
49
49
|
import { Trail2DEditor } from "./editors/ecs/Trail2DEditor.js";
|
|
50
|
-
import GridObstacle from "../../../src/engine/grid/
|
|
50
|
+
import GridObstacle from "../../../src/engine/grid/obstacle/GridObstacle.js";
|
|
51
51
|
import { Vector2Editor } from "./editors/geom/Vector2Editor.js";
|
|
52
52
|
import Vector2 from "../../../src/core/geom/Vector2.js";
|
|
53
53
|
import { randomIntegerBetween } from "../../../src/core/math/random/randomIntegerBetween.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorProcess } from "./EditorProcess.js";
|
|
2
|
-
import GridObstacle from "../../src/engine/grid/
|
|
3
|
-
import GridPosition from "../../src/engine/grid/
|
|
2
|
+
import GridObstacle from "../../src/engine/grid/obstacle/GridObstacle.js";
|
|
3
|
+
import GridPosition from "../../src/engine/grid/position/GridPosition.js";
|
|
4
4
|
import { Sampler2D } from "../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
5
5
|
import { obtainTerrain } from "../../src/engine/ecs/terrain/util/obtainTerrain.js";
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ import { Transform } from "../../../src/engine/ecs/transform/Transform.js";
|
|
|
11
11
|
import EditorEntity from "../../ecs/EditorEntity.js";
|
|
12
12
|
import { EventType } from "../../../src/engine/ecs/EntityManager.js";
|
|
13
13
|
import { make3DSymbolicDisplay } from "./make3DSymbolicDisplay.js";
|
|
14
|
-
import GridPosition from "../../../src/engine/grid/
|
|
14
|
+
import GridPosition from "../../../src/engine/grid/position/GridPosition.js";
|
|
15
15
|
import { ProcessState } from "../../../src/core/process/ProcessState.js";
|
|
16
16
|
import { obtainTerrain } from "../../../src/engine/ecs/terrain/util/obtainTerrain.js";
|
|
17
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Tool from "./engine/Tool.js";
|
|
2
|
-
import GridPosition from "../../src/engine/grid/
|
|
3
|
-
import GridObstacle from "../../src/engine/grid/
|
|
2
|
+
import GridPosition from "../../src/engine/grid/position/GridPosition.js";
|
|
3
|
+
import GridObstacle from "../../src/engine/grid/obstacle/GridObstacle.js";
|
|
4
4
|
import Vector4 from "../../src/core/geom/Vector4.js";
|
|
5
5
|
import ObservedValue from "../../src/core/model/ObservedValue.js";
|
|
6
6
|
import Vector1 from "../../src/core/geom/Vector1.js";
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.54.0",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -52,8 +52,9 @@
|
|
|
52
52
|
"@rollup/plugin-terser": "0.4.0",
|
|
53
53
|
"@rollup/plugin-strip": "3.0.2",
|
|
54
54
|
"@types/three": "^0.135.0",
|
|
55
|
-
"babel-jest": "
|
|
56
|
-
"jest": "
|
|
55
|
+
"babel-jest": "29.5.0",
|
|
56
|
+
"jest": "29.5.0",
|
|
57
|
+
"jest-environment-jsdom": "29.5.0",
|
|
57
58
|
"rollup": "3.16.0"
|
|
58
59
|
},
|
|
59
60
|
"keywords": [
|
|
@@ -2,7 +2,7 @@ import { GridTaskGroup } from "../../src/generation/GridTaskGroup.js";
|
|
|
2
2
|
import { GridCellPlacementRule } from "../../src/generation/placement/GridCellPlacementRule.js";
|
|
3
3
|
import { CellMatcherGridPattern } from "../../src/generation/rules/cell/CellMatcherGridPattern.js";
|
|
4
4
|
import { CellMatcherLayerBitMaskTest } from "../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
5
|
-
import { GridTags } from "
|
|
5
|
+
import { GridTags } from "./grid/GridTags.js";
|
|
6
6
|
import { CellMatcherNot } from "../../src/generation/rules/logic/CellMatcherNot.js";
|
|
7
7
|
import { GridCellActionPlaceMarker } from "../../src/generation/markers/GridCellActionPlaceMarker.js";
|
|
8
8
|
import { GridTaskCellularAutomata } from "../../src/generation/grid/generation/discrete/GridTaskCellularAutomata.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
CellMatcherContainsMarkerWithinRadius
|
|
6
6
|
} from "../../../../src/generation/rules/cell/CellMatcherContainsMarkerWithinRadius.js";
|
|
7
7
|
import { GridCellActionPlaceTags } from "../../../../src/generation/placement/action/GridCellActionPlaceTags.js";
|
|
8
|
-
import { GridTags } from "
|
|
8
|
+
import { GridTags } from "../../grid/GridTags.js";
|
|
9
9
|
import { bitwiseAnd } from "../../../../src/core/binary/operations/bitwiseAnd.js";
|
|
10
10
|
import { GridCellActionPlaceMarker } from "../../../../src/generation/markers/GridCellActionPlaceMarker.js";
|
|
11
11
|
import { GridCellPlacementRule } from "../../../../src/generation/placement/GridCellPlacementRule.js";
|
|
@@ -3,7 +3,7 @@ import { GridCellPlacementRule } from "../../../src/generation/placement/GridCel
|
|
|
3
3
|
import { CellMatcherGridPattern } from "../../../src/generation/rules/cell/CellMatcherGridPattern.js";
|
|
4
4
|
import { GridActionRuleSet } from "../../../src/generation/markers/GridActionRuleSet.js";
|
|
5
5
|
import { GridCellActionPlaceTags } from "../../../src/generation/placement/action/GridCellActionPlaceTags.js";
|
|
6
|
-
import { GridTags } from "
|
|
6
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
7
7
|
import { GridCellActionPlaceMarker } from "../../../src/generation/markers/GridCellActionPlaceMarker.js";
|
|
8
8
|
import { CellMatcherNot } from "../../../src/generation/rules/logic/CellMatcherNot.js";
|
|
9
9
|
import {
|
|
@@ -3,7 +3,7 @@ import { GridActionRuleSet } from "../../../src/generation/markers/GridActionRul
|
|
|
3
3
|
import { GridCellPlacementRule } from "../../../src/generation/placement/GridCellPlacementRule.js";
|
|
4
4
|
import { CellMatcherGridPattern } from "../../../src/generation/rules/cell/CellMatcherGridPattern.js";
|
|
5
5
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
6
|
-
import { GridTags } from "
|
|
6
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
7
7
|
import { CellMatcherAnd } from "../../../src/generation/rules/logic/CellMatcherAnd.js";
|
|
8
8
|
import { CellMatcherNot } from "../../../src/generation/rules/logic/CellMatcherNot.js";
|
|
9
9
|
import { GridCellActionPlaceMarker } from "../../../src/generation/markers/GridCellActionPlaceMarker.js";
|
|
@@ -2,7 +2,7 @@ import { GridCellPlacementRule } from "../../../src/generation/placement/GridCel
|
|
|
2
2
|
import { matcher_tag_traversable_unoccupied } from "../rules/matcher_tag_traversable_unoccupied.js";
|
|
3
3
|
import { CellMatcherNot } from "../../../src/generation/rules/logic/CellMatcherNot.js";
|
|
4
4
|
import { GridCellActionPlaceTags } from "../../../src/generation/placement/action/GridCellActionPlaceTags.js";
|
|
5
|
-
import { GridTags } from "
|
|
5
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
6
6
|
import { GridCellActionPlaceMarker } from "../../../src/generation/markers/GridCellActionPlaceMarker.js";
|
|
7
7
|
import { GridTaskExecuteRuleTimes } from "../../../src/generation/grid/generation/GridTaskExecuteRuleTimes.js";
|
|
8
8
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
@@ -7,9 +7,9 @@ import { TopDownCameraLander } from "../../src/engine/graphics/ecs/camera/topdow
|
|
|
7
7
|
import Terrain from "../../src/engine/ecs/terrain/ecs/Terrain.js";
|
|
8
8
|
import { TerrainFlags } from "../../src/engine/ecs/terrain/ecs/TerrainFlags.js";
|
|
9
9
|
import Water from "../../src/engine/graphics/ecs/water/Water.js";
|
|
10
|
-
import GridObstacle from "../../src/engine/grid/
|
|
10
|
+
import GridObstacle from "../../src/engine/grid/obstacle/GridObstacle.js";
|
|
11
11
|
import EntityBuilder from "../../src/engine/ecs/EntityBuilder.js";
|
|
12
|
-
import GridPosition from "../../src/engine/grid/
|
|
12
|
+
import GridPosition from "../../src/engine/grid/position/GridPosition.js";
|
|
13
13
|
import { Transform } from "../../src/engine/ecs/transform/Transform.js";
|
|
14
14
|
import { GridData } from "../../src/generation/grid/GridData.js";
|
|
15
15
|
import { computeStringHash } from "../../src/core/primitives/strings/computeStringHash.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
2
|
-
import { GridTags } from "
|
|
2
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
3
3
|
import { MirGridLayers } from "../grid/MirGridLayers.js";
|
|
4
4
|
|
|
5
5
|
export const matcher_play_area = CellMatcherLayerBitMaskTest.from(GridTags.PlayArea, MirGridLayers.Tags);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
2
|
-
import { GridTags } from "
|
|
2
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
3
3
|
import { MirGridLayers } from "../grid/MirGridLayers.js";
|
|
4
4
|
|
|
5
5
|
export const matcher_tag_occupied = CellMatcherLayerBitMaskTest.from(GridTags.Occupied, MirGridLayers.Tags);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
2
|
-
import { GridTags } from "
|
|
2
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
3
3
|
import { MirGridLayers } from "../grid/MirGridLayers.js";
|
|
4
4
|
|
|
5
5
|
export const matcher_tag_traversable = CellMatcherLayerBitMaskTest.from(GridTags.Traversable, MirGridLayers.Tags);
|
|
@@ -6,13 +6,13 @@ import { MarkerNodeMatcherByType } from "../../../src/generation/markers/matcher
|
|
|
6
6
|
import {
|
|
7
7
|
MarkerNodeActionEntityPlacement
|
|
8
8
|
} from "../../../src/generation/markers/actions/MarkerNodeActionEntityPlacement.js";
|
|
9
|
-
import { EntityBlueprint } from "../../../src/engine/ecs/
|
|
10
|
-
import Mesh from "../../../src/engine/graphics/ecs/mesh/
|
|
11
|
-
import { Transform } from "../../../src/engine/ecs/transform/
|
|
12
|
-
import GridPosition from "../../../src/engine/grid/
|
|
9
|
+
import { EntityBlueprint } from "../../../src/engine/ecs/EntityBlueprint.js";
|
|
10
|
+
import Mesh from "../../../src/engine/graphics/ecs/mesh/Mesh.js";
|
|
11
|
+
import { Transform } from "../../../src/engine/ecs/transform/Transform.js";
|
|
12
|
+
import GridPosition from "../../../src/engine/grid/position/GridPosition.js";
|
|
13
13
|
import { matcher_tag_not_traversable } from "../rules/matcher_tag_not_traversable.js";
|
|
14
14
|
import { CellMatcherLayerBitMaskTest } from "../../../src/generation/rules/CellMatcherLayerBitMaskTest.js";
|
|
15
|
-
import { GridTags } from "
|
|
15
|
+
import { GridTags } from "../grid/GridTags.js";
|
|
16
16
|
import { CellFilterCellMatcher } from "../../../src/generation/filtering/CellFilterCellMatcher.js";
|
|
17
17
|
import { CellFilterSimplexNoise } from "../../../src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js";
|
|
18
18
|
import { CellFilterFXAA } from "../../../src/generation/filtering/numeric/complex/CellFilterFXAA.js";
|
|
@@ -88,7 +88,7 @@ function genRowReader(types, endianType = EndianType.BigEndian) {
|
|
|
88
88
|
*
|
|
89
89
|
* @param {BinaryDataType[]} types
|
|
90
90
|
* @param {EndianType} [endianType]
|
|
91
|
-
* @returns {(data_view:DataView, byte_offset:number, record:number[])
|
|
91
|
+
* @returns {function(data_view:DataView, byte_offset:number, record:number[]):void}
|
|
92
92
|
*/
|
|
93
93
|
function genRowWriter(types, endianType = EndianType.BigEndian) {
|
|
94
94
|
let offset = 0;
|
|
@@ -122,7 +122,7 @@ function genRowWriter(types, endianType = EndianType.BigEndian) {
|
|
|
122
122
|
* @param {BinaryDataType} type
|
|
123
123
|
* @param {number} offset
|
|
124
124
|
* @param {EndianType} [endianType]
|
|
125
|
-
* @returns {
|
|
125
|
+
* @returns {function(data_view:DataView, byte_offset:number, value:number):void}
|
|
126
126
|
*/
|
|
127
127
|
function genCellWriter(type, offset, endianType = EndianType.BigEndian) {
|
|
128
128
|
const writeMethod = DataType2DataViewWriters[type];
|
|
@@ -140,7 +140,7 @@ function genCellWriter(type, offset, endianType = EndianType.BigEndian) {
|
|
|
140
140
|
* @param {BinaryDataType} type
|
|
141
141
|
* @param {number} offset
|
|
142
142
|
* @param {EndianType} [endianType]
|
|
143
|
-
* @returns {
|
|
143
|
+
* @returns {function(data_view:DataView, byte_offset:number):number}
|
|
144
144
|
*/
|
|
145
145
|
function genCellReader(type, offset, endianType = EndianType.BigEndian) {
|
|
146
146
|
const readMethod = DataType2DataViewReaders[type];
|
|
@@ -153,6 +153,10 @@ function genCellReader(type, offset, endianType = EndianType.BigEndian) {
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* This is a schema class for binary data tables of class {@link RowFirstTable}
|
|
158
|
+
* @class
|
|
159
|
+
*/
|
|
156
160
|
export class RowFirstTableSpec {
|
|
157
161
|
/**
|
|
158
162
|
*
|
|
@@ -179,7 +183,7 @@ export class RowFirstTableSpec {
|
|
|
179
183
|
|
|
180
184
|
/**
|
|
181
185
|
* @readonly
|
|
182
|
-
* @type {
|
|
186
|
+
* @type {Uint32Array}
|
|
183
187
|
*/
|
|
184
188
|
this.columnOffsets = new Uint32Array(numTypes);
|
|
185
189
|
|
|
@@ -2,31 +2,30 @@ import { assert } from "../core/assert.js";
|
|
|
2
2
|
import { computeSystemName } from "./ecs/System.js";
|
|
3
3
|
|
|
4
4
|
export class EngineConfiguration {
|
|
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
|
-
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
* @type {System[]}
|
|
9
|
+
*/
|
|
10
|
+
systems = [];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @private
|
|
14
|
+
* @type {Class<EnginePlugin>[]}
|
|
15
|
+
*/
|
|
16
|
+
plugins = [];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @type {StaticKnowledgeDataTableDescriptor[]}
|
|
21
|
+
*/
|
|
22
|
+
knowledge = [];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {Map<string,AssetLoader<any>>}
|
|
27
|
+
*/
|
|
28
|
+
loaders = new Map();
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
*
|
|
@@ -3,7 +3,7 @@ import EntityBuilder from "./EntityBuilder.js";
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {Object} template
|
|
6
|
-
* @param {Object} seed
|
|
6
|
+
* @param {Object} [seed]
|
|
7
7
|
*/
|
|
8
8
|
function populateJsonTemplate(template, seed) {
|
|
9
9
|
if (seed === undefined) {
|
|
@@ -41,9 +41,7 @@ function populateJsonTemplate(template, seed) {
|
|
|
41
41
|
for (const propertyName in template) {
|
|
42
42
|
const templateValue = template[propertyName];
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
result[propertyName] = seededValue;
|
|
44
|
+
result[propertyName] = populateJsonTemplate(templateValue, seed);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
return result;
|
|
@@ -442,6 +442,30 @@ test('getComponent with 1 entity and 1 component', () => {
|
|
|
442
442
|
expect(visitor_1).not.toHaveBeenCalled();
|
|
443
443
|
});
|
|
444
444
|
|
|
445
|
+
test("getComponent on unregistered component class", () => {
|
|
446
|
+
|
|
447
|
+
const ecd = new EntityComponentDataset();
|
|
448
|
+
|
|
449
|
+
const entity = ecd.createEntity();
|
|
450
|
+
|
|
451
|
+
expect(ecd.getComponent(entity, DummyComponentA)).toBe(undefined);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
test("getComponentSafe", () => {
|
|
455
|
+
|
|
456
|
+
const ecd = new EntityComponentDataset();
|
|
457
|
+
ecd.registerComponentType(DummyComponentA);
|
|
458
|
+
|
|
459
|
+
const entity = ecd.createEntity();
|
|
460
|
+
|
|
461
|
+
expect(() => ecd.getComponentSafe(entity, DummyComponentA)).toThrow();
|
|
462
|
+
|
|
463
|
+
const component = new DummyComponentA();
|
|
464
|
+
|
|
465
|
+
ecd.addComponentToEntity(entity, component);
|
|
466
|
+
|
|
467
|
+
expect(ecd.getComponentSafe(entity, DummyComponentA)).toBe(component);
|
|
468
|
+
});
|
|
445
469
|
|
|
446
470
|
test('isComponentTypeRegistered', () => {
|
|
447
471
|
const ecd = new EntityComponentDataset();
|
|
@@ -594,6 +618,59 @@ test('entityHasComponents', () => {
|
|
|
594
618
|
expect(ecd.entityHasComponents(a)).toBe(true);
|
|
595
619
|
});
|
|
596
620
|
|
|
621
|
+
test("getAnyComponent", () => {
|
|
622
|
+
|
|
623
|
+
const ecd = new EntityComponentDataset();
|
|
624
|
+
|
|
625
|
+
ecd.registerManyComponentTypes([
|
|
626
|
+
DummyComponentA,
|
|
627
|
+
DummyComponentB
|
|
628
|
+
]);
|
|
629
|
+
|
|
630
|
+
const a = ecd.createEntity();
|
|
631
|
+
|
|
632
|
+
expect(ecd.getAnyComponent(DummyComponentA)).toEqual({
|
|
633
|
+
entity: -1,
|
|
634
|
+
component: null
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
const component_a = new DummyComponentA();
|
|
638
|
+
ecd.addComponentToEntity(a, component_a);
|
|
639
|
+
ecd.addComponentToEntity(a, new DummyComponentB());
|
|
640
|
+
|
|
641
|
+
expect(ecd.getAnyComponent(DummyComponentA)).toEqual({
|
|
642
|
+
entity: a,
|
|
643
|
+
component: component_a
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
test("hasComponent", () => {
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
const ecd = new EntityComponentDataset();
|
|
652
|
+
|
|
653
|
+
ecd.registerManyComponentTypes([
|
|
654
|
+
DummyComponentA,
|
|
655
|
+
DummyComponentB
|
|
656
|
+
]);
|
|
657
|
+
|
|
658
|
+
const a = ecd.createEntity();
|
|
659
|
+
|
|
660
|
+
expect(ecd.hasComponent(a, DummyComponentA)).toBe(false);
|
|
661
|
+
expect(ecd.hasComponent(a, DummyComponentB)).toBe(false);
|
|
662
|
+
|
|
663
|
+
ecd.addComponentToEntity(a, new DummyComponentA());
|
|
664
|
+
|
|
665
|
+
expect(ecd.hasComponent(a, DummyComponentA)).toBe(true);
|
|
666
|
+
expect(ecd.hasComponent(a, DummyComponentB)).toBe(false);
|
|
667
|
+
|
|
668
|
+
ecd.addComponentToEntity(a, new DummyComponentB());
|
|
669
|
+
|
|
670
|
+
expect(ecd.hasComponent(a, DummyComponentA)).toBe(true);
|
|
671
|
+
expect(ecd.hasComponent(a, DummyComponentB)).toBe(true);
|
|
672
|
+
});
|
|
673
|
+
|
|
597
674
|
describe('event management', () => {
|
|
598
675
|
|
|
599
676
|
test("shouldn't be able to add event listener to non-existent entity", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityObserver } from "./EntityObserver.js";
|
|
2
2
|
import { Transform } from "./transform/Transform.js";
|
|
3
|
-
import GridPosition from "../grid/
|
|
3
|
+
import GridPosition from "../grid/position/GridPosition.js";
|
|
4
4
|
import EntityBuilder from "./EntityBuilder.js";
|
|
5
5
|
import { EntityComponentDataset } from "./EntityComponentDataset.js";
|
|
6
6
|
import { noop } from "../../core/function/Functions.js";
|
|
@@ -4,7 +4,7 @@ import { Blackboard } from "../../../../intelligence/blackboard/Blackboard.js";
|
|
|
4
4
|
import { compileReactiveExpression } from "../../../../../core/lang/reactive/compileReactiveExpression.js";
|
|
5
5
|
import { assert } from "../../../../../core/assert.js";
|
|
6
6
|
|
|
7
|
-
export class
|
|
7
|
+
export class WriteToBlackboardActionDescription extends AbstractActionDescription {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
10
|
|
|
@@ -55,4 +55,4 @@ export class WhiteToBlackboardActionDescription extends AbstractActionDescriptio
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
WriteToBlackboardActionDescription.prototype.type = "Write";
|
|
@@ -5,7 +5,7 @@ import { ActionSequenceDescription } from "./ActionSequenceDescription.js";
|
|
|
5
5
|
import { DelayActionDescription } from "./DelayActionDescription.js";
|
|
6
6
|
import { NoopActionDescription } from "./NoopActionDescription.js";
|
|
7
7
|
import { WeightedRandomActionDescription } from "./WeightedRandomActionDescription.js";
|
|
8
|
-
import {
|
|
8
|
+
import { WriteToBlackboardActionDescription } from "./WriteToBlackboardActionDescription.js";
|
|
9
9
|
|
|
10
10
|
const type_map = {
|
|
11
11
|
Sequence({ elements }) {
|
|
@@ -59,7 +59,7 @@ registerType(SpeakLineActionDescription);
|
|
|
59
59
|
registerType(SendRequestActionDescription);
|
|
60
60
|
registerType(DelayActionDescription);
|
|
61
61
|
registerType(NoopActionDescription);
|
|
62
|
-
registerType(
|
|
62
|
+
registerType(WriteToBlackboardActionDescription);
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GUID } from "./GUID.js";
|
|
2
|
+
import { GUIDSerializationAdapter } from "./GUIDSerializationAdapter.js";
|
|
3
|
+
import { BinaryBuffer } from "../../../core/binary/BinaryBuffer.js";
|
|
4
|
+
|
|
5
|
+
test("to/from consistency", () => {
|
|
6
|
+
|
|
7
|
+
const source = GUID.parse("a88bb73a-c89f-11ed-afa1-0242ac120002");
|
|
8
|
+
|
|
9
|
+
const adapter = new GUIDSerializationAdapter();
|
|
10
|
+
|
|
11
|
+
const buffer = new BinaryBuffer();
|
|
12
|
+
|
|
13
|
+
adapter.serialize(buffer, source);
|
|
14
|
+
buffer.position = 0; // rewind
|
|
15
|
+
|
|
16
|
+
const destination = new GUID();
|
|
17
|
+
|
|
18
|
+
adapter.deserialize(buffer, destination);
|
|
19
|
+
|
|
20
|
+
expect(destination.equals(source)).toBe(true);
|
|
21
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { EntityNode } from "./EntityNode.js";
|
|
2
|
+
import { EntityComponentDataset } from "../EntityComponentDataset.js";
|
|
3
|
+
|
|
4
|
+
test("constructor does not throw", () => {
|
|
5
|
+
new EntityNode()
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test("setFlag", () => {
|
|
9
|
+
const ut = new EntityNode();
|
|
10
|
+
|
|
11
|
+
ut.setFlag(0b101);
|
|
12
|
+
|
|
13
|
+
expect(ut.flags).toBe(5);
|
|
14
|
+
|
|
15
|
+
ut.setFlag(0b010);
|
|
16
|
+
|
|
17
|
+
expect(ut.flags).toBe(7);
|
|
18
|
+
|
|
19
|
+
ut.setFlag(0b1);
|
|
20
|
+
|
|
21
|
+
expect(ut.flags).toBe(7);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("clearFlag", () => {
|
|
25
|
+
const ut = new EntityNode();
|
|
26
|
+
ut.flags = 0b101;
|
|
27
|
+
|
|
28
|
+
ut.clearFlag(0b1);
|
|
29
|
+
|
|
30
|
+
expect(ut.flags).toBe(4);
|
|
31
|
+
|
|
32
|
+
ut.clearFlag(0b10);
|
|
33
|
+
|
|
34
|
+
expect(ut.flags).toBe(4);
|
|
35
|
+
|
|
36
|
+
ut.clearFlag(0b100);
|
|
37
|
+
|
|
38
|
+
expect(ut.flags).toBe(0);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("getFlag", () => {
|
|
42
|
+
|
|
43
|
+
const ut = new EntityNode();
|
|
44
|
+
|
|
45
|
+
ut.flags = 0b101;
|
|
46
|
+
|
|
47
|
+
expect(ut.getFlag(0b1)).toBe(true);
|
|
48
|
+
expect(ut.getFlag(0b10)).toBe(false);
|
|
49
|
+
expect(ut.getFlag(0b100)).toBe(true);
|
|
50
|
+
expect(ut.getFlag(0b1000)).toBe(false);
|
|
51
|
+
expect(ut.getFlag(0b101)).toBe(true);
|
|
52
|
+
expect(ut.getFlag(0b011)).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("writeFlag", () => {
|
|
56
|
+
const ut = new EntityNode();
|
|
57
|
+
|
|
58
|
+
ut.writeFlag(0b101, true);
|
|
59
|
+
expect(ut.flags).toBe(5);
|
|
60
|
+
|
|
61
|
+
ut.writeFlag(0b100, false);
|
|
62
|
+
|
|
63
|
+
expect(ut.flags).toBe(1);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("traverse without children", () => {
|
|
67
|
+
const node = new EntityNode();
|
|
68
|
+
|
|
69
|
+
const visited = [];
|
|
70
|
+
|
|
71
|
+
node.traverse(Array.prototype.push, visited);
|
|
72
|
+
|
|
73
|
+
expect(visited.length).toBe(1);
|
|
74
|
+
expect(visited).toContain(node);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("build empty", () => {
|
|
78
|
+
const node = new EntityNode();
|
|
79
|
+
|
|
80
|
+
const dataset = new EntityComponentDataset();
|
|
81
|
+
|
|
82
|
+
node.build(dataset);
|
|
83
|
+
|
|
84
|
+
expect(node.isBuilt).toBe(true);
|
|
85
|
+
expect(node.entity.isBuilt).toBe(true);
|
|
86
|
+
expect(dataset.entityExists(node.entity.entity)).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("destroy empty", () => {
|
|
90
|
+
const node = new EntityNode();
|
|
91
|
+
|
|
92
|
+
const dataset = new EntityComponentDataset();
|
|
93
|
+
|
|
94
|
+
node.build(dataset);
|
|
95
|
+
|
|
96
|
+
const entity = node.entity.entity;
|
|
97
|
+
|
|
98
|
+
node.destroy();
|
|
99
|
+
|
|
100
|
+
expect(node.isBuilt).toBe(false);
|
|
101
|
+
expect(node.entity.isBuilt).toBe(false);
|
|
102
|
+
expect(dataset.entityExists(entity)).toBe(false);
|
|
103
|
+
|
|
104
|
+
});
|