From 085da37eac19a1ee4794076a6acf221cf8b796fe Mon Sep 17 00:00:00 2001 From: Gon Pombo Date: Tue, 3 Dec 2024 18:05:34 -0300 Subject: [PATCH] fix multipalyer clone issue at runtime (#1039) * fix multipalyer clone issue at runtime * update asset-packs --- packages/@dcl/inspector/package-lock.json | 8 ++++---- packages/@dcl/inspector/package.json | 2 +- packages/@dcl/sdk-commands/package-lock.json | 4 ++-- .../@dcl/sdk-commands/src/logic/bundle.ts | 19 ++++--------------- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/@dcl/inspector/package-lock.json b/packages/@dcl/inspector/package-lock.json index 3d9e8461d..48414d615 100644 --- a/packages/@dcl/inspector/package-lock.json +++ b/packages/@dcl/inspector/package-lock.json @@ -8,7 +8,7 @@ "name": "@dcl/inspector", "version": "0.1.0", "dependencies": { - "@dcl/asset-packs": "^2.0.0", + "@dcl/asset-packs": "^2.1.1", "ts-deepmerge": "^7.0.0" }, "devDependencies": { @@ -294,9 +294,9 @@ "integrity": "sha512-IOur6rSK5vN/oUpfawW6ax6vXPeADPCB44WNudeIYEYER7kwT2akNKUCLLjR19cLo006i/dkdt6UsTQ677uMxA==" }, "node_modules/@dcl/asset-packs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@dcl/asset-packs/-/asset-packs-2.0.0.tgz", - "integrity": "sha512-RyeSOE8FoZDIjsYddgvWmez7mkv8HSlCSYlfP+QhDRvUs7j50mMoSzHMf6i8xm9IDHm8bCH94AuxHlykdahyeA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dcl/asset-packs/-/asset-packs-2.1.1.tgz", + "integrity": "sha512-DgcRbGODLPxBTw2O6BN4vNBVEwhiDBvuCR6tSIjladb7bqQ5PWZbL/OQX4Ok2V1++gTnNPuaIrXId/ryGaTaKg==", "license": "ISC", "dependencies": { "@dcl-sdk/utils": "^1.2.8", diff --git a/packages/@dcl/inspector/package.json b/packages/@dcl/inspector/package.json index d6f6f756a..173866572 100644 --- a/packages/@dcl/inspector/package.json +++ b/packages/@dcl/inspector/package.json @@ -2,7 +2,7 @@ "name": "@dcl/inspector", "version": "0.1.0", "dependencies": { - "@dcl/asset-packs": "^2.0.0", + "@dcl/asset-packs": "^2.1.1", "ts-deepmerge": "^7.0.0" }, "devDependencies": { diff --git a/packages/@dcl/sdk-commands/package-lock.json b/packages/@dcl/sdk-commands/package-lock.json index d8a53355a..0548d6212 100644 --- a/packages/@dcl/sdk-commands/package-lock.json +++ b/packages/@dcl/sdk-commands/package-lock.json @@ -65,7 +65,7 @@ "../inspector": { "version": "0.1.0", "dependencies": { - "@dcl/asset-packs": "1.20.2", + "@dcl/asset-packs": "^2.1.1", "ts-deepmerge": "^7.0.0" }, "devDependencies": { @@ -3139,7 +3139,7 @@ "@babylonjs/inspector": "~6.18.0", "@babylonjs/loaders": "~6.18.0", "@babylonjs/materials": "~6.18.0", - "@dcl/asset-packs": "1.20.2", + "@dcl/asset-packs": "^2.1.1", "@dcl/ecs": "file:../ecs", "@dcl/ecs-math": "2.1.0", "@dcl/mini-rpc": "^1.0.7", diff --git a/packages/@dcl/sdk-commands/src/logic/bundle.ts b/packages/@dcl/sdk-commands/src/logic/bundle.ts index f5e6a023b..704aae787 100644 --- a/packages/@dcl/sdk-commands/src/logic/bundle.ts +++ b/packages/@dcl/sdk-commands/src/logic/bundle.ts @@ -63,24 +63,14 @@ import { compositeFromLoader } from '~sdk/all-composites' ${ isEditorScene && ` -import { initAssetPacks } from '@dcl/asset-packs/dist/scene-entrypoint' -initAssetPacks(engine) +import { syncEntity } from '@dcl/sdk/network' +import { initAssetPacks, setSyncEntity } from '@dcl/asset-packs/dist/scene-entrypoint' +initAssetPacks(engine, { syncEntity }) // TODO: do we need to do this on runtime ? // I think we have that information at build-time and we avoid to do evaluate this on the worker. // Read composite.json or main.crdt => If that file has a NetowrkEntity import '@dcl/@sdk/network' - -// conditionally load networking code if the NetworkEntity component is being used... -for (const path in compositeFromLoader) { - const composite = compositeProvider.getCompositeOrNull(path) - if (composite) { - const { components } = composite.composite - const hasNetworkEntity = components.find(($) => $.name === NetworkEntity.componentName) - if (hasNetworkEntity) { - import('@dcl/sdk/network') - } - } -}` +` } if ((entrypoint as any).main !== undefined) { @@ -106,7 +96,6 @@ export * from '${unixEntrypointPath}' export async function bundleProject(components: BundleComponents, options: CompileOptions, sceneJson: Scene) { const tsconfig = path.join(options.workingDirectory, 'tsconfig.json') - /* istanbul ignore if */ if (!options.single && !sceneJson.main) { throw new CliError('scene.json .main must be present')