From 27af368cfa397c29e2365d6954719a44be2125db Mon Sep 17 00:00:00 2001 From: rjnetwork212 <199301945+rjnetwork212@users.noreply.github.com> Date: Sun, 1 Nov 2026 11:22:53 +0100 Subject: [PATCH] Keep clearing room fog from the office seen from the rooftop (#392) Sky.setRoof zeroed skyClearRooms and skyInside together, so on the roof office/garage fragments got the full outdoor haze even though the interior below is still indoor. Zero only skyInside (lamplight) there; leave skyClearRooms at 1 unless an enclosed map is in play. setIndoors still zeroes both. --- src/client/world/sky.ts | 3 ++- tests/sky-fog.test.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/world/sky.ts b/src/client/world/sky.ts index b1ffb22b6..09b8837b7 100644 --- a/src/client/world/sky.ts +++ b/src/client/world/sky.ts @@ -581,7 +581,8 @@ export class Sky { setRoof(on: boolean, drop = 0) { this.roof = on; this.roofStreet = -drop; - uniforms.skyInside.value = uniforms.skyClearRooms.value = on || this.indoors ? 0 : 1; + uniforms.skyInside.value = on || this.indoors ? 0 : 1; + uniforms.skyClearRooms.value = this.indoors ? 0 : 1; } /** diff --git a/tests/sky-fog.test.ts b/tests/sky-fog.test.ts index 2fda1e093..cd40d23ab 100644 --- a/tests/sky-fog.test.ts +++ b/tests/sky-fog.test.ts @@ -48,17 +48,20 @@ test('unlit fogged materials get the same indoor fog clearing', () => { assert.ok('skyWing' in shader.uniforms); }); -test('room fog clearing is enabled for office floors, the garage and street, but not other maps or the roof', () => { +test('room fog clearing is enabled for office floors, the garage and street, and kept on the roof, but not other maps', () => { const shader = compile(new THREE.MeshBasicMaterial({ fog: true })); const clearRooms = () => (shader.uniforms.skyClearRooms as { value: number }).value; + const inside = () => (shader.uniforms.skyInside as { value: number }).value; const sky = { roof: false, indoors: false, roofStreet: 0 } as unknown as Sky; Sky.prototype.setIndoors.call(sky, false); Sky.prototype.setRoof.call(sky, false); assert.equal(clearRooms(), 1, 'office floors, garage and street clear fog from room fragments'); Sky.prototype.setRoof.call(sky, true); - assert.equal(clearRooms(), 0, 'the rooftop is outdoors, so its fog stays whole'); + assert.equal(clearRooms(), 1, 'the rooftop stays outdoors but keeps clearing fog from the office interior below'); + assert.equal(inside(), 0, 'the rooftop takes no lamplight from the office under your feet'); Sky.prototype.setRoof.call(sky, false); assert.equal(clearRooms(), 1, 'returning from the roof to the office re-enables room clearing'); Sky.prototype.setIndoors.call(sky, true); assert.equal(clearRooms(), 0, 'enclosed alternate maps do not use the office room boxes to clear fog'); + assert.equal(inside(), 0, 'enclosed alternate maps take no office lamplight either'); });