From edbed229b3031dfc23a5230e7702c47ef1c0b46a Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sun, 4 Jan 2026 06:52:29 +0000 Subject: [PATCH] Fix: torches toggle --- party-stage/src/scene/config-ui.js | 5 +--- party-stage/src/scene/stage-torches.js | 32 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/party-stage/src/scene/config-ui.js b/party-stage/src/scene/config-ui.js index ef6136a..bfcde75 100644 --- a/party-stage/src/scene/config-ui.js +++ b/party-stage/src/scene/config-ui.js @@ -103,10 +103,7 @@ export class ConfigUI extends SceneFeature { }; // Torches Toggle - createToggle('Stage Torches', 'torchesEnabled', (enabled) => { - const torches = sceneFeatureManager.features.find(f => f.constructor.name === 'StageTorches'); - if (torches && torches.group) torches.group.visible = enabled; - }); + createToggle('Stage Torches', 'torchesEnabled'); // Lasers Toggle createToggle('Lasers', 'lasersEnabled'); diff --git a/party-stage/src/scene/stage-torches.js b/party-stage/src/scene/stage-torches.js index 9ca5c0b..474019a 100644 --- a/party-stage/src/scene/stage-torches.js +++ b/party-stage/src/scene/stage-torches.js @@ -38,7 +38,7 @@ export class StageTorches extends SceneFeature { createTorch(position) { const torchGroup = new THREE.Group(); torchGroup.position.copy(position); - torchGroup.visible = false; // Start invisible + torchGroup.visible = state.config.torchesEnabled; // --- Torch Holder --- const holderMaterial = new THREE.MeshStandardMaterial({ color: 0x333333, roughness: 0.6, metalness: 0.5 }); @@ -55,6 +55,7 @@ export class StageTorches extends SceneFeature { pointLight.castShadow = true; pointLight.shadow.mapSize.width = 128; pointLight.shadow.mapSize.height = 128; + pointLight.visible = false; torchGroup.add(pointLight); // --- Particle System for Fire --- @@ -82,6 +83,7 @@ export class StageTorches extends SceneFeature { } particles.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); const particleSystem = new THREE.Points(particles, particleMaterial); + particleSystem.visible = false; torchGroup.add(particleSystem); return { group: torchGroup, light: pointLight, particles: particleSystem, particleData: particleData }; @@ -102,9 +104,25 @@ export class StageTorches extends SceneFeature { } update(deltaTime) { - if (!state.partyStarted) return; + const enabled = state.config.torchesEnabled; + this.torches.forEach(torch => { + if (torch.group.visible !== enabled) torch.group.visible = enabled; + }); + + if (!enabled) return; + + if (!state.partyStarted) { + this.torches.forEach(torch => { + if (torch.light.visible) torch.light.visible = false; + if (torch.particles.visible) torch.particles.visible = false; + }); + return; + } this.torches.forEach(torch => { + if (!torch.light.visible) torch.light.visible = true; + if (!torch.particles.visible) torch.particles.visible = true; + let measurePulse = 0; if (state.music) { measurePulse = state.music.measurePulse * 2.0; // Make flames jump higher @@ -156,8 +174,14 @@ export class StageTorches extends SceneFeature { onPartyStart() { this.torches.forEach(torch => { - torch.group.visible = true; - this.resetParticles(torch); + if (state.config.torchesEnabled) { + torch.group.visible = true; + torch.light.visible = true; + torch.particles.visible = true; + this.resetParticles(torch); + } else { + torch.group.visible = false; + } }); }