diff --git a/src/components/Effects.vue b/src/components/Effects.vue index 7f01e48..29c5749 100644 --- a/src/components/Effects.vue +++ b/src/components/Effects.vue @@ -76,20 +76,21 @@ const initializeEffects = (scene: Phaser.Scene) => { // Effect updates const updateScene = () => { const timeBasedLight = calculateLightStrength(gameStore.world.date) + const defaultEffects = { + light: timeBasedLight, + rain: weatherState.value.isRainEnabled ? weatherState.value.rainPercentage : 0, + fog: weatherState.value.isFogEnabled ? weatherState.value.fogDensity * 100 : 0 + } + const zoneEffects = zoneStore.zone?.zoneEffects?.reduce((acc, curr) => ({ ...acc, [curr.effect]: curr.strength }), {}) as { [key: string]: number } - if (zoneEffects && Object.keys(zoneEffects).length) { - applyEffects(zoneEffects) - } else { - applyEffects({ - light: timeBasedLight, - rain: weatherState.value.isRainEnabled ? weatherState.value.rainPercentage : 0, - fog: weatherState.value.isFogEnabled ? weatherState.value.fogDensity * 100 : 0 - }) - } + applyEffects({ + ...defaultEffects, + ...(zoneEffects || {}) + }) } const applyEffects = (effectValues: any) => {