diff --git a/Dockerfile b/Dockerfile index 1e0bcfe9..33218a5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,8 @@ COPY --from=builder /app/build ./build COPY --from=builder /app/src ./src COPY --from=builder /app/package*.json ./ COPY --from=builder /app/scripts ./scripts +COPY --from=builder /app/apps ./apps + # Set build argument and environment variable ARG COMMIT_HASH=local diff --git a/apps/README.md b/apps/README.md new file mode 100644 index 00000000..0a670ebf --- /dev/null +++ b/apps/README.md @@ -0,0 +1,22 @@ +# Local Apps Development + +This directory contains locally developed apps that can be loaded into the game engine without using the in-browser editor. + +## Creating a New App + +1. Create a new directory in `/apps` with your app name (e.g., `my-app`) +2. Add a `manifest.json` file with the following structure: + +```json +{ + "name": "My App", + "description": "Description of your app", + "model": "model.glb", // optional - path to 3D model file + "script": "script.js" // optional - path to script file +} +``` + +3. Add your app files: + - `script.js` - Your app's JavaScript code + - `model.glb` - Your app's 3D model (optional) + - Any other assets your app needs \ No newline at end of file diff --git a/apps/crash-block/manifest.json b/apps/crash-block/manifest.json new file mode 100644 index 00000000..8f8c1d47 --- /dev/null +++ b/apps/crash-block/manifest.json @@ -0,0 +1,6 @@ +{ + "name": "Crash Block", + "description": "A simple block that is loaded locally.", + "model": "model.glb", + "script": "script.js" + } \ No newline at end of file diff --git a/apps/crash-block/model.glb b/apps/crash-block/model.glb new file mode 100644 index 00000000..62529d7b Binary files /dev/null and b/apps/crash-block/model.glb differ diff --git a/apps/crash-block/script.js b/apps/crash-block/script.js new file mode 100644 index 00000000..ebe8031b --- /dev/null +++ b/apps/crash-block/script.js @@ -0,0 +1,5 @@ +console.log('Crash Block app loaded!') + +app.on('update', delta => { + app.rotation.y += delta * 10 +}) \ No newline at end of file diff --git a/src/client/components/Sidebar.js b/src/client/components/Sidebar.js index 077d36ae..22e0a88a 100644 --- a/src/client/components/Sidebar.js +++ b/src/client/components/Sidebar.js @@ -196,13 +196,15 @@ export function Sidebar({ world, ui }) { > - world.ui.togglePane('script')} - > - - + {!ui.app.blueprint.isLocal && ( + world.ui.togglePane('script')} + > + + + )}