@woosh/meep-engine 3.60.7 → 3.60.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.60.7",
9
+ "version": "3.60.8",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -1 +1 @@
1
- {"version":3,"file":"GridActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../src/generation/markers/GridActionRuleSet.js"],"names":[],"mappings":"AA2BA;IA0BI;;;;;;;;OAQG;IACH;QAN4C,KAAK,EAAtC,uBAAuB;QACW,MAAM,GAAxC,uBAAuB;QACJ,OAAO,GAA1B,MAAM,EAAE;QACU,kBAAkB,GAApC,OAAO;QACL,iBAAiB,CAkB7B;IAjDD;;;OAGG;IACH,UAFU,uBAAuB,CAEnB;IAEd;;;OAGG;IACH,QAFU,uBAAuB,GAAC,MAAM,CAEI;IAE5C;;;OAGG;IACH,SAFU,MAAM,EAAE,CAED;IAEjB;;;OAGG;IACH,aAFU,OAAO,CAEE;IA6BnB;;;OAGG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,8BAJW,MAAM,eACN,MAAM,QAiIhB;CACJ;wCArNuC,8BAA8B"}
1
+ {"version":3,"file":"GridActionRuleSet.d.ts","sourceRoot":"","sources":["../../../../src/generation/markers/GridActionRuleSet.js"],"names":[],"mappings":"AA4BA;IA0BI;;;;;;;;OAQG;IACH;QAN4C,KAAK,EAAtC,uBAAuB;QACW,MAAM,GAAxC,uBAAuB;QACJ,OAAO,GAA1B,MAAM,EAAE;QACU,kBAAkB,GAApC,OAAO;QACL,iBAAiB,CAkB7B;IAjDD;;;OAGG;IACH,UAFU,uBAAuB,CAEnB;IAEd;;;OAGG;IACH,QAFU,uBAAuB,GAAC,MAAM,CAEI;IAE5C;;;OAGG;IACH,SAFU,MAAM,EAAE,CAED;IAEjB;;;OAGG;IACH,aAFU,OAAO,CAEE;IA6BnB;;;OAGG;IACH,uCAEC;IAED;;;;;;OAMG;IACH,8BAJW,MAAM,eACN,MAAM,QAyIhB;CACJ;wCA7NuC,8BAA8B"}
@@ -3,6 +3,7 @@ import { ArrayIteratorRandom } from "../../core/collection/array/iterator/ArrayI
3
3
  import { ArrayIteratorSequential } from "../../core/collection/array/iterator/ArrayIteratorSequential.js";
4
4
  import { v2_rotate } from "../../core/geom/vec2/v2_rotate.js";
5
5
  import { PI_HALF } from "../../core/math/PI_HALF.js";
6
+ import { randomIntegerBetween } from "../../core/math/random/randomIntegerBetween.js";
6
7
  import { seededRandom } from "../../core/math/random/seededRandom.js";
7
8
  import TaskGroup from "../../core/process/task/TaskGroup.js";
8
9
  import { countTask } from "../../core/process/task/util/countTask.js";
@@ -146,7 +147,6 @@ export class GridActionRuleSet {
146
147
 
147
148
  const tMain = randomCountTask(seed, 0, sampleCount, index => {
148
149
 
149
-
150
150
  const sample_y = (index / sampleCountX) | 0;
151
151
  const sample_x = index % sampleCountX;
152
152
 
@@ -166,11 +166,19 @@ export class GridActionRuleSet {
166
166
 
167
167
  const matcher = element.pattern;
168
168
 
169
+ let ROTATION_COUNT = 1;
170
+ let INITIAL_ROTATION = 0;
171
+
172
+ if (element.allowRotation) {
173
+ ROTATION_COUNT = 4;
174
+ // to avoid biasing rotation 0, we pick a random initial rotation; the sequence is always the same though
175
+ INITIAL_ROTATION = randomIntegerBetween(random, 0, 3);
176
+ }
177
+
169
178
  sampling_loop: for (let sampleIndex = 0; sampleIndex < patternSize;) {
170
179
  const sampleOffsetX = pattern[sampleIndex++];
171
180
  const sampleOffsetY = pattern[sampleIndex++];
172
181
 
173
- const ROTATION_COUNT = element.allowRotation ? 4 : 1;
174
182
 
175
183
  // a single roll per placement attempt: whether the rule fires is decided once,
176
184
  // the rotation scan only decides the orientation. Rolling per rotation would
@@ -178,8 +186,9 @@ export class GridActionRuleSet {
178
186
  const roll = random();
179
187
 
180
188
  for (let j = 0; j < ROTATION_COUNT; j++) {
189
+ const rotation_index = (j + INITIAL_ROTATION) % 4;
181
190
 
182
- const rotation = j * PI_HALF;
191
+ const rotation = rotation_index * PI_HALF;
183
192
 
184
193
  v2_rotate(scratch_offset, 0, sampleOffsetX, sampleOffsetY, rotation);
185
194