@energy8platform/game-engine 0.20.0 → 0.21.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 (47) hide show
  1. package/README.md +121 -0
  2. package/dist/animation.cjs.js +18 -3
  3. package/dist/animation.cjs.js.map +1 -1
  4. package/dist/animation.esm.js +18 -3
  5. package/dist/animation.esm.js.map +1 -1
  6. package/dist/core.cjs.js +18 -3
  7. package/dist/core.cjs.js.map +1 -1
  8. package/dist/core.esm.js +18 -3
  9. package/dist/core.esm.js.map +1 -1
  10. package/dist/host.cjs.js +18 -3
  11. package/dist/host.cjs.js.map +1 -1
  12. package/dist/host.esm.js +18 -3
  13. package/dist/host.esm.js.map +1 -1
  14. package/dist/index.cjs.js +18 -3
  15. package/dist/index.cjs.js.map +1 -1
  16. package/dist/index.esm.js +18 -3
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/react.cjs.js +18 -3
  19. package/dist/react.cjs.js.map +1 -1
  20. package/dist/react.esm.js +18 -3
  21. package/dist/react.esm.js.map +1 -1
  22. package/dist/slot.cjs.js +1872 -31
  23. package/dist/slot.cjs.js.map +1 -1
  24. package/dist/slot.d.ts +555 -5
  25. package/dist/slot.esm.js +1857 -33
  26. package/dist/slot.esm.js.map +1 -1
  27. package/dist/ui.cjs.js +18 -3
  28. package/dist/ui.cjs.js.map +1 -1
  29. package/dist/ui.esm.js +18 -3
  30. package/dist/ui.esm.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/animation/Tween.ts +14 -3
  33. package/src/slot/anim/easing-map.ts +16 -2
  34. package/src/slot/cascade/TumbleController.ts +230 -0
  35. package/src/slot/config/ReelSystemConfig.ts +559 -0
  36. package/src/slot/config/presets.ts +222 -0
  37. package/src/slot/features/extra.ts +189 -0
  38. package/src/slot/features/index.ts +44 -0
  39. package/src/slot/features/symbols.ts +183 -0
  40. package/src/slot/features/types.ts +136 -0
  41. package/src/slot/features/wilds.ts +151 -0
  42. package/src/slot/grid/ReelGrid.ts +93 -24
  43. package/src/slot/grid/SymbolCell.ts +45 -11
  44. package/src/slot/index.ts +61 -0
  45. package/src/slot/motion/AnticipationController.ts +96 -0
  46. package/src/slot/motion/SpinEngine.ts +384 -0
  47. package/src/slot/system/ReelSystem.ts +295 -0
package/dist/index.esm.js CHANGED
@@ -187,6 +187,10 @@ class Tween {
187
187
  * @param onUpdate - Progress callback (0..1)
188
188
  */
189
189
  static to(target, props, duration, easing, onUpdate) {
190
+ // A destroyed (Pixi) target has null transform fields — skip rather than throw. This guards
191
+ // animations whose target is torn down mid-flight (e.g. a reel grid rebuilt during a spin).
192
+ if (target == null || target.destroyed)
193
+ return Promise.resolve();
190
194
  return new Promise((resolve) => {
191
195
  // Capture starting values
192
196
  const from = {};
@@ -212,6 +216,8 @@ class Tween {
212
216
  * Animate properties from given values to current values.
213
217
  */
214
218
  static from(target, props, duration, easing, onUpdate) {
219
+ if (target == null || target.destroyed)
220
+ return Promise.resolve();
215
221
  // Capture current values as "to"
216
222
  const to = {};
217
223
  for (const key of Object.keys(props)) {
@@ -224,6 +230,8 @@ class Tween {
224
230
  * Animate from one set of values to another.
225
231
  */
226
232
  static fromTo(target, fromProps, toProps, duration, easing, onUpdate) {
233
+ if (target == null || target.destroyed)
234
+ return Promise.resolve();
227
235
  // Set starting values
228
236
  for (const key of Object.keys(fromProps)) {
229
237
  Tween.setProperty(target, key, fromProps[key]);
@@ -297,6 +305,11 @@ class Tween {
297
305
  const dt = ticker.deltaMS;
298
306
  const completed = [];
299
307
  for (const tw of Tween._tweens) {
308
+ // target torn down mid-tween → finish it quietly
309
+ if (tw.target?.destroyed) {
310
+ completed.push(tw);
311
+ continue;
312
+ }
300
313
  tw.elapsed += dt;
301
314
  if (tw.elapsed < tw.delay)
302
315
  continue;
@@ -334,9 +347,9 @@ class Tween {
334
347
  const parts = key.split('.');
335
348
  let obj = target;
336
349
  for (let i = 0; i < parts.length - 1; i++) {
337
- obj = obj[parts[i]];
350
+ obj = obj?.[parts[i]];
338
351
  }
339
- return obj[parts[parts.length - 1]] ?? 0;
352
+ return obj?.[parts[parts.length - 1]] ?? 0;
340
353
  }
341
354
  /**
342
355
  * Set a potentially nested property.
@@ -345,8 +358,10 @@ class Tween {
345
358
  const parts = key.split('.');
346
359
  let obj = target;
347
360
  for (let i = 0; i < parts.length - 1; i++) {
348
- obj = obj[parts[i]];
361
+ obj = obj?.[parts[i]];
349
362
  }
363
+ if (obj == null)
364
+ return;
350
365
  obj[parts[parts.length - 1]] = value;
351
366
  }
352
367
  }