spoint 0.1.63 → 0.1.66

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.
@@ -36,6 +36,9 @@ export default {
36
36
  },
37
37
 
38
38
  update(ctx, dt) {
39
+ if (!ctx.state.smartObjects || typeof ctx.state.smartObjects[Symbol.iterator] !== 'function') {
40
+ return
41
+ }
39
42
  for (const [id, obj] of ctx.state.smartObjects) {
40
43
  if (obj.template === 'platform') updatePlatform(ctx, id, obj, dt)
41
44
  if (obj.template === 'hazard') updateHazard(ctx, id, obj, dt)
@@ -62,10 +65,12 @@ export default {
62
65
  },
63
66
 
64
67
  teardown(ctx) {
65
- for (const id of ctx.state.smartObjects.keys()) {
66
- ctx.world.destroy(id)
68
+ if (ctx.state.smartObjects && typeof ctx.state.smartObjects.keys === 'function') {
69
+ for (const id of ctx.state.smartObjects.keys()) {
70
+ ctx.world.destroy(id)
71
+ }
72
+ ctx.state.smartObjects.clear()
67
73
  }
68
- ctx.state.smartObjects.clear()
69
74
  }
70
75
  },
71
76
 
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.63",
3
+ "version": "0.1.66",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
Binary file