@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.
Files changed (160) hide show
  1. package/editor/actions/concrete/WriteGridValueAction.js +1 -1
  2. package/editor/ecs/component/prototypeObjectEditor.js +1 -1
  3. package/editor/process/ObstacleGridDisplayProcess.js +2 -2
  4. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
  5. package/editor/tools/GridPaintTool.js +2 -2
  6. package/package.json +4 -3
  7. package/samples/generation/SampleGenerator0.js +1 -1
  8. package/samples/generation/generators/interactive/mir_generator_place_buff_objects.js +1 -1
  9. package/samples/generation/generators/mir_generator_place_bases.js +1 -1
  10. package/samples/generation/generators/mir_generator_place_road_decorators.js +1 -1
  11. package/samples/generation/generators/mir_generator_place_starting_point.js +1 -1
  12. package/samples/generation/main.js +2 -2
  13. package/samples/generation/rules/matcher_play_area.js +1 -1
  14. package/samples/generation/rules/matcher_tag_occupied.js +1 -1
  15. package/samples/generation/rules/matcher_tag_traversable.js +1 -1
  16. package/samples/generation/themes/SampleTheme0.js +5 -5
  17. package/src/core/NumberFormat.js +0 -71
  18. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -0
  19. package/src/core/bvh2/bvh3/query/BVHQueryAny.js +16 -0
  20. package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +5 -5
  21. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +2 -3
  22. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.spec.js +22 -0
  23. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +2 -2
  24. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.spec.js +64 -0
  25. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +2 -3
  26. package/src/core/collection/table/RowFirstTableSpec.js +8 -4
  27. package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +41 -0
  28. package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.spec.js +10 -0
  29. package/src/core/geom/3d/topology/struct/TopoMesh.js +3 -2
  30. package/src/core/geom/3d/topology/struct/prototypeBinaryTopology.js +4 -4
  31. package/src/core/geom/Vector2.d.ts +9 -0
  32. package/src/core/geom/Vector2.js +8 -22
  33. package/src/core/geom/Vector2.spec.js +153 -0
  34. package/src/core/model/ModuleRegistry.js +2 -4
  35. package/src/core/model/ModuleRegistry.spec.js +31 -0
  36. package/src/core/model/reactive/js/compileReactiveToJS.spec.js +14 -0
  37. package/src/core/model/reactive/model/logic/ReactiveAnd.spec.js +31 -1
  38. package/src/core/model/reactive/model/logic/ReactiveOr.spec.js +53 -0
  39. package/src/core/model/stat/LinearModifier.js +2 -2
  40. package/src/core/model/stat/LinearModifier.spec.js +62 -0
  41. package/src/core/model/stat/Stat.js +12 -0
  42. package/src/core/model/stat/Stat.spec.js +36 -0
  43. package/src/core/primitives/array/computeStridedIntegerArrayHash.spec.js +28 -0
  44. package/src/core/primitives/numbers/number_format_by_thousands.js +14 -0
  45. package/src/core/primitives/numbers/number_pretty_print.js +49 -0
  46. package/src/core/primitives/strings/computeStringHash.spec.js +12 -5
  47. package/src/core/process/BaseProcess.js +8 -8
  48. package/src/engine/Clock.js +30 -29
  49. package/src/engine/Clock.spec.js +26 -0
  50. package/src/engine/Engine.spec.js +4 -0
  51. package/src/engine/ecs/EntityBuilder.js +3 -1
  52. package/src/engine/ecs/EntityBuilder.spec.js +21 -0
  53. package/src/engine/ecs/EntityComponentDataset.js +1 -1
  54. package/src/engine/ecs/EntityObserver.spec.js +1 -1
  55. package/src/engine/ecs/dynamic_actions/actions/definition/{WhiteToBlackboardActionDescription.js → WriteToBlackboardActionDescription.js} +2 -2
  56. package/src/engine/ecs/dynamic_actions/actions/definition/deserializeActionFromJSON.js +2 -2
  57. package/src/engine/ecs/gui/GUIElement.js +1 -1
  58. package/src/engine/ecs/gui/position/ViewportPosition.js +3 -3
  59. package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +21 -0
  60. package/src/engine/ecs/parent/EntityNode.js +1 -1
  61. package/src/engine/ecs/parent/EntityNode.spec.js +104 -0
  62. package/src/engine/ecs/speaker/Voice.js +4 -0
  63. package/src/engine/ecs/team/Team.js +0 -44
  64. package/src/engine/ecs/team/TeamSerializationAdapter.js +46 -0
  65. package/src/engine/ecs/terrain/ecs/TerrainClassifier.js +1 -1
  66. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +1 -1
  67. package/src/engine/ecs/transform/Transform.js +2 -1
  68. package/src/engine/ecs/transform/Transform.spec.js +24 -0
  69. package/src/engine/graphics/camera/testClippingPlaneComputation.js +2 -6
  70. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraph.spec.js +5 -0
  71. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +24 -25
  72. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.spec.js +5 -0
  73. package/src/engine/graphics/ecs/decal/DecalSystem.js +2 -20
  74. package/src/engine/graphics/ecs/decal/v2/Decal.js +32 -32
  75. package/src/engine/graphics/ecs/decal/v2/Decal.spec.js +5 -0
  76. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +4 -2
  77. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +4 -33
  78. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +8 -4
  79. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.spec.js +5 -0
  80. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +0 -12
  81. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
  82. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
  83. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +2 -4
  84. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +1 -1
  85. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +0 -2
  86. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -6
  87. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -6
  88. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
  89. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +4 -8
  90. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +2 -1
  91. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -1
  92. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +2 -2
  93. package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  94. package/src/engine/graphics/texture/TextureBackedMemoryRegion.js +4 -1
  95. package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
  96. package/src/engine/graphics/texture/sampler/filter/filter_lanczos3.js +7 -2
  97. package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.js +3 -23
  98. package/src/engine/grid/grid2transform/GridPosition2Transform.js +122 -0
  99. package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +70 -0
  100. package/src/engine/grid/grid2transform/GridPosition2TransformSerializationUpgrader_0_1.js +40 -0
  101. package/src/engine/grid/{systems → grid2transform}/GridPosition2TransformSystem.js +3 -3
  102. package/src/engine/grid/{components → obstacle}/GridObstacle.js +45 -25
  103. package/src/engine/grid/obstacle/GridObstacle.spec.js +175 -0
  104. package/src/engine/grid/{components → position}/GridPosition.js +6 -14
  105. package/src/engine/grid/{systems → position}/GridPositionSystem.js +1 -1
  106. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  107. package/src/engine/input/devices/PointerDevice.spec.js +5 -0
  108. package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +5 -1
  109. package/src/engine/navigation/ecs/path_following/PathFollower.js +40 -32
  110. package/src/engine/navigation/ecs/path_following/PathFollower.spec.js +27 -0
  111. package/src/engine/plugin/EnginePlugin.js +12 -14
  112. package/src/engine/plugin/EnginePlugin.spec.js +5 -0
  113. package/src/engine/plugin/EnginePluginManager.js +18 -22
  114. package/src/engine/scene/transitionToScene.js +12 -1
  115. package/src/engine/simulation/Ticker.js +1 -1
  116. package/src/generation/filtering/CellFilter.js +6 -9
  117. package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +1 -4
  118. package/src/generation/filtering/core/CellFilterBinaryOperation.js +12 -15
  119. package/src/generation/filtering/core/CellFilterOperationTertiary.js +15 -19
  120. package/src/generation/filtering/numeric/CellFilterLiteralFloat.js +6 -9
  121. package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.js +1 -1
  122. package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.js +2 -2
  123. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
  124. package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
  125. package/src/generation/theme/TerrainLayerDescription.js +1 -1
  126. package/src/view/common/LabelView.js +3 -3
  127. package/src/engine/ecs/components/AimController.js +0 -18
  128. package/src/engine/ecs/components/Attacker.js +0 -13
  129. package/src/engine/ecs/components/MeshCollider.js +0 -15
  130. package/src/engine/ecs/components/RangedAttack.js +0 -12
  131. package/src/engine/ecs/components/TargetAI.js +0 -11
  132. package/src/engine/ecs/components/ViewportMeshProjection.js +0 -18
  133. package/src/engine/ecs/systems/AimControllerSystem.js +0 -63
  134. package/src/engine/ecs/systems/AttackerSystem.js +0 -67
  135. package/src/engine/ecs/systems/MeshColliderSystem.js +0 -47
  136. package/src/engine/ecs/systems/MonsterAISystem.js +0 -163
  137. package/src/engine/ecs/systems/MortalitySystem.js +0 -46
  138. package/src/engine/ecs/systems/RangedAttackSystem.js +0 -132
  139. package/src/engine/ecs/systems/SerializationMetadataSystem.js +0 -10
  140. package/src/engine/ecs/systems/TargetAISystem.js +0 -107
  141. package/src/engine/ecs/systems/ViewportMeshProjectionSystem.js +0 -68
  142. package/src/engine/graphics/particles/ParticleEmitterLibrary.js +0 -87
  143. package/src/engine/graphics/texture/ExportCanvasAsPNG.js +0 -7
  144. package/src/engine/grid/components/GridObstacle.spec.js +0 -46
  145. package/src/engine/grid/components/GridPosition2Transform.js +0 -232
  146. package/src/engine/grid/components/ViewportGridProjection.js +0 -20
  147. package/src/engine/grid/systems/GridObstacleSystem.js +0 -58
  148. package/src/engine/grid/systems/ViewportGridProjectionSystem.js +0 -105
  149. package/src/engine/navigation/PathFinder.js +0 -172
  150. package/src/engine/navigation/PathWorker.js +0 -78
  151. package/src/engine/navigation/ecs/systems/PathFinderSystem.js +0 -63
  152. package/src/engine/navigation/ecs/systems/PathSystem.js +0 -19
  153. package/src/engine/navigation/funnel/Funnel.js +0 -196
  154. package/src/generation/ZoneNode.js +0 -9
  155. /package/{src/generation → samples/generation/grid}/GridTags.js +0 -0
  156. /package/src/{engine → core/primitives/array}/computeStridedIntegerArrayHash.js +0 -0
  157. /package/src/engine/grid/{components → grid2transform}/GridPosition2TransformFlags.js +0 -0
  158. /package/src/engine/grid/{components → obstacle}/GridObstacleSerializationAdapter.js +0 -0
  159. /package/src/engine/grid/{components → position}/GridPositionSerializationAdapter.js +0 -0
  160. /package/src/engine/grid/{components → position}/GridPositionSerializationUpdater_0_1.js +0 -0
@@ -1,5 +1,10 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
1
5
  import { PointerDevice } from "./PointerDevice.js";
2
6
 
7
+
3
8
  test("constructor does not throw", () => {
4
9
  const element = document.createElement('div');
5
10
 
@@ -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(result, input, input_length, dimensions, sample_count, alpha = 0.5) {
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
- * Maximum distance that the follower can move along the path in a single step
45
- * @type {number}
46
- */
47
- this.maxMoveDistance = 100000;
48
-
49
- /**
50
- * Absolute position along the path
51
- * @type {number}
52
- */
53
- this.position = 0;
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
- * @type {Class<EnginePlugin>[]}
11
- * @private
12
- */
13
- this.__dependencies = [];
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
  /**
@@ -0,0 +1,5 @@
1
+ import { EnginePlugin } from "./EnginePlugin.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ new EnginePlugin();
5
+ });
@@ -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({ tasks = [], scene, engine, name }) {
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
@@ -51,7 +51,7 @@ class Ticker {
51
51
  * @param {*} [thisArg]
52
52
  */
53
53
  unsubscribe(callback, thisArg) {
54
- assert.typeOf(callback, 'function', 'callback');
54
+ assert.isFunction(callback, 'callback');
55
55
 
56
56
  const callbacks = this.callbacks;
57
57
  const n = callbacks.length;
@@ -3,15 +3,12 @@ import DataType from "../../core/parser/simple/DataType.js";
3
3
 
4
4
  export class CellFilter {
5
5
 
6
- constructor() {
7
- /**
8
- *
9
- * @type {boolean}
10
- * @protected
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
- this.value = true;
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
- constructor() {
5
- super();
6
-
7
- /**
8
- *
9
- * @type {CellFilter}
10
- */
11
- this.left = null;
12
-
13
- /**
14
- *
15
- * @type {CellFilter}
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
- constructor() {
6
- super();
7
-
8
- /**
9
- *
10
- * @type {number}
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/components/GridObstacle.js";
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/components/GridPosition.js";
5
- import GridObstacle from "../../../engine/grid/components/GridObstacle.js";
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 "../../../GridTags.js";
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/components/GridPosition.js";
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
 
@@ -17,7 +17,7 @@ export class TerrainLayerDescription {
17
17
  }
18
18
 
19
19
  hash() {
20
- return computeStringHash(this.diffuse) ^ this.size.hashCode();
20
+ return computeStringHash(this.diffuse) ^ this.size.hash();
21
21
  }
22
22
 
23
23
  /**
@@ -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 prettyPrint(value);
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 prettyPrint(v);
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,13 +0,0 @@
1
- /**
2
- * Created by Alex on 30/06/2014.
3
- */
4
-
5
-
6
- function Attacker(options) {
7
- this.target = null;
8
- this.range = options.range || 0;
9
- this.delay = options.delay || 1;
10
- this.timerValue = 0;
11
- }
12
-
13
- export default Attacker;
@@ -1,15 +0,0 @@
1
- /**
2
- * Created by hdnha on 7/24/2014.
3
- */
4
-
5
-
6
- /**
7
- * @deprecated
8
- * @param options
9
- * @constructor
10
- */
11
- function MeshCollider(options) {
12
- this.tags = options.tags.slice();
13
- }
14
-
15
- export default MeshCollider;
@@ -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,11 +0,0 @@
1
- /**
2
- * Created by Alex on 30/06/2014.
3
- */
4
-
5
-
6
- function TargetAI(options) {
7
- this.tags = options.tags || [];
8
- this.range = options.range || 0;
9
- }
10
-
11
- export default TargetAI;
@@ -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;