mirror of
https://github.com/tiennm99/nntv.git
synced 2026-10-16 06:14:38 +00:00
feat(audio): wire door-unlock cue on locked-door count delta
Adds a reactive effect that fires playDoorUnlock when the count of locked doors decreases — i.e. when player.moveTo opens a door with a matching key. Mirrors the existing keysHeld delta pattern. Closes the door-audio gap documented in plans/260425-1907-tight-12-design-uplift/.
This commit is contained in:
1 parent
305d904613
commit
88a5c973f3
1 file changed
+10
-1
+10
-1
@@ -91,10 +91,11 @@
|
||||
// HUD reactive values
|
||||
let stonesLeft = $derived((renderVersion, throwSystem ? throwSystem.stonesLeft : 0));
|
||||
let keysHeld = $derived((renderVersion, player ? player.getKeysHeld() : 0));
|
||||
let lockedDoorCount = $derived((renderVersion, grid ? grid.getDoorSnapshot().length : 0));
|
||||
|
||||
// Audio delta tracking — previous values to detect changes each render
|
||||
let _prevKeysHeld = $state(0);
|
||||
let _prevOpenDoors = $state(0); // count of open doors tracked via grid cell flags
|
||||
let _prevLockedDoorCount = $state(0);
|
||||
let _prevSuspicionTier = $state(0); // highest suspicion tier across guards
|
||||
|
||||
// Fire key-pickup / door-unlock / suspicion audio on state changes
|
||||
@@ -106,6 +107,14 @@
|
||||
_prevKeysHeld = keysHeld;
|
||||
});
|
||||
|
||||
// Doors: locked-door count drops when player traverses with matching key
|
||||
$effect(() => {
|
||||
if (lockedDoorCount < _prevLockedDoorCount) {
|
||||
playDoorUnlock();
|
||||
}
|
||||
_prevLockedDoorCount = lockedDoorCount;
|
||||
});
|
||||
|
||||
// Suspicion guard tier monitoring
|
||||
$effect(() => {
|
||||
if (!guards || guards.length === 0) return;
|
||||
|
||||
Reference in new issue
Block a user