From 9748da123ea10956d5781a1f65dd25b98f66b3ce Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 05:58:29 +0200 Subject: [PATCH] Refactor entity creation logic in App.tsx --- src/app/App.tsx | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 293b6325..b97abcff 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -737,15 +737,41 @@ export function App({ store, initialStatusMessage }: AppProps) { const handlePlaceEntity = (kind: EntityKind) => { try { const basePosition = resolveNewEntityPosition(kind); - const nextEntity = - kind === "triggerVolume" && selectedBrush !== null - ? createTriggerVolumeEntity({ - position: basePosition, - size: selectedBrush.size - }) - : createDefaultEntityInstance(kind, { - position: basePosition - }); + let nextEntity: EntityInstance; + + switch (kind) { + case "playerStart": + nextEntity = createPlayerStartEntity({ + position: basePosition + }); + break; + case "soundEmitter": + nextEntity = createSoundEmitterEntity({ + position: basePosition + }); + break; + case "triggerVolume": + nextEntity = + selectedBrush === null + ? createTriggerVolumeEntity({ + position: basePosition + }) + : createTriggerVolumeEntity({ + position: basePosition, + size: selectedBrush.size + }); + break; + case "teleportTarget": + nextEntity = createTeleportTargetEntity({ + position: basePosition + }); + break; + case "interactable": + nextEntity = createInteractableEntity({ + position: basePosition + }); + break; + } store.executeCommand( createUpsertEntityCommand({ @@ -1319,7 +1345,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
WebEditor3D
-
Slice 1.5 world lighting basics
+
Slice 2.1 entity system foundation