@woosh/meep-engine 2.51.0 → 2.53.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/NumberFormat.js +0 -71
- package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -0
- package/src/core/bvh2/bvh3/query/BVHQueryAny.js +16 -0
- package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +5 -5
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +2 -3
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.spec.js +22 -0
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.spec.js +64 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +2 -3
- package/src/core/collection/table/RowFirstTableSpec.js +8 -4
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +41 -0
- package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.spec.js +10 -0
- package/src/core/geom/3d/topology/struct/TopoMesh.js +3 -2
- package/src/core/geom/3d/topology/struct/prototypeBinaryTopology.js +4 -4
- package/src/core/geom/Vector2.d.ts +9 -0
- package/src/core/geom/Vector2.js +8 -22
- package/src/core/geom/Vector2.spec.js +153 -0
- package/src/core/model/ModuleRegistry.js +2 -4
- package/src/core/model/ModuleRegistry.spec.js +31 -0
- package/src/core/model/reactive/js/compileReactiveToJS.spec.js +14 -0
- package/src/core/model/reactive/model/logic/ReactiveAnd.spec.js +31 -1
- package/src/core/model/reactive/model/logic/ReactiveOr.spec.js +53 -0
- package/src/core/model/stat/LinearModifier.js +2 -2
- package/src/core/model/stat/LinearModifier.spec.js +62 -0
- package/src/core/model/stat/Stat.js +12 -0
- package/src/core/model/stat/Stat.spec.js +36 -0
- package/src/core/primitives/array/computeStridedIntegerArrayHash.spec.js +28 -0
- package/src/core/primitives/numbers/number_format_by_thousands.js +14 -0
- package/src/core/primitives/numbers/number_pretty_print.js +49 -0
- package/src/core/primitives/strings/computeStringHash.spec.js +12 -5
- package/src/core/process/BaseProcess.js +8 -8
- package/src/engine/Clock.js +30 -29
- package/src/engine/Clock.spec.js +26 -0
- package/src/engine/Engine.spec.js +4 -0
- package/src/engine/ecs/EntityBuilder.js +3 -1
- package/src/engine/ecs/EntityBuilder.spec.js +21 -0
- package/src/engine/ecs/EntityComponentDataset.js +1 -1
- 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/gui/GUIElement.js +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +3 -3
- 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/ecs/TerrainClassifier.js +1 -1
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +1 -1
- package/src/engine/ecs/transform/Transform.js +2 -1
- package/src/engine/ecs/transform/Transform.spec.js +24 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +2 -6
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraph.spec.js +5 -0
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +24 -25
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.spec.js +5 -0
- package/src/engine/graphics/ecs/decal/DecalSystem.js +2 -20
- package/src/engine/graphics/ecs/decal/v2/Decal.js +32 -32
- package/src/engine/graphics/ecs/decal/v2/Decal.spec.js +5 -0
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +4 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +4 -33
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +8 -4
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.spec.js +5 -0
- package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +0 -12
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +2 -4
- package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +0 -2
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -6
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -6
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +4 -8
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +2 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -1
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +2 -2
- package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
- package/src/engine/graphics/texture/TextureBackedMemoryRegion.js +4 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
- package/src/engine/graphics/texture/sampler/filter/filter_lanczos3.js +7 -2
- package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.js +3 -23
- package/src/engine/grid/grid2transform/GridPosition2Transform.js +122 -0
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +70 -0
- 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 → obstacle}/GridObstacle.js +45 -25
- package/src/engine/grid/obstacle/GridObstacle.spec.js +175 -0
- package/src/engine/grid/{components → position}/GridPosition.js +6 -14
- 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/plugin/EnginePlugin.js +12 -14
- package/src/engine/plugin/EnginePlugin.spec.js +5 -0
- package/src/engine/plugin/EnginePluginManager.js +18 -22
- package/src/engine/scene/transitionToScene.js +12 -1
- package/src/engine/simulation/Ticker.js +1 -1
- 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/generation/theme/TerrainLayerDescription.js +1 -1
- package/src/view/common/LabelView.js +3 -3
- package/src/engine/ecs/components/AimController.js +0 -18
- package/src/engine/ecs/components/Attacker.js +0 -13
- package/src/engine/ecs/components/MeshCollider.js +0 -15
- package/src/engine/ecs/components/RangedAttack.js +0 -12
- package/src/engine/ecs/components/TargetAI.js +0 -11
- package/src/engine/ecs/components/ViewportMeshProjection.js +0 -18
- package/src/engine/ecs/systems/AimControllerSystem.js +0 -63
- package/src/engine/ecs/systems/AttackerSystem.js +0 -67
- package/src/engine/ecs/systems/MeshColliderSystem.js +0 -47
- package/src/engine/ecs/systems/MonsterAISystem.js +0 -163
- package/src/engine/ecs/systems/MortalitySystem.js +0 -46
- package/src/engine/ecs/systems/RangedAttackSystem.js +0 -132
- package/src/engine/ecs/systems/SerializationMetadataSystem.js +0 -10
- package/src/engine/ecs/systems/TargetAISystem.js +0 -107
- package/src/engine/ecs/systems/ViewportMeshProjectionSystem.js +0 -68
- package/src/engine/graphics/particles/ParticleEmitterLibrary.js +0 -87
- package/src/engine/graphics/texture/ExportCanvasAsPNG.js +0 -7
- package/src/engine/grid/components/GridObstacle.spec.js +0 -46
- package/src/engine/grid/components/GridPosition2Transform.js +0 -232
- package/src/engine/grid/components/ViewportGridProjection.js +0 -20
- package/src/engine/grid/systems/GridObstacleSystem.js +0 -58
- package/src/engine/grid/systems/ViewportGridProjectionSystem.js +0 -105
- 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 → core/primitives/array}/computeStridedIntegerArrayHash.js +0 -0
- /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformFlags.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
|
@@ -38,7 +38,11 @@ const p3 = [];
|
|
|
38
38
|
* @param {number} sample_count number of discrete points to be generated
|
|
39
39
|
* @param {number} [alpha=0.5] parameter for control point weights (see non-parametric catmull-rom for details on "alpha" definition)
|
|
40
40
|
*/
|
|
41
|
-
export function computeCatmullRomSpline(
|
|
41
|
+
export function computeCatmullRomSpline(
|
|
42
|
+
result,
|
|
43
|
+
input, input_length,
|
|
44
|
+
dimensions, sample_count, alpha = 0.5
|
|
45
|
+
) {
|
|
42
46
|
assert.greaterThan(dimensions, 0, 'number of dimensions must be greater than 0');
|
|
43
47
|
assert.isNonNegativeInteger(dimensions, 'dimensions');
|
|
44
48
|
|
|
@@ -19,39 +19,40 @@ const DEFAULT_FLAGS = PathFollowerFlags.Active
|
|
|
19
19
|
| PathFollowerFlags.WriteRotationZ
|
|
20
20
|
;
|
|
21
21
|
|
|
22
|
+
const DEFAULT_MAX_MOVE_DISTANCE = 100000;
|
|
23
|
+
|
|
22
24
|
class PathFollower {
|
|
23
|
-
constructor() {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Movement speed along the path in world units per second
|
|
27
|
-
* @type {Vector1}
|
|
28
|
-
*/
|
|
29
|
-
this.speed = new Vector1(DEFAULT_SPEED);
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Speed at which path follower can adjust rotation in Rad/s
|
|
33
|
-
* @type {Vector1}
|
|
34
|
-
*/
|
|
35
|
-
this.rotationSpeed = new Vector1(DEFAULT_ROTATION_SPEED);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @type {number}
|
|
40
|
-
*/
|
|
41
|
-
this.flags = DEFAULT_FLAGS;
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Movement speed along the path in world units per second
|
|
28
|
+
* @type {Vector1}
|
|
29
|
+
*/
|
|
30
|
+
speed = new Vector1(DEFAULT_SPEED);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Speed at which path follower can adjust rotation in Rad/s
|
|
34
|
+
* @type {Vector1}
|
|
35
|
+
*/
|
|
36
|
+
rotationSpeed = new Vector1(DEFAULT_ROTATION_SPEED);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
flags = DEFAULT_FLAGS;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Maximum distance that the follower can move along the path in a single step
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
maxMoveDistance = DEFAULT_MAX_MOVE_DISTANCE;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Absolute position along the path
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
position = 0;
|
|
55
|
+
|
|
55
56
|
|
|
56
57
|
get rotationAlignment() {
|
|
57
58
|
throw new Error(`deprecated, use relevant flag instead`);
|
|
@@ -138,7 +139,8 @@ class PathFollower {
|
|
|
138
139
|
|
|
139
140
|
speed: this.speed.toJSON(),
|
|
140
141
|
rotationSpeed: this.rotationSpeed.toJSON(),
|
|
141
|
-
position: this.position
|
|
142
|
+
position: this.position,
|
|
143
|
+
maxMoveDistance: this.maxMoveDistance
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -176,6 +178,12 @@ class PathFollower {
|
|
|
176
178
|
this.rotationSpeed.set(DEFAULT_ROTATION_SPEED);
|
|
177
179
|
}
|
|
178
180
|
|
|
181
|
+
if (typeof json.maxMoveDistance === "number") {
|
|
182
|
+
this.maxMoveDistance = json.maxMoveDistance;
|
|
183
|
+
} else {
|
|
184
|
+
this.maxMoveDistance = DEFAULT_MAX_MOVE_DISTANCE;
|
|
185
|
+
}
|
|
186
|
+
|
|
179
187
|
if (json.writePositionX !== undefined) {
|
|
180
188
|
this.writeFlag(PathFollowerFlags.WritePositionX, json.writePositionX);
|
|
181
189
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import PathFollower from "./PathFollower.js";
|
|
2
|
+
|
|
3
|
+
test("constructor does not throw", () => {
|
|
4
|
+
new PathFollower();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
test("to/from JSON consistency", () => {
|
|
9
|
+
|
|
10
|
+
const source = new PathFollower();
|
|
11
|
+
|
|
12
|
+
source.speed.set(13);
|
|
13
|
+
source.rotationSpeed.set(17);
|
|
14
|
+
source.flags = 0b1010100101;
|
|
15
|
+
source.maxMoveDistance = 123;
|
|
16
|
+
source.position = 27;
|
|
17
|
+
|
|
18
|
+
const destination = new PathFollower();
|
|
19
|
+
|
|
20
|
+
destination.fromJSON(source.toJSON());
|
|
21
|
+
|
|
22
|
+
expect(destination.speed.getValue()).toEqual(13);
|
|
23
|
+
expect(destination.rotationSpeed.getValue()).toEqual(17);
|
|
24
|
+
expect(destination.flags).toEqual(0b1010100101);
|
|
25
|
+
expect(destination.maxMoveDistance).toEqual(123);
|
|
26
|
+
expect(destination.position).toEqual(27)
|
|
27
|
+
});
|
|
@@ -2,22 +2,20 @@ import { BaseProcess } from "../../core/process/BaseProcess.js";
|
|
|
2
2
|
import { assert } from "../../core/assert.js";
|
|
3
3
|
|
|
4
4
|
export class EnginePlugin extends BaseProcess {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {Class<EnginePlugin>[]}
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
__dependencies = [];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {Engine|null}
|
|
16
|
+
*/
|
|
17
|
+
engine = null;
|
|
14
18
|
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {Engine|null}
|
|
18
|
-
*/
|
|
19
|
-
this.engine = null;
|
|
20
|
-
}
|
|
21
19
|
|
|
22
20
|
attach() {
|
|
23
21
|
/**
|
|
@@ -6,29 +6,25 @@ import { isSubclassOf } from "./isSubclassOf.js";
|
|
|
6
6
|
import { assert } from "../../core/assert.js";
|
|
7
7
|
|
|
8
8
|
export class EnginePluginManager extends BaseProcess {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
* @type {Map<Class, PluginReferenceContext>}
|
|
15
|
-
*/
|
|
16
|
-
this.__plugins = new Map();
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @type {Engine}
|
|
21
|
-
*/
|
|
22
|
-
this.engine = null;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @type {number}
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
this.__version = 0;
|
|
30
|
-
}
|
|
31
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* @type {Map<Class, PluginReferenceContext>}
|
|
13
|
+
*/
|
|
14
|
+
__plugins = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {Engine}
|
|
19
|
+
*/
|
|
20
|
+
engine = null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {number}
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
__version = 0;
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
*
|
|
@@ -9,6 +9,7 @@ import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
|
9
9
|
import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
10
10
|
import { delayTask } from "../../core/process/task/util/delayTask.js";
|
|
11
11
|
import { wrapTaskIgnoreFailure } from "../../core/process/task/util/wrapTaskIgnoreFailure.js";
|
|
12
|
+
import { assert } from "../../core/assert.js";
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -19,7 +20,17 @@ import { wrapTaskIgnoreFailure } from "../../core/process/task/util/wrapTaskIgno
|
|
|
19
20
|
* @param {string} [name]
|
|
20
21
|
* @return {Promise}
|
|
21
22
|
*/
|
|
22
|
-
export function transitionToScene({
|
|
23
|
+
export function transitionToScene({
|
|
24
|
+
tasks = [],
|
|
25
|
+
scene,
|
|
26
|
+
engine,
|
|
27
|
+
name
|
|
28
|
+
}) {
|
|
29
|
+
|
|
30
|
+
assert.defined(engine, 'engine');
|
|
31
|
+
assert.defined(scene, 'scene');
|
|
32
|
+
assert.isArray(tasks, 'tasks');
|
|
33
|
+
|
|
23
34
|
if (name === undefined) {
|
|
24
35
|
if (tasks.length > 0) {
|
|
25
36
|
//assume name of the first task
|
|
@@ -3,15 +3,12 @@ import DataType from "../../core/parser/simple/DataType.js";
|
|
|
3
3
|
|
|
4
4
|
export class CellFilter {
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.__initialized = false;
|
|
13
|
-
|
|
14
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {boolean}
|
|
9
|
+
* @protected
|
|
10
|
+
*/
|
|
11
|
+
__initialized = false;
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
*
|
|
@@ -3,11 +3,8 @@ import DataType from "../../../core/parser/simple/DataType.js";
|
|
|
3
3
|
import { assert } from "../../../core/assert.js";
|
|
4
4
|
|
|
5
5
|
export class CellFilterLiteralBoolean extends CellFilter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
value = true;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { CellFilter } from "../CellFilter.js";
|
|
2
2
|
|
|
3
3
|
export class CellFilterBinaryOperation extends CellFilter {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
this.right = null;
|
|
18
|
-
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {CellFilter}
|
|
8
|
+
*/
|
|
9
|
+
left = null;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {CellFilter}
|
|
14
|
+
*/
|
|
15
|
+
right = null;
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* @template T,R
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { CellFilter } from "../CellFilter.js";
|
|
2
2
|
|
|
3
3
|
export class CellFilterOperationTertiary extends CellFilter {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @type {CellFilter}
|
|
10
|
-
*/
|
|
11
|
-
this.a = null;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @type {CellFilter}
|
|
15
|
-
*/
|
|
16
|
-
this.b = null;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @type {CellFilter}
|
|
20
|
-
*/
|
|
21
|
-
this.c = null;
|
|
22
4
|
|
|
23
|
-
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {CellFilter}
|
|
8
|
+
*/
|
|
9
|
+
a = null;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {CellFilter}
|
|
13
|
+
*/
|
|
14
|
+
b = null;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @type {CellFilter}
|
|
18
|
+
*/
|
|
19
|
+
c = null;
|
|
24
20
|
|
|
25
21
|
/**
|
|
26
22
|
*
|
|
@@ -2,15 +2,12 @@ import { CellFilter } from "../CellFilter.js";
|
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
3
|
|
|
4
4
|
export class CellFilterLiteralFloat extends CellFilter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
this.value = 1;
|
|
13
|
-
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
value = 1;
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContinuousGridCellAction } from "./ContinuousGridCellAction.js";
|
|
2
2
|
import Terrain from "../../../engine/ecs/terrain/ecs/Terrain.js";
|
|
3
3
|
import { assert } from "../../../core/assert.js";
|
|
4
|
-
import GridObstacle from "../../../engine/grid/
|
|
4
|
+
import GridObstacle from "../../../engine/grid/obstacle/GridObstacle.js";
|
|
5
5
|
import { CellFilterLiteralFloat } from "../../filtering/numeric/CellFilterLiteralFloat.js";
|
|
6
6
|
|
|
7
7
|
export class ContinuousGridCellActionSetTerrainObstacle extends ContinuousGridCellAction {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ContinuousGridCellAction } from "./ContinuousGridCellAction.js";
|
|
2
2
|
import { CellFilterLiteralFloat } from "../../filtering/numeric/CellFilterLiteralFloat.js";
|
|
3
3
|
import Terrain from "../../../engine/ecs/terrain/ecs/Terrain.js";
|
|
4
|
-
import GridPosition from "../../../engine/grid/
|
|
5
|
-
import GridObstacle from "../../../engine/grid/
|
|
4
|
+
import GridPosition from "../../../engine/grid/position/GridPosition.js";
|
|
5
|
+
import GridObstacle from "../../../engine/grid/obstacle/GridObstacle.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export class ContinuousGridCellActionWriteObstacle extends ContinuousGridCellAction {
|
|
@@ -9,7 +9,7 @@ import { BitSet } from "../../../../core/binary/BitSet.js";
|
|
|
9
9
|
import { matcher_tag_traversable } from "../../../../../samples/generation/rules/matcher_tag_traversable.js";
|
|
10
10
|
import { buildPathFromDistanceMap } from "../util/buildPathFromDistanceMap.js";
|
|
11
11
|
import { GridCellActionPlaceTags } from "../../../placement/action/GridCellActionPlaceTags.js";
|
|
12
|
-
import { GridTags } from "
|
|
12
|
+
import { GridTags } from "../../../../../samples/generation/grid/GridTags.js";
|
|
13
13
|
import { CellMatcher } from "../../../rules/CellMatcher.js";
|
|
14
14
|
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
15
15
|
import { QuadTreeNode } from "../../../../core/geom/2d/quad-tree/QuadTreeNode.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MarkerNodeAction } from "./MarkerNodeAction.js";
|
|
2
|
-
import GridPosition from "../../../engine/grid/
|
|
2
|
+
import GridPosition from "../../../engine/grid/position/GridPosition.js";
|
|
3
3
|
import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
4
4
|
import { EntityBlueprint } from "../../../engine/ecs/EntityBlueprint.js";
|
|
5
5
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @copyright Alex Goldring 2016
|
|
4
4
|
*/
|
|
5
5
|
import View from "../View.js";
|
|
6
|
-
import { prettyPrint } from "../../core/NumberFormat.js";
|
|
7
6
|
import ObservedValue from "../../core/model/ObservedValue.js";
|
|
8
7
|
import Vector1 from "../../core/geom/Vector1.js";
|
|
9
8
|
import LinearValue from "../../core/model/LinearValue.js";
|
|
@@ -17,6 +16,7 @@ import { assert } from "../../core/assert.js";
|
|
|
17
16
|
import ObservedInteger from "../../core/model/ObservedInteger.js";
|
|
18
17
|
import { noop } from "../../core/function/Functions.js";
|
|
19
18
|
import { isTypedArray } from "../../core/collection/array/typed/isTypedArray.js";
|
|
19
|
+
import { number_pretty_print } from "../../core/primitives/numbers/number_pretty_print.js";
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -26,7 +26,7 @@ import { isTypedArray } from "../../core/collection/array/typed/isTypedArray.js"
|
|
|
26
26
|
*/
|
|
27
27
|
function format(value) {
|
|
28
28
|
if (typeof value === 'number') {
|
|
29
|
-
return
|
|
29
|
+
return number_pretty_print(value);
|
|
30
30
|
} else {
|
|
31
31
|
return value;
|
|
32
32
|
}
|
|
@@ -38,7 +38,7 @@ function format(value) {
|
|
|
38
38
|
* @returns {string|number}
|
|
39
39
|
*/
|
|
40
40
|
function formatNumber(v) {
|
|
41
|
-
return
|
|
41
|
+
return number_pretty_print(v);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function formatArray(arr) {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Alex Goldring
|
|
3
|
-
* Date: 13/6/2014
|
|
4
|
-
* Time: 22:32
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function AimController(options) {
|
|
9
|
-
this.xDelta = 0;
|
|
10
|
-
this.yDelta = 0;
|
|
11
|
-
//
|
|
12
|
-
this.lon = 0;
|
|
13
|
-
this.lat = 0;
|
|
14
|
-
this.phi = 0;
|
|
15
|
-
this.theta = 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default AimController;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 13/08/2014.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function RangedAttack(options) {
|
|
7
|
-
this.factory = options.factory || null;
|
|
8
|
-
this.speed = options.speed || 1;
|
|
9
|
-
this.projectileOffset = options.offset || new THREE.Vector3(0, 0, 0);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default RangedAttack;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 18/12/2014.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import Vector2 from "../../../core/geom/Vector2.js";
|
|
6
|
-
|
|
7
|
-
function ViewportMeshProjection(options) {
|
|
8
|
-
if (options === void 0) {
|
|
9
|
-
options = {};
|
|
10
|
-
}
|
|
11
|
-
this.position = options.position !== void 0 ? options.position : new Vector2();
|
|
12
|
-
this.entity = options.entity;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
ViewportMeshProjection.typeName = "ViewportMeshProjection";
|
|
17
|
-
|
|
18
|
-
export default ViewportMeshProjection;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Alex Goldring
|
|
3
|
-
* Date: 13/6/2014
|
|
4
|
-
* Time: 22:33
|
|
5
|
-
*/
|
|
6
|
-
import { System } from '../System.js';
|
|
7
|
-
import AimController from '../components/AimController.js';
|
|
8
|
-
import CharacterController from '../components/CharacterController.js';
|
|
9
|
-
import { Transform } from '../transform/Transform.js';
|
|
10
|
-
import { DEG_TO_RAD } from "../../../core/math/DEG_TO_RAD.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class AimControllerSystem extends System {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
this.dependencies = [AimController];
|
|
17
|
-
|
|
18
|
-
this.sensitivity = 5 * DEG_TO_RAD;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
add(component, entity) {
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
remove(component) {
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
update(timeDelta) {
|
|
28
|
-
const entityManager = this.entityManager;
|
|
29
|
-
const sensitivity = this.sensitivity;
|
|
30
|
-
entityManager.traverseEntities([AimController, CharacterController, Transform], function (aimController, character, transform) {
|
|
31
|
-
//update controller
|
|
32
|
-
updateController(aimController, sensitivity);
|
|
33
|
-
//rotate player
|
|
34
|
-
const quaternion = new THREE.Quaternion();
|
|
35
|
-
quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), -aimController.lon * DEG_TO_RAD);
|
|
36
|
-
transform.rotation.copy(quaternion);
|
|
37
|
-
//rotate aim transform
|
|
38
|
-
const aimTransform = character.aim;
|
|
39
|
-
if (aimTransform !== void 0) {
|
|
40
|
-
const e = new THREE.Euler();
|
|
41
|
-
e.setFromQuaternion(aimTransform.rotation);
|
|
42
|
-
e.x = -(aimController.phi - Math.PI / 2);
|
|
43
|
-
aimTransform.rotation.setFromEuler(e);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function updateController(aim, sensitivity) {
|
|
51
|
-
aim.lon += sensitivity * aim.xDelta;
|
|
52
|
-
aim.lat -= sensitivity * aim.yDelta;
|
|
53
|
-
//reset deltas
|
|
54
|
-
aim.xDelta = 0;
|
|
55
|
-
aim.yDelta = 0;
|
|
56
|
-
|
|
57
|
-
aim.lat = Math.max(-85, Math.min(85, aim.lat));
|
|
58
|
-
aim.phi = THREE.Math.degToRad(90 - aim.lat);
|
|
59
|
-
|
|
60
|
-
aim.theta = THREE.Math.degToRad(aim.lon);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default AimControllerSystem;
|