spoint 0.1.20 → 0.1.22

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 (2) hide show
  1. package/client/app.js +10 -5
  2. package/package.json +1 -1
package/client/app.js CHANGED
@@ -657,8 +657,10 @@ ground.rotation.x = -Math.PI / 2
657
657
  ground.receiveShadow = true
658
658
  scene.add(ground)
659
659
 
660
- const gltfLoader = new GLTFLoader()
661
- const dracoLoader = new DRACOLoader()
660
+ const loadingManager = new THREE.LoadingManager()
661
+ loadingManager.onError = (url) => console.warn('[THREE] Failed to load:', url)
662
+ const gltfLoader = new GLTFLoader(loadingManager)
663
+ const dracoLoader = new DRACOLoader(loadingManager)
662
664
  dracoLoader.setDecoderPath('/draco/')
663
665
  gltfLoader.setDRACOLoader(dracoLoader)
664
666
  gltfLoader.register((parser) => new VRMLoaderPlugin(parser))
@@ -813,11 +815,14 @@ function removePlayerMesh(id) {
813
815
 
814
816
  function evaluateAppModule(code) {
815
817
  try {
816
- // Strip imports and import.meta usage
817
818
  let stripped = code.replace(/^import\s+.*$/gm, '')
818
819
  stripped = stripped.replace(/const\s+__dirname\s*=.*import\.meta\.url.*$/gm, 'const __dirname = "/"')
819
820
  const wrapped = stripped.replace(/export\s+default\s*/, 'return ').replace(/export\s+/g, '')
820
- return new Function(wrapped)()
821
+ const join = (...parts) => parts.filter(Boolean).join('/')
822
+ const readdirSync = () => []
823
+ const statSync = () => ({ isDirectory: () => false })
824
+ const fileURLToPath = (url) => '/'
825
+ return new Function('join', 'readdirSync', 'statSync', 'fileURLToPath', wrapped)(join, readdirSync, statSync, fileURLToPath)
821
826
  } catch (e) { console.error('[app-eval]', e.message, e.stack); return null }
822
827
  }
823
828
 
@@ -939,7 +944,7 @@ function loadEntityModel(entityId, entityState) {
939
944
  fitShadowFrustum()
940
945
  pendingLoads.delete(entityId)
941
946
  if (!environmentLoaded) { environmentLoaded = true; checkAllLoaded() }
942
- }, undefined, (err) => { console.error('[gltf]', entityId, err); pendingLoads.delete(entityId) })
947
+ }, (progress) => { if (progress.total > 0) console.log('[gltf]', url, Math.round(progress.loaded / progress.total * 100) + '%') }, (err) => { console.error('[gltf]', url, err); pendingLoads.delete(entityId) })
943
948
  }
944
949
 
945
950
  function renderAppUI(state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",