@woosh/meep-engine 2.124.6 → 2.124.10

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 (34) hide show
  1. package/LICENSE +1 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/color/Color.d.ts +331 -75
  5. package/src/core/model/ObservedBoolean.d.ts +4 -2
  6. package/src/core/model/ObservedBoolean.d.ts.map +1 -1
  7. package/src/core/model/ObservedBoolean.js +12 -4
  8. package/src/core/model/ObservedEnum.d.ts.map +1 -1
  9. package/src/core/model/ObservedEnum.js +9 -3
  10. package/src/core/model/ObservedString.d.ts +41 -16
  11. package/src/core/model/ObservedString.d.ts.map +1 -1
  12. package/src/core/model/ObservedString.js +60 -24
  13. package/src/core/model/ObservedValue.d.ts +2 -1
  14. package/src/core/model/ObservedValue.d.ts.map +1 -1
  15. package/src/core/model/ObservedValue.js +8 -3
  16. package/src/core/model/reactive/model/ReactiveExpression.d.ts.map +1 -1
  17. package/src/core/model/reactive/model/ReactiveExpression.js +17 -7
  18. package/src/core/model/stat/Stat.d.ts +163 -29
  19. package/src/core/path/PATH_SEPARATOR.d.ts +5 -1
  20. package/src/core/path/PATH_SEPARATOR.d.ts.map +1 -1
  21. package/src/core/path/PATH_SEPARATOR.js +4 -0
  22. package/src/core/primitives/numbers/computeHashFloat.d.ts.map +1 -1
  23. package/src/core/primitives/numbers/computeHashFloat.js +5 -2
  24. package/src/engine/ecs/guid/UUID.d.ts +35 -3
  25. package/src/engine/ecs/guid/UUID.d.ts.map +1 -1
  26. package/src/engine/ecs/guid/UUID.js +66 -25
  27. package/src/engine/ecs/name/Name.d.ts +6 -13
  28. package/src/engine/ecs/name/Name.d.ts.map +1 -1
  29. package/src/engine/ecs/name/Name.js +11 -25
  30. package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts.map +1 -1
  31. package/src/engine/graphics/ecs/water/Water.d.ts +6 -1
  32. package/src/engine/graphics/ecs/water/Water.d.ts.map +1 -1
  33. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
  34. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +37 -12
@@ -80,11 +80,17 @@ class ObservedEnum {
80
80
  /**
81
81
  *
82
82
  * @param {function(T,T)} processor
83
+ * @param {*} [thisArg]
84
+ * @returns {this}
83
85
  */
84
- process(processor) {
85
- this.onChanged.add(processor);
86
+ process(processor, thisArg) {
87
+ this.onChanged.add(processor, thisArg);
86
88
 
87
- processor(this.__value, this.__value);
89
+ const v = this.__value;
90
+
91
+ processor.call(thisArg, v, v);
92
+
93
+ return this;
88
94
  }
89
95
 
90
96
  toJSON() {
@@ -1,5 +1,14 @@
1
1
  export default ObservedString;
2
2
  /**
3
+ * Observable string container.
4
+ * Signals change via {@link onChanged}.
5
+ *
6
+ * @example
7
+ * const name = new ObservedString("Alice")
8
+ * name.onChanged((new_name, old_name) => console.log(`Name changed from ${old_name} to ${new_name}!`));
9
+ * ...
10
+ * name.set("Barbara"); // will print "Name changed from Alice to Barbara!" in console
11
+ * name.getValue() === "Barbara"
3
12
  *
4
13
  * @author Alex Goldring
5
14
  * @copyright Company Named Limited (c) 2025
@@ -7,20 +16,23 @@ export default ObservedString;
7
16
  declare class ObservedString extends String {
8
17
  /**
9
18
  *
10
- * @param {string} [value]
11
- * @constructor
19
+ * @param {string} [value=""]
12
20
  */
13
21
  constructor(value?: string);
14
22
  /**
15
23
  *
16
- * @type {String}
24
+ * @type {string}
17
25
  * @private
18
26
  */
19
27
  private __value;
20
- onChanged: Signal<any, any, any, any, any, any, any, any>;
21
28
  /**
22
29
  *
23
- * @param {String} value
30
+ * @type {Signal<string,string>}
31
+ */
32
+ onChanged: Signal<string, string>;
33
+ /**
34
+ *
35
+ * @param {string} value
24
36
  * @returns {ObservedString}
25
37
  */
26
38
  set(value: string): ObservedString;
@@ -30,33 +42,41 @@ declare class ObservedString extends String {
30
42
  */
31
43
  copy(other: ObservedString): void;
32
44
  /**
33
- *
34
- * @param {ObservedString} other
35
- * @returns {boolean}
45
+ * @return {ObservedString}
36
46
  */
37
- equals(other: ObservedString): boolean;
47
+ clone(): ObservedString;
38
48
  /**
39
49
  *
40
- * @returns {String}
50
+ * @returns {string}
41
51
  */
42
52
  getValue(): string;
43
53
  /**
44
54
  *
45
- * @param {function} f
55
+ * @param {function(string,string)} f
56
+ * @param {*} [thisArg]
57
+ * @returns {this}
46
58
  */
47
- process(f: Function): void;
48
- toJSON(): string;
49
- fromJSON(obj: any): void;
59
+ process(f: (arg0: string, arg1: string) => any, thisArg?: any): this;
50
60
  /**
51
- *
61
+ * @deprecated use {@link buffer.writeUTF8String} directly instead
52
62
  * @param {BinaryBuffer} buffer
53
63
  */
54
64
  toBinaryBuffer(buffer: BinaryBuffer): void;
55
65
  /**
56
- *
66
+ * @deprecated use {@link buffer.readUTF8String} directly instead
57
67
  * @param {BinaryBuffer} buffer
58
68
  */
59
69
  fromBinaryBuffer(buffer: BinaryBuffer): void;
70
+ /**
71
+ *
72
+ * @param {ObservedString} other
73
+ * @returns {boolean}
74
+ */
75
+ equals(other: ObservedString): boolean;
76
+ /**
77
+ *
78
+ * @return {number}
79
+ */
60
80
  hash(): number;
61
81
  /**
62
82
  * Used for optimized "instanceof" check
@@ -64,6 +84,11 @@ declare class ObservedString extends String {
64
84
  * @type {boolean}
65
85
  */
66
86
  readonly isObservedString: boolean;
87
+ toJSON: () => string;
88
+ fromJSON: (value: string) => ObservedString;
89
+ }
90
+ declare namespace ObservedString {
91
+ let typeName: string;
67
92
  }
68
93
  import Signal from "../events/signal/Signal.js";
69
94
  //# sourceMappingURL=ObservedString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObservedString.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedString.js"],"names":[],"mappings":";AAIA;;;;GAIG;AACH;IACI;;;;OAIG;IACH,oBAHW,MAAM,EAgBhB;IARG;;;;OAIG;IACH,gBAAoB;IAEpB,0DAA6B;IAmBjC;;;;OAIG;IACH,oBAFa,cAAc,CAa1B;IAED;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAInB;IAED;;;OAGG;IACH,mBAEC;IAED;;;OAGG;IACH,2BAIC;IAED,iBAEC;IAED,yBAEC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAMtB;IAED,eAEC;IAGL;;;;OAIG;IACH,2BAFU,OAAO,CAEwB;CAPxC;mBA/HkB,4BAA4B"}
1
+ {"version":3,"file":"ObservedString.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedString.js"],"names":[],"mappings":";AAIA;;;;;;;;;;;;;GAaG;AACH;IACI;;;OAGG;IACH,oBAFW,MAAM,EAmBhB;IAZG;;;;OAIG;IACH,gBAAoB;IAEpB;;;OAGG;IACH,WAFU,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAEF;IAmBjC;;;;OAIG;IACH,WAHW,MAAM,GACJ,cAAc,CAa1B;IAED;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;OAEG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,WAJW,CAAS,IAAM,EAAN,MAAM,EAAC,IAAM,EAAN,MAAM,QAAC,YACvB,GAAC,GACC,IAAI,CAUhB;IAED;;;OAGG;IACH,uBAFW,YAAY,QAItB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAMtB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAInB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAGL;;;;OAIG;IACH,2BAFU,OAAO,CAEwB;IAUzC,cAtHiB,MAAM,CAsHQ;IAC/B,kBA/Ge,MAAM,KACJ,cAAc,CA8GE;CAlBhC;;kBAWS,MAAM;;mBAnKG,4BAA4B"}
@@ -3,6 +3,15 @@ import Signal from "../events/signal/Signal.js";
3
3
  import { computeStringHash } from "../primitives/strings/computeStringHash.js";
4
4
 
5
5
  /**
6
+ * Observable string container.
7
+ * Signals change via {@link onChanged}.
8
+ *
9
+ * @example
10
+ * const name = new ObservedString("Alice")
11
+ * name.onChanged((new_name, old_name) => console.log(`Name changed from ${old_name} to ${new_name}!`));
12
+ * ...
13
+ * name.set("Barbara"); // will print "Name changed from Alice to Barbara!" in console
14
+ * name.getValue() === "Barbara"
6
15
  *
7
16
  * @author Alex Goldring
8
17
  * @copyright Company Named Limited (c) 2025
@@ -10,8 +19,7 @@ import { computeStringHash } from "../primitives/strings/computeStringHash.js";
10
19
  class ObservedString extends String {
11
20
  /**
12
21
  *
13
- * @param {string} [value]
14
- * @constructor
22
+ * @param {string} [value=""]
15
23
  */
16
24
  constructor(value = "") {
17
25
  super();
@@ -20,17 +28,21 @@ class ObservedString extends String {
20
28
 
21
29
  /**
22
30
  *
23
- * @type {String}
31
+ * @type {string}
24
32
  * @private
25
33
  */
26
34
  this.__value = value;
27
35
 
36
+ /**
37
+ *
38
+ * @type {Signal<string,string>}
39
+ */
28
40
  this.onChanged = new Signal();
29
41
  }
30
42
 
31
43
  /**
32
44
  *
33
- * @returns {String}
45
+ * @returns {string}
34
46
  */
35
47
  valueOf() {
36
48
  return this.__value;
@@ -38,7 +50,7 @@ class ObservedString extends String {
38
50
 
39
51
  /**
40
52
  *
41
- * @returns {String}
53
+ * @returns {string}
42
54
  */
43
55
  toString() {
44
56
  return this.__value;
@@ -46,7 +58,7 @@ class ObservedString extends String {
46
58
 
47
59
  /**
48
60
  *
49
- * @param {String} value
61
+ * @param {string} value
50
62
  * @returns {ObservedString}
51
63
  */
52
64
  set(value) {
@@ -71,17 +83,19 @@ class ObservedString extends String {
71
83
  }
72
84
 
73
85
  /**
74
- *
75
- * @param {ObservedString} other
76
- * @returns {boolean}
86
+ * @return {ObservedString}
77
87
  */
78
- equals(other) {
79
- return this.__value === other.__value;
88
+ clone() {
89
+ const r = new this.constructor();
90
+
91
+ r.copy(this);
92
+
93
+ return r;
80
94
  }
81
95
 
82
96
  /**
83
97
  *
84
- * @returns {String}
98
+ * @returns {string}
85
99
  */
86
100
  getValue() {
87
101
  return this.__value;
@@ -89,24 +103,22 @@ class ObservedString extends String {
89
103
 
90
104
  /**
91
105
  *
92
- * @param {function} f
106
+ * @param {function(string,string)} f
107
+ * @param {*} [thisArg]
108
+ * @returns {this}
93
109
  */
94
- process(f) {
95
- f(this.getValue());
110
+ process(f, thisArg) {
111
+ this.onChanged.add(f, thisArg);
96
112
 
97
- this.onChanged.add(f);
98
- }
113
+ const v = this.getValue();
99
114
 
100
- toJSON() {
101
- return this.__value;
102
- }
115
+ f.call(thisArg, v, v);
103
116
 
104
- fromJSON(obj) {
105
- this.set(obj);
117
+ return this;
106
118
  }
107
119
 
108
120
  /**
109
- *
121
+ * @deprecated use {@link buffer.writeUTF8String} directly instead
110
122
  * @param {BinaryBuffer} buffer
111
123
  */
112
124
  toBinaryBuffer(buffer) {
@@ -114,7 +126,7 @@ class ObservedString extends String {
114
126
  }
115
127
 
116
128
  /**
117
- *
129
+ * @deprecated use {@link buffer.readUTF8String} directly instead
118
130
  * @param {BinaryBuffer} buffer
119
131
  */
120
132
  fromBinaryBuffer(buffer) {
@@ -123,6 +135,19 @@ class ObservedString extends String {
123
135
  this.set(value);
124
136
  }
125
137
 
138
+ /**
139
+ *
140
+ * @param {ObservedString} other
141
+ * @returns {boolean}
142
+ */
143
+ equals(other) {
144
+ return this.__value === other.__value;
145
+ }
146
+
147
+ /**
148
+ *
149
+ * @return {number}
150
+ */
126
151
  hash() {
127
152
  return computeStringHash(this.__value);
128
153
  }
@@ -135,4 +160,15 @@ class ObservedString extends String {
135
160
  */
136
161
  ObservedString.prototype.isObservedString = true;
137
162
 
163
+ /**
164
+ * @readonly
165
+ * @type {string}
166
+ */
167
+ ObservedString.typeName = "ObservedString";
168
+
169
+ // JSON methods
170
+
171
+ ObservedString.prototype.toJSON = ObservedString.prototype.toString;
172
+ ObservedString.prototype.fromJSON = ObservedString.prototype.set;
173
+
138
174
  export default ObservedString;
@@ -49,9 +49,10 @@ declare class ObservedValue {
49
49
  /**
50
50
  * Convenience method, invoked given function with current value and registers onChanged callback
51
51
  * @param {function} processor
52
+ * @param {*} [thisArg]
52
53
  * @returns {ObservedValue.<T>}
53
54
  */
54
- process(processor: Function): ObservedValue<T>;
55
+ process(processor: Function, thisArg?: any): ObservedValue<T>;
55
56
  toString(): string;
56
57
  toJSON(): T;
57
58
  fromJSON(value: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ObservedValue.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedValue.js"],"names":[],"mappings":";AAEA;IACI;;;;;OAKG;IACH,eAHW,CAAC,EAWX;IAPG,0DAA6B;IAC7B,WAAgB;IAChB;;;OAGG;IACH,UAFU,CAAC,MAAY,CAAC,CAAC,CAEkB;IAG/C;;;OAGG;IACH,WAFW,CAAC,QAQX;IAED;;;;OAIG;IACH,iBAHW,CAAC,QAKX;IAED;;;OAGG;IACH,OAFa,CAAC,CAIb;IAED;;;OAGG;IACH,YAFW,aAAa,QAIvB;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,aAAa,CAAE,CAAC,CAAC,CAI7B;IAED;;;;OAIG;IACH,8BAFa,aAAa,CAAE,CAAC,CAAC,CAM7B;IAED,mBAIC;IAED,YAEC;IAED,2BAEC;CACJ;mBAjGkB,4BAA4B"}
1
+ {"version":3,"file":"ObservedValue.d.ts","sourceRoot":"","sources":["../../../../src/core/model/ObservedValue.js"],"names":[],"mappings":";AAEA;IACI;;;;;OAKG;IACH,eAHW,CAAC,EAWX;IAPG,0DAA6B;IAC7B,WAAgB;IAChB;;;OAGG;IACH,UAFU,CAAC,MAAY,CAAC,CAAC,CAEkB;IAG/C;;;OAGG;IACH,WAFW,CAAC,QAQX;IAED;;;;OAIG;IACH,iBAHW,CAAC,QAKX;IAED;;;OAGG;IACH,OAFa,CAAC,CAIb;IAED;;;OAGG;IACH,YAFW,aAAa,QAIvB;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAInB;IAED;;;OAGG;IACH,SAFa,aAAa,CAAE,CAAC,CAAC,CAI7B;IAED;;;;;OAKG;IACH,uCAHW,GAAC,GACC,aAAa,CAAE,CAAC,CAAC,CAU7B;IAED,mBAIC;IAED,YAEC;IAED,2BAEC;CACJ;mBAtGkB,4BAA4B"}
@@ -74,11 +74,16 @@ class ObservedValue {
74
74
  /**
75
75
  * Convenience method, invoked given function with current value and registers onChanged callback
76
76
  * @param {function} processor
77
+ * @param {*} [thisArg]
77
78
  * @returns {ObservedValue.<T>}
78
79
  */
79
- process(processor) {
80
- processor(this.__value);
81
- this.onChanged.add(processor);
80
+ process(processor, thisArg) {
81
+ this.onChanged.add(processor, thisArg);
82
+
83
+ const v = this.__value;
84
+
85
+ processor.call(thisArg, v, v);
86
+
82
87
  return this;
83
88
  }
84
89
 
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,gCAFa,CAAC;IAIN,0DAA6B;IAGjC,uBAEC;IAED,cAEC;IAED;;;;OAIG;IACH,wCAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;OAEG;IACH,YAFa,CAAC,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAInC;IAED;;;;OAIG;IACH,iCAFW,GAAC,QAIX;IAED;;;OAGG;IACH,mBAFY,MAAM,CAQjB;IAED;;;OAGG;IACH,iCAIC;IAED;;;;OAIG;IACH,sBAFa,OAAO,GAAC,MAAM,GAAC,MAAM,CAIjC;IAGL,cAAqC;IAErC;;;OAGG;IACH,+BAFU,OAAO,CAEgC;CARhD;mBA/FkB,kCAAkC"}
1
+ {"version":3,"file":"ReactiveExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,gCAFa,CAAC;IAIV;;;OAGG;IACH,oBAFU,MAAM,CAAC,CAAC,EAAC,CAAC,CAAC,CAEI;IAGzB,uBAEC;IAED,cAEC;IAED;;;;OAIG;IACH,wCAFa,OAAO,CAQnB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;OAEG;IACH,YAFa,CAAC,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAInC;IAED;;;;OAIG;IACH,iCAFW,GAAC,QAIX;IAED;;;OAGG;IACH,mBAFY,MAAM,CAQjB;IAED;;;;;OAKG;IACH,iBAJW,CAAS,IAAC,EAAD,CAAC,EAAC,IAAC,EAAD,CAAC,QAAC,YACb,GAAC,GACC,IAAI,CAUhB;IAED;;;;OAIG;IACH,sBAFa,OAAO,GAAC,MAAM,GAAC,MAAM,CAIjC;IAGL,cAAqC;IAErC;;;OAGG;IACH,+BAFU,OAAO,CAEgC;CARhD;mBAzGkB,kCAAkC"}
@@ -6,9 +6,13 @@ import { computeStringHash } from "../../../primitives/strings/computeStringHash
6
6
  * @template T
7
7
  */
8
8
  export class ReactiveExpression {
9
- constructor() {
10
- this.onChanged = new Signal();
11
- }
9
+
10
+ /**
11
+ * @readonly
12
+ * @type {Signal<T,T>}
13
+ */
14
+ onChanged = new Signal();
15
+
12
16
 
13
17
  copy(other) {
14
18
  throw new Error('Not Implemented');
@@ -77,12 +81,18 @@ export class ReactiveExpression {
77
81
 
78
82
  /**
79
83
  *
80
- * @param {function} handler
84
+ * @param {function(T,T)} handler
85
+ * @param {*} [thisArg]
86
+ * @returns {this}
81
87
  */
82
- process(handler) {
83
- handler(this.getValue());
88
+ process(handler, thisArg) {
89
+ this.onChanged.add(handler, thisArg);
90
+
91
+ const v = this.getValue();
92
+
93
+ handler.call(thisArg, v, v);
84
94
 
85
- this.onChanged.add(handler);
95
+ return this;
86
96
  }
87
97
 
88
98
  /**
@@ -1,29 +1,163 @@
1
- import Signal from "../../events/signal/Signal";
2
- import LinearModifier from "./LinearModifier";
3
-
4
- export default class Stat extends Number {
5
- constructor(base_value: number)
6
-
7
- public readonly onModifierAdded: Signal<LinearModifier>
8
- public readonly onModifierRemoved: Signal<LinearModifier>
9
- public readonly onChanged: Signal<number, number>
10
-
11
- getValue(): number
12
-
13
- getBaseValue(): number
14
-
15
- setBaseValue(v: number): void
16
-
17
- addModifier(mod: LinearModifier): void
18
-
19
- removeModifier(mod: LinearModifier): boolean
20
-
21
- equals(other: Stat): boolean
22
-
23
- copy(other: Stat): void
24
-
25
- toJSON(): any
26
-
27
- fromJSON(json: any): void
28
-
29
- }
1
+ export default Stat;
2
+ /**
3
+ * Modifiable statistic.
4
+ * Allows non-destructive linear arithmetic.
5
+ * Useful when we wish to be able to reverse part or the whole of the computation
6
+ *
7
+ * Main purpose of the class is to facilitate implementation of RPG-like stats, such as maximum health, or armor.
8
+ * These stats can then be modified by various skills, equipment and effects. Each such modification will be added as a separate {@link LinearModifier} and can be reversed by removing the modifier.
9
+ */
10
+ declare class Stat extends Number {
11
+ /**
12
+ *
13
+ * @param {number} input
14
+ * @param {List<LinearModifier>}modifiers
15
+ * @returns {number}
16
+ */
17
+ static applyModifiers(input: number, modifiers: List<LinearModifier>): number;
18
+ /**
19
+ * @param {number} [value]
20
+ * @constructor
21
+ */
22
+ constructor(value?: number);
23
+ /**
24
+ * Unique identifier of a stat, such a health, armor etc.
25
+ * @type {number}
26
+ */
27
+ id: number;
28
+ /**
29
+ * List of modifiers.
30
+ * Order has no influence on final computed value
31
+ * @private
32
+ * @readonly
33
+ * @type {List<LinearModifier>}
34
+ */
35
+ private readonly __modifiers;
36
+ /**
37
+ *
38
+ * @type {function(number): number}
39
+ */
40
+ postprocess: (arg0: number) => number;
41
+ /**
42
+ * Base value that will be affected by modifiers
43
+ * @type {Vector1}
44
+ */
45
+ base: Vector1;
46
+ /**
47
+ * Final computed value. Do not modify this directly
48
+ * @type {Vector1}
49
+ */
50
+ value: Vector1;
51
+ /**
52
+ *
53
+ * @returns {Signal<LinearModifier>}
54
+ */
55
+ get onModifierAdded(): Signal<LinearModifier>;
56
+ /**
57
+ *
58
+ * @returns {Signal<LinearModifier>}
59
+ */
60
+ get onModifierRemoved(): Signal<LinearModifier>;
61
+ /**
62
+ * Remove all modifiers from the stat
63
+ */
64
+ resetModifiers(): void;
65
+ /**
66
+ *
67
+ * @returns {string}
68
+ */
69
+ toString(): string;
70
+ /**
71
+ *
72
+ * @returns {number}
73
+ */
74
+ getValue(): number;
75
+ updateValue(): void;
76
+ /**
77
+ *
78
+ * @returns {number}
79
+ */
80
+ getBaseValue(): number;
81
+ /**
82
+ *
83
+ * @param {number} v
84
+ */
85
+ setBaseValue(v: number): void;
86
+ /**
87
+ * NOTE: do not modify result
88
+ * @return {LinearModifier[]}
89
+ */
90
+ getModifiers(): LinearModifier[];
91
+ /**
92
+ *
93
+ * @param {LinearModifier} mod
94
+ */
95
+ addModifier(mod: LinearModifier): void;
96
+ /**
97
+ *
98
+ * @param {LinearModifier} mod
99
+ * @return {boolean}
100
+ */
101
+ hasModifier(mod: LinearModifier): boolean;
102
+ /**
103
+ *
104
+ * @param {LinearModifier} mod
105
+ * @returns {boolean}
106
+ */
107
+ removeModifier(mod: LinearModifier): boolean;
108
+ /**
109
+ *
110
+ * @param {Stat} other
111
+ * @returns {boolean}
112
+ */
113
+ equals(other: Stat): boolean;
114
+ /**
115
+ *
116
+ * @param {Stat} other
117
+ */
118
+ copy(other: Stat): void;
119
+ /**
120
+ * Copy base value from another stat
121
+ * @param {Stat} other
122
+ */
123
+ copyBase(other: Stat): void;
124
+ /**
125
+ *
126
+ * @param {function(number):number} f
127
+ * @param {number} v
128
+ */
129
+ setBaseFromParametricFunction(f: (arg0: number) => number, v: number): void;
130
+ /**
131
+ * @param {Stat} other
132
+ */
133
+ addNonTransientModifiersFromStat(other: Stat): void;
134
+ toJSON(): {
135
+ base: number;
136
+ modifiers: any;
137
+ };
138
+ fromJSON(json: any): void;
139
+ /**
140
+ *
141
+ * @returns {Signal}
142
+ */
143
+ get onChanged(): Signal;
144
+ /**
145
+ * @readonly
146
+ * @type {boolean}
147
+ */
148
+ readonly isStat: boolean;
149
+ }
150
+ declare namespace Stat {
151
+ namespace Process {
152
+ export function ROUND_DOWN(v: number): number;
153
+ export function NONE(v: any): any;
154
+ export function clampMin(value: number): (arg0: number) => number;
155
+ export function clampMax(value: number): (arg0: number) => number;
156
+ export { chain };
157
+ }
158
+ }
159
+ import Vector1 from "../../geom/Vector1.js";
160
+ import LinearModifier from "./LinearModifier.js";
161
+ import List from "../../collection/list/List.js";
162
+ import { chain } from "../../function/chain.js";
163
+ //# sourceMappingURL=Stat.d.ts.map
@@ -1,2 +1,6 @@
1
- export const PATH_SEPARATOR: "/";
1
+ /**
2
+ * Separator used for file paths and URLs
3
+ * @type {string}
4
+ */
5
+ export const PATH_SEPARATOR: string;
2
6
  //# sourceMappingURL=PATH_SEPARATOR.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PATH_SEPARATOR.d.ts","sourceRoot":"","sources":["../../../../src/core/path/PATH_SEPARATOR.js"],"names":[],"mappings":"AAAA,6BAA8B,GAAG,CAAC"}
1
+ {"version":3,"file":"PATH_SEPARATOR.d.ts","sourceRoot":"","sources":["../../../../src/core/path/PATH_SEPARATOR.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,6BAFU,MAAM,CAEkB"}
@@ -1 +1,5 @@
1
+ /**
2
+ * Separator used for file paths and URLs
3
+ * @type {string}
4
+ */
1
5
  export const PATH_SEPARATOR = '/';
@@ -1 +1 @@
1
- {"version":3,"file":"computeHashFloat.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/numbers/computeHashFloat.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAclB"}
1
+ {"version":3,"file":"computeHashFloat.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/numbers/computeHashFloat.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAiBlB"}
@@ -13,8 +13,11 @@ export function computeHashFloat(v) {
13
13
 
14
14
  // fractional part is scaled up into uint32 range,
15
15
  // this inexact method, as it will produce 0 hash for values below a certain threshold, but it's fast
16
- const fractionHash = fraction * UINT32_MAX;
16
+ const fraction_hash = ((fraction) * UINT32_MAX) >>> 0;
17
+
18
+ // we flip the order, tiny fractions will result in higher bits of the final hash, leads to better dispersion
19
+ const fraction_hash_inverse = UINT32_MAX - fraction_hash;
17
20
 
18
21
  // take XOR of both parts
19
- return fractionHash ^ whole;
22
+ return fraction_hash_inverse ^ whole;
20
23
  }
@@ -1,7 +1,23 @@
1
1
  /**
2
- * Universally Unique Identifier
3
- * The default is Nil UUID, where all bits are set to 0
4
- * @see IETF RFC 4122
2
+ * Universally Unique Identifier (UUID), a 128 bit label used to uniquely identify resources.
3
+ * The default is Nil UUID, where all bits are set to 0, see {@link UUID.nil}.
4
+ * Also known as GUID ( Globally Unique IDentifier).
5
+ *
6
+ * @see IETF RFC 4122 - https://datatracker.ietf.org/doc/html/rfc4122
7
+ * @example
8
+ * class Student{
9
+ * id: UUID
10
+ * name: string
11
+ * age: number
12
+ * }
13
+ * @example
14
+ * const id_a = UUID.v1();
15
+ * const id_b = UUID.v1();
16
+ *
17
+ * id_a.equals(id_b); // false
18
+ *
19
+ * @author Alex Goldring
20
+ * @copyright Company Named Limited (c) 2025
5
21
  */
6
22
  export class UUID {
7
23
  /**
@@ -36,6 +52,22 @@ export class UUID {
36
52
  * @returns {Uint8Array}
37
53
  */
38
54
  get data(): Uint8Array;
55
+ /**
56
+ * The version number is in the most significant 4 bits of the timestamp (bits 4 through 7 of the time_hi_and_version field).
57
+ *
58
+ * @see https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.3
59
+ * @return {number}
60
+ * @example
61
+ * UUID.v1().version === 1
62
+ * UUID.v4().version === 4
63
+ */
64
+ get version(): number;
65
+ /**
66
+ * The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
67
+ * Clears all bits of this UUID.
68
+ * @returns {void}
69
+ */
70
+ nil(): void;
39
71
  /**
40
72
  * Generate Variant 1 UUID
41
73
  * @returns {void}
@@ -1 +1 @@
1
- {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH;IAkGI;;;OAGG;IACH,aAFY,IAAI,CAQf;IA2BD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IA/MD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,UAAU,GAAC,SAAS,CAAC,MAAM,CAAC,EAO/C;IAED;;;OAGG;IACH,YAFa,UAAU,CAItB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAqBhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,uBA7EiB,MAAM,CA6EF;IAErB;;OAEG;IACH,4BA7Ie,MAAM,UA6IE;IAQvB;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAtBpB;;kBAcS,MAAM"}
1
+ {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA2HI;;;OAGG;IACH,aAFY,IAAI,CAQf;IA2BD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IAxOD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,UAAU,GAAC,SAAS,CAAC,MAAM,CAAC,EAO/C;IAED;;;OAGG;IACH,YAFa,UAAU,CAItB;IAED;;;;;;;;OAQG;IACH,eALY,MAAM,CAUjB;IAED;;;;OAIG;IACH,OAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAqBhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,uBA7EiB,MAAM,CA6EF;IAErB;;OAEG;IACH,4BA7Ie,MAAM,UA6IE;IAQvB;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAtBpB;;kBAcS,MAAM"}