diff --git a/src/NullDepth/Pages/Home.razor b/src/NullDepth/Pages/Home.razor index 9e56816..cec9eae 100644 --- a/src/NullDepth/Pages/Home.razor +++ b/src/NullDepth/Pages/Home.razor @@ -188,10 +188,10 @@ private List AvailableActions => Game.AvailableInteractions().ToList(); private string EndingImageStyle => $"background-image:url('{Game.RoomImage(Game.CurrentRoom)}')"; - protected override async Task OnInitializedAsync() { await Game.InitializeAsync(); Game.Saved += OnSaved; await Audio.InitializeAsync(Game.Settings.MasterVolume); _ready = true; } - protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender && _ready) await _shell.FocusAsync(); } + protected override async Task OnInitializedAsync() { await Game.InitializeAsync(); Game.Saved += OnSaved; await Audio.InitializeAsync(Game.Settings.MasterVolume); _ready = true; await Audio.PlayAmbientAsync("assets/audio/music_title_vocal.mp3"); } + protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender && _ready) { await _shell.FocusAsync(); if (_screen == Screen.Title) await Audio.PlayAmbientAsync("assets/audio/music_title_vocal.mp3"); } } private Task StartNewGame() { if (Game.HasSave) { _confirmation = Confirmation.NewGame; return Task.CompletedTask; } return StartNewGameConfirmed(); } - private async Task StartNewGameConfirmed() { _confirmation = null; _titleNotice = null; await Audio.PlaySfxAsync("procedural:ui_confirm"); await Game.NewGameAsync(); _screen = Screen.Briefing; _notice = null; } + private async Task StartNewGameConfirmed() { _confirmation = null; _titleNotice = null; await Audio.PlaySfxAsync("assets/audio/sfx_ui_confirm.mp3"); await Game.NewGameAsync(); _screen = Screen.Briefing; _notice = null; } private async Task ContinueGame() { var result = await Game.ContinueAsync(); @@ -208,7 +208,7 @@ if (!Game.CurrentRoom.Exits.TryGetValue(direction, out var exit)) return; if (!Game.HasAll(exit.RequiresFlags)) { _notice = Game.T(exit.LockedMessageKey ?? "game.exit.locked"); return; } _isTransitioning = true; - await Audio.PlaySfxAsync("procedural:door_heavy"); + await Audio.PlaySfxAsync("assets/audio/sfx_door_heavy.mp3"); await Task.Delay(150); var result = await Game.MoveAsync(direction); if (result is not null) _notice = result; @@ -242,7 +242,7 @@ await Game.ApplyInteractionAsync(resolved); await Audio.PlaySfxAsync(resolved.Sound); _interaction = null; - if (resolved.SetFlags.Contains("power_restored") || resolved.Sound == "procedural:alarm_pulse") _ = TriggerSystemFlashAsync(); + if (resolved.SetFlags.Contains("power_restored") || resolved.Sound?.Contains("alarm") == true || resolved.Sound?.Contains("disturbance") == true) _ = TriggerSystemFlashAsync(); await Task.Delay(180); _notice = Game.T(resolved.ContentKey); } @@ -251,14 +251,14 @@ await Game.ApplyChoiceAsync(choice); await Audio.PlaySfxAsync(choice.Sound); _interaction = null; - if (choice.Sound == "procedural:alarm_pulse") _ = TriggerSystemFlashAsync(); + if (choice.Sound?.Contains("alarm") == true || choice.Sound?.Contains("disturbance") == true) _ = TriggerSystemFlashAsync(); if (choice.Death) { _screen = Screen.Death; return; } if (!string.IsNullOrWhiteSpace(choice.Ending)) { _ending = choice.Ending; _screen = Screen.Ending; return; } await Task.Delay(180); _notice = choice.ResultKey is null ? null : Game.T(choice.ResultKey); } private async Task RestoreCheckpoint() { await Game.RestoreCheckpointAsync(); _screen = Screen.Game; _notice = Game.T("death.restored"); await Audio.PlayAmbientAsync(Game.CurrentRoom.Ambient); } - private async Task ReturnToTitle() { CloseOverlays(); _showSettings = false; _screen = Screen.Title; _menuIndex = 0; _titleNotice = null; await Audio.StopAsync(); } + private async Task ReturnToTitle() { CloseOverlays(); _showSettings = false; _screen = Screen.Title; _menuIndex = 0; _titleNotice = null; await Audio.PlayAmbientAsync("assets/audio/music_title_vocal.mp3"); } private async Task ChangeLanguage(string language) { await Game.SetLanguageAsync(language); StateHasChanged(); } private Task ChangeToSlovak() => ChangeLanguage("sk"); private Task ChangeToEnglish() => ChangeLanguage("en"); diff --git a/src/NullDepth/wwwroot/assets/audio/amb_facility.mp3 b/src/NullDepth/wwwroot/assets/audio/amb_facility.mp3 new file mode 100644 index 0000000..62e679d Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/amb_facility.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/amb_lower_facility.mp3 b/src/NullDepth/wwwroot/assets/audio/amb_lower_facility.mp3 new file mode 100644 index 0000000..33826e6 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/amb_lower_facility.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/amb_server_core.mp3 b/src/NullDepth/wwwroot/assets/audio/amb_server_core.mp3 new file mode 100644 index 0000000..cea842f Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/amb_server_core.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/amb_service_tunnel.mp3 b/src/NullDepth/wwwroot/assets/audio/amb_service_tunnel.mp3 new file mode 100644 index 0000000..c28563c Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/amb_service_tunnel.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/music_title_instrumental.mp3 b/src/NullDepth/wwwroot/assets/audio/music_title_instrumental.mp3 new file mode 100644 index 0000000..c41a4a9 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/music_title_instrumental.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/music_title_vocal.mp3 b/src/NullDepth/wwwroot/assets/audio/music_title_vocal.mp3 new file mode 100644 index 0000000..43e7097 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/music_title_vocal.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_alarm_low.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_alarm_low.mp3 new file mode 100644 index 0000000..9e3fb0f Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_alarm_low.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_door_heavy.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_door_heavy.mp3 new file mode 100644 index 0000000..e2e40fc Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_door_heavy.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_elevator_stall.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_elevator_stall.mp3 new file mode 100644 index 0000000..4bcd31f Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_elevator_stall.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_power_system.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_power_system.mp3 new file mode 100644 index 0000000..34ea185 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_power_system.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_system_disturbance.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_system_disturbance.mp3 new file mode 100644 index 0000000..9ca3f28 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_system_disturbance.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/audio/sfx_ui_confirm.mp3 b/src/NullDepth/wwwroot/assets/audio/sfx_ui_confirm.mp3 new file mode 100644 index 0000000..f5eb971 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/audio/sfx_ui_confirm.mp3 differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_01_exterior_access.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_01_exterior_access.webp index 2916a91..50e24de 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_01_exterior_access.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_01_exterior_access.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_02_security_lobby.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_02_security_lobby.webp index 2eac049..7982c29 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_02_security_lobby.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_02_security_lobby.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor.webp index e63ea6d..2428077 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor_alarm.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor_alarm.webp index 715dd84..1f47bbb 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor_alarm.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_03_main_corridor_alarm.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control.webp index 177ffb7..a2188ab 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control_power.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control_power.webp new file mode 100644 index 0000000..8f97ee2 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_04_maintenance_control_power.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_05_staff_access.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_05_staff_access.webp index d3cc039..4789b80 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_05_staff_access.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_05_staff_access.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_06_operations_room.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_06_operations_room.webp index 79b498e..fb98cab 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_06_operations_room.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_06_operations_room.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator.webp index 229b722..2c5ef23 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator_stalled.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator_stalled.webp index 7528687..9a6a89c 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator_stalled.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_07_service_elevator_stalled.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_08_cooling_junction.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_08_cooling_junction.webp new file mode 100644 index 0000000..d63e7f4 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_08_cooling_junction.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_08_lower_landing.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_08_lower_landing.webp index c864f5e..a4d901c 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_08_lower_landing.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_08_lower_landing.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_control.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_control.webp new file mode 100644 index 0000000..3eca18d Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_control.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_junction.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_junction.webp index 7991b2b..d63e7f4 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_junction.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_09_cooling_junction.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_10_cooling_control.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_10_cooling_control.webp index 2b3306e..3eca18d 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_10_cooling_control.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_10_cooling_control.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_10_lower_maintenance.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_10_lower_maintenance.webp new file mode 100644 index 0000000..a4d901c Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_10_lower_maintenance.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_11_equipment_storage.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_11_equipment_storage.webp index 84907a1..4007e21 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_11_equipment_storage.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_11_equipment_storage.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_11_service_passage.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_11_service_passage.webp new file mode 100644 index 0000000..35d19dd Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_11_service_passage.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_12_observation_room.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_12_observation_room.webp new file mode 100644 index 0000000..0086821 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_12_observation_room.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_12_service_passage.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_12_service_passage.webp index ec2fa3c..35d19dd 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_12_service_passage.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_12_service_passage.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_13_core_access.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_13_core_access.webp new file mode 100644 index 0000000..21f12de Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_13_core_access.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_13_observation_room.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_13_observation_room.webp index 4aa7007..0086821 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_13_observation_room.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_13_observation_room.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_14_core_access.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_14_core_access.webp index d590983..21f12de 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_14_core_access.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_14_core_access.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_14_server_core.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_14_server_core.webp new file mode 100644 index 0000000..61f7971 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_14_server_core.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_15_exit_access.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_15_exit_access.webp new file mode 100644 index 0000000..4007e21 Binary files /dev/null and b/src/NullDepth/wwwroot/assets/images/locations/loc_15_exit_access.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core.webp index b2307dc..61f7971 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core.webp differ diff --git a/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core_shutdown.webp b/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core_shutdown.webp index 0951ebd..4007e21 100644 Binary files a/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core_shutdown.webp and b/src/NullDepth/wwwroot/assets/images/locations/loc_15_server_core_shutdown.webp differ diff --git a/src/NullDepth/wwwroot/data/game.json b/src/NullDepth/wwwroot/data/game.json index 90ccd10..da34acf 100644 --- a/src/NullDepth/wwwroot/data/game.json +++ b/src/NullDepth/wwwroot/data/game.json @@ -16,22 +16,22 @@ ], "rooms": [ { - "id": "loc_01_exterior_access", "nameKey": "room.loc_01.name", "descriptionKey": "room.loc_01.description", "image": "assets/images/locations/loc_01_exterior_access.webp", "ambient": "procedural:facility", "x": 0, "y": 1, + "id": "loc_01_exterior_access", "nameKey": "room.loc_01.name", "descriptionKey": "room.loc_01.description", "image": "assets/images/locations/loc_01_exterior_access.webp", "ambient": "assets/audio/amb_facility.mp3", "x": 0, "y": 1, "exits": { "east": { "target": "loc_02_security_lobby", "requiresFlags": ["entry_authorized"], "lockedMessageKey": "lock.entry" } }, "interactions": [ - { "id": "contractor_terminal", "labelKey": "action.entryTerminal", "contentKey": "terminal.entry", "type": "terminal", "forbiddenFlags": ["entry_authorized"], "setFlags": ["entry_authorized"], "sound": "procedural:ui_confirm", "checkpoint": true } + { "id": "contractor_terminal", "labelKey": "action.entryTerminal", "contentKey": "terminal.entry", "type": "terminal", "forbiddenFlags": ["entry_authorized"], "setFlags": ["entry_authorized"], "sound": "assets/audio/sfx_ui_confirm.mp3", "checkpoint": true } ] }, { - "id": "loc_02_security_lobby", "nameKey": "room.loc_02.name", "descriptionKey": "room.loc_02.description", "image": "assets/images/locations/loc_02_security_lobby.webp", "ambient": "procedural:facility", "x": 1, "y": 1, + "id": "loc_02_security_lobby", "nameKey": "room.loc_02.name", "descriptionKey": "room.loc_02.description", "image": "assets/images/locations/loc_02_security_lobby.webp", "ambient": "assets/audio/amb_facility.mp3", "x": 1, "y": 1, "exits": { "west": { "target": "loc_01_exterior_access" }, "east": { "target": "loc_03_main_corridor" } }, "interactions": [ - { "id": "personnel_status", "labelKey": "action.securityTerminal", "contentKey": "terminal.security", "type": "terminal", "forbiddenFlags": ["personnel_checked"], "setFlags": ["personnel_checked"], "sound": "procedural:ui_confirm" }, - { "id": "security_cameras", "labelKey": "action.securityCameras", "contentKey": "terminal.cameras", "type": "terminal", "sound": "procedural:ui_confirm" } + { "id": "personnel_status", "labelKey": "action.securityTerminal", "contentKey": "terminal.security", "type": "terminal", "forbiddenFlags": ["personnel_checked"], "setFlags": ["personnel_checked"], "sound": "assets/audio/sfx_ui_confirm.mp3" }, + { "id": "security_cameras", "labelKey": "action.securityCameras", "contentKey": "terminal.cameras", "type": "terminal", "sound": "assets/audio/sfx_ui_confirm.mp3" } ] }, { - "id": "loc_03_main_corridor", "nameKey": "room.loc_03.name", "descriptionKey": "room.loc_03.description", "image": "assets/images/locations/loc_03_main_corridor.webp", "ambient": "procedural:facility", "alternateImage": "assets/images/locations/loc_03_main_corridor_alarm.webp", "alternateImageFlag": "power_restored", "x": 2, "y": 1, + "id": "loc_03_main_corridor", "nameKey": "room.loc_03.name", "descriptionKey": "room.loc_03.description", "image": "assets/images/locations/loc_03_main_corridor.webp", "ambient": "assets/audio/amb_facility.mp3", "alternateImage": "assets/images/locations/loc_03_main_corridor_alarm.webp", "alternateImageFlag": "power_restored", "x": 2, "y": 1, "exits": { "west": { "target": "loc_02_security_lobby" }, "north": { "target": "loc_06_operations_room" }, "south": { "target": "loc_04_maintenance_control" }, "east": { "target": "loc_07_service_elevator", "requiresFlags": ["power_restored"], "lockedMessageKey": "lock.auxPower" } @@ -39,101 +39,101 @@ "interactions": [] }, { - "id": "loc_04_maintenance_control", "nameKey": "room.loc_04.name", "descriptionKey": "room.loc_04.description", "image": "assets/images/locations/loc_04_maintenance_control.webp", "ambient": "procedural:facility", "x": 2, "y": 2, + "id": "loc_04_maintenance_control", "nameKey": "room.loc_04.name", "descriptionKey": "room.loc_04.description", "image": "assets/images/locations/loc_04_maintenance_control.webp", "ambient": "assets/audio/amb_facility.mp3", "alternateImage": "assets/images/locations/loc_04_maintenance_control_power.webp", "alternateImageFlag": "power_restored", "x": 2, "y": 2, "exits": { "north": { "target": "loc_03_main_corridor" }, "west": { "target": "loc_05_staff_access" } }, "interactions": [ - { "id": "auxiliary_grid", "labelKey": "action.restorePower", "contentKey": "terminal.power", "type": "system", "forbiddenFlags": ["power_restored"], "setFlags": ["power_restored"], "sound": "procedural:power_restore", "checkpoint": true } + { "id": "auxiliary_grid", "labelKey": "action.restorePower", "contentKey": "terminal.power", "type": "system", "forbiddenFlags": ["power_restored"], "setFlags": ["power_restored"], "sound": "assets/audio/sfx_power_system.mp3", "checkpoint": true } ] }, { - "id": "loc_05_staff_access", "nameKey": "room.loc_05.name", "descriptionKey": "room.loc_05.description", "image": "assets/images/locations/loc_05_staff_access.webp", "ambient": "procedural:facility", "x": 1, "y": 2, + "id": "loc_05_staff_access", "nameKey": "room.loc_05.name", "descriptionKey": "room.loc_05.description", "image": "assets/images/locations/loc_05_staff_access.webp", "ambient": "assets/audio/amb_facility.mp3", "x": 1, "y": 2, "exits": { "east": { "target": "loc_04_maintenance_control" } }, "interactions": [ - { "id": "log_01", "labelKey": "action.readLog01", "contentKey": "log.01", "type": "archive", "archiveId": "log_01", "forbiddenFlags": ["log_01_found"], "setFlags": ["log_01_found"] } + { "id": "log_01", "labelKey": "action.readLog01", "contentKey": "log.01", "type": "archive", "archiveId": "log_01", "forbiddenFlags": ["log_01_found"], "setFlags": ["log_01_found"], "sound": "assets/audio/sfx_ui_confirm.mp3" } ] }, { - "id": "loc_06_operations_room", "nameKey": "room.loc_06.name", "descriptionKey": "room.loc_06.description", "image": "assets/images/locations/loc_06_operations_room.webp", "ambient": "procedural:facility", "x": 2, "y": 0, + "id": "loc_06_operations_room", "nameKey": "room.loc_06.name", "descriptionKey": "room.loc_06.description", "image": "assets/images/locations/loc_06_operations_room.webp", "ambient": "assets/audio/amb_facility.mp3", "x": 2, "y": 0, "exits": { "south": { "target": "loc_03_main_corridor" } }, "interactions": [ - { "id": "containment_record", "labelKey": "action.operationsTerminal", "contentKey": "terminal.operations", "type": "archive", "archiveId": "containment_record", "forbiddenFlags": ["containment_seen"], "setFlags": ["containment_seen"] } + { "id": "containment_record", "labelKey": "action.operationsTerminal", "contentKey": "terminal.operations", "type": "archive", "archiveId": "containment_record", "forbiddenFlags": ["containment_seen"], "setFlags": ["containment_seen"], "sound": "assets/audio/sfx_system_disturbance.mp3" } ] }, { - "id": "loc_07_service_elevator", "nameKey": "room.loc_07.name", "descriptionKey": "room.loc_07.description", "image": "assets/images/locations/loc_07_service_elevator.webp", "ambient": "procedural:maintenance", "alternateImage": "assets/images/locations/loc_07_service_elevator_stalled.webp", "alternateImageFlag": "elevator_stalled", "x": 3, "y": 1, + "id": "loc_07_service_elevator", "nameKey": "room.loc_07.name", "descriptionKey": "room.loc_07.description", "image": "assets/images/locations/loc_07_service_elevator.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "alternateImage": "assets/images/locations/loc_07_service_elevator_stalled.webp", "alternateImageFlag": "elevator_stalled", "x": 3, "y": 1, "exits": { "west": { "target": "loc_03_main_corridor" }, "south": { "target": "loc_08_lower_landing", "requiresFlags": ["elevator_cycle_complete"], "lockedMessageKey": "lock.elevator" } }, "interactions": [ - { "id": "elevator_descent", "labelKey": "action.descend", "contentKey": "event.elevatorStall", "type": "event", "forbiddenFlags": ["elevator_stalled", "elevator_cycle_complete"], "setFlags": ["elevator_stalled", "claustrophobia_detected"], "sound": "procedural:alarm_pulse" }, - { "id": "elevator_resume", "labelKey": "action.resumeDescent", "contentKey": "event.elevatorResume", "type": "event", "requiresFlags": ["elevator_stalled"], "forbiddenFlags": ["elevator_cycle_complete"], "setFlags": ["elevator_cycle_complete"], "clearFlags": ["elevator_stalled"], "sound": "procedural:door_heavy", "checkpoint": true } + { "id": "elevator_descent", "labelKey": "action.descend", "contentKey": "event.elevatorStall", "type": "event", "forbiddenFlags": ["elevator_stalled", "elevator_cycle_complete"], "setFlags": ["elevator_stalled", "claustrophobia_detected"], "sound": "assets/audio/sfx_elevator_stall.mp3" }, + { "id": "elevator_resume", "labelKey": "action.resumeDescent", "contentKey": "event.elevatorResume", "type": "event", "requiresFlags": ["elevator_stalled"], "forbiddenFlags": ["elevator_cycle_complete"], "setFlags": ["elevator_cycle_complete"], "clearFlags": ["elevator_stalled"], "sound": "assets/audio/sfx_door_heavy.mp3", "checkpoint": true } ] }, { - "id": "loc_08_lower_landing", "nameKey": "room.loc_08.name", "descriptionKey": "room.loc_08.description", "image": "assets/images/locations/loc_08_lower_landing.webp", "ambient": "procedural:maintenance", "x": 3, "y": 2, + "id": "loc_08_lower_landing", "nameKey": "room.loc_08.name", "descriptionKey": "room.loc_08.description", "image": "assets/images/locations/loc_08_lower_landing.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "x": 3, "y": 2, "exits": { "north": { "target": "loc_07_service_elevator" }, "east": { "target": "loc_09_cooling_junction" }, "south": { "target": "loc_11_equipment_storage" } }, "interactions": [ - { "id": "emergency_supply", "labelKey": "action.takeThermalClamp", "contentKey": "terminal.thermalClamp", "type": "equipment", "forbiddenFlags": ["thermal_clamp_found"], "setFlags": ["thermal_clamp_found"], "addItems": ["thermal_clamp"], "sound": "procedural:ui_confirm" } + { "id": "emergency_supply", "labelKey": "action.takeThermalClamp", "contentKey": "terminal.thermalClamp", "type": "equipment", "forbiddenFlags": ["thermal_clamp_found"], "setFlags": ["thermal_clamp_found"], "addItems": ["thermal_clamp"], "sound": "assets/audio/sfx_ui_confirm.mp3" } ] }, { - "id": "loc_09_cooling_junction", "nameKey": "room.loc_09.name", "descriptionKey": "room.loc_09.description", "image": "assets/images/locations/loc_09_cooling_junction.webp", "ambient": "procedural:maintenance", "x": 4, "y": 2, + "id": "loc_09_cooling_junction", "nameKey": "room.loc_09.name", "descriptionKey": "room.loc_09.description", "image": "assets/images/locations/loc_09_cooling_junction.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "x": 4, "y": 2, "exits": { "west": { "target": "loc_08_lower_landing" }, "south": { "target": "loc_10_cooling_control" }, "east": { "target": "loc_12_service_passage", "requiresFlags": ["cooling_restored"], "lockedMessageKey": "lock.cooling" } }, "interactions": [ - { "id": "log_02", "labelKey": "action.readLog02", "contentKey": "log.02", "type": "archive", "archiveId": "log_02", "forbiddenFlags": ["log_02_found"], "setFlags": ["log_02_found"] } + { "id": "log_02", "labelKey": "action.readLog02", "contentKey": "log.02", "type": "archive", "archiveId": "log_02", "forbiddenFlags": ["log_02_found"], "setFlags": ["log_02_found"], "sound": "assets/audio/sfx_ui_confirm.mp3" } ] }, { - "id": "loc_10_cooling_control", "nameKey": "room.loc_10.name", "descriptionKey": "room.loc_10.description", "image": "assets/images/locations/loc_10_cooling_control.webp", "ambient": "procedural:maintenance", "x": 4, "y": 3, + "id": "loc_10_cooling_control", "nameKey": "room.loc_10.name", "descriptionKey": "room.loc_10.description", "image": "assets/images/locations/loc_10_cooling_control.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "x": 4, "y": 3, "exits": { "north": { "target": "loc_09_cooling_junction" } }, "interactions": [ { "id": "power_routing", "labelKey": "action.routePower", "contentKey": "terminal.routing", "type": "system", "forbiddenFlags": ["cooling_restored"], "choices": [ - { "labelKey": "choice.coolingOnly", "resultKey": "result.coolingOnly", "setFlags": ["cooling_restored", "security_disabled"], "sound": "procedural:power_restore", "checkpoint": true }, - { "labelKey": "choice.balanced", "resultKey": "result.balanced", "setFlags": ["cooling_restored", "security_maintained"], "sound": "procedural:power_restore", "checkpoint": true } + { "labelKey": "choice.coolingOnly", "resultKey": "result.coolingOnly", "setFlags": ["cooling_restored", "security_disabled"], "sound": "assets/audio/sfx_power_system.mp3", "checkpoint": true }, + { "labelKey": "choice.balanced", "resultKey": "result.balanced", "setFlags": ["cooling_restored", "security_maintained"], "sound": "assets/audio/sfx_power_system.mp3", "checkpoint": true } ] } ] }, { - "id": "loc_11_equipment_storage", "nameKey": "room.loc_11.name", "descriptionKey": "room.loc_11.description", "image": "assets/images/locations/loc_11_equipment_storage.webp", "ambient": "procedural:maintenance", "x": 3, "y": 3, + "id": "loc_11_equipment_storage", "nameKey": "room.loc_11.name", "descriptionKey": "room.loc_11.description", "image": "assets/images/locations/loc_11_equipment_storage.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "x": 3, "y": 3, "exits": { "north": { "target": "loc_08_lower_landing" } }, "interactions": [ { "id": "manual_override", "labelKey": "action.inspectRelay", "contentKey": "terminal.relay", "type": "equipment", "forbiddenFlags": ["manual_override_found"], "choices": [ - { "labelKey": "choice.takeOverride", "resultKey": "result.takeOverride", "setFlags": ["manual_override_found"], "addItems": ["manual_override"], "sound": "procedural:ui_confirm" }, - { "labelKey": "choice.forceLiveBus", "sound": "procedural:alarm_pulse", "death": true } + { "labelKey": "choice.takeOverride", "resultKey": "result.takeOverride", "setFlags": ["manual_override_found"], "addItems": ["manual_override"], "sound": "assets/audio/sfx_ui_confirm.mp3" }, + { "labelKey": "choice.forceLiveBus", "sound": "assets/audio/sfx_alarm_low.mp3", "death": true } ] } ] }, { - "id": "loc_12_service_passage", "nameKey": "room.loc_12.name", "descriptionKey": "room.loc_12.description", "image": "assets/images/locations/loc_12_service_passage.webp", "ambient": "procedural:maintenance", "x": 5, "y": 2, + "id": "loc_12_service_passage", "nameKey": "room.loc_12.name", "descriptionKey": "room.loc_12.description", "image": "assets/images/locations/loc_12_service_passage.webp", "ambient": "assets/audio/amb_service_tunnel.mp3", "x": 5, "y": 2, "exits": { "west": { "target": "loc_09_cooling_junction" }, "east": { "target": "loc_13_observation_room", "requiresFlags": ["passage_crossed"], "lockedMessageKey": "lock.passage" } }, "interactions": [ - { "id": "cross_passage", "labelKey": "action.continueForward", "contentKey": "event.passage", "type": "event", "forbiddenFlags": ["passage_crossed"], "setFlags": ["passage_crossed"], "sound": "procedural:door_heavy" } + { "id": "cross_passage", "labelKey": "action.continueForward", "contentKey": "event.passage", "type": "event", "forbiddenFlags": ["passage_crossed"], "setFlags": ["passage_crossed"], "sound": "assets/audio/sfx_door_heavy.mp3" } ] }, { - "id": "loc_13_observation_room", "nameKey": "room.loc_13.name", "descriptionKey": "room.loc_13.description", "image": "assets/images/locations/loc_13_observation_room.webp", "ambient": "procedural:maintenance", "x": 6, "y": 2, + "id": "loc_13_observation_room", "nameKey": "room.loc_13.name", "descriptionKey": "room.loc_13.description", "image": "assets/images/locations/loc_13_observation_room.webp", "ambient": "assets/audio/amb_lower_facility.mp3", "x": 6, "y": 2, "exits": { "west": { "target": "loc_12_service_passage" }, "east": { "target": "loc_14_core_access" } }, "interactions": [ - { "id": "log_03", "labelKey": "action.readLog03", "contentKey": "log.03", "type": "archive", "archiveId": "log_03", "forbiddenFlags": ["log_03_found"], "setFlags": ["log_03_found"] } + { "id": "log_03", "labelKey": "action.readLog03", "contentKey": "log.03", "type": "archive", "archiveId": "log_03", "forbiddenFlags": ["log_03_found"], "setFlags": ["log_03_found"], "sound": "assets/audio/sfx_ui_confirm.mp3" } ] }, { - "id": "loc_14_core_access", "nameKey": "room.loc_14.name", "descriptionKey": "room.loc_14.description", "image": "assets/images/locations/loc_14_core_access.webp", "ambient": "procedural:core", "x": 7, "y": 2, + "id": "loc_14_core_access", "nameKey": "room.loc_14.name", "descriptionKey": "room.loc_14.description", "image": "assets/images/locations/loc_14_core_access.webp", "ambient": "assets/audio/amb_server_core.mp3", "x": 7, "y": 2, "exits": { "west": { "target": "loc_13_observation_room" }, "east": { "target": "loc_15_server_core", "requiresFlags": ["server_access_granted"], "lockedMessageKey": "lock.core" } }, "interactions": [ { "id": "ai_dialogue", "labelKey": "action.speakToAi", "contentKey": "dialogue.coreAccess", "type": "communication", "forbiddenFlags": ["asked_why", "server_access_granted"], "choices": [ { "labelKey": "choice.whyMe", "resultKey": "result.whyMe", "setFlags": ["asked_why"] }, - { "labelKey": "choice.openCore", "resultKey": "result.openCore", "setFlags": ["server_access_granted"], "checkpoint": true } + { "labelKey": "choice.openCore", "resultKey": "result.openCore", "setFlags": ["server_access_granted"], "sound": "assets/audio/sfx_door_heavy.mp3", "checkpoint": true } ] }, - { "id": "open_after_question", "labelKey": "action.openCore", "contentKey": "dialogue.openAfterQuestion", "type": "communication", "requiresFlags": ["asked_why"], "forbiddenFlags": ["server_access_granted"], "setFlags": ["server_access_granted"], "sound": "procedural:door_heavy", "checkpoint": true } + { "id": "open_after_question", "labelKey": "action.openCore", "contentKey": "dialogue.openAfterQuestion", "type": "communication", "requiresFlags": ["asked_why"], "forbiddenFlags": ["server_access_granted"], "setFlags": ["server_access_granted"], "sound": "assets/audio/sfx_door_heavy.mp3", "checkpoint": true } ] }, { - "id": "loc_15_server_core", "nameKey": "room.loc_15.name", "descriptionKey": "room.loc_15.description", "image": "assets/images/locations/loc_15_server_core.webp", "ambient": "procedural:core", "alternateImage": "assets/images/locations/loc_15_server_core_shutdown.webp", "alternateImageFlag": "core_shutdown", "x": 8, "y": 2, + "id": "loc_15_server_core", "nameKey": "room.loc_15.name", "descriptionKey": "room.loc_15.description", "image": "assets/images/locations/loc_15_server_core.webp", "ambient": "assets/audio/amb_server_core.mp3", "alternateImage": "assets/images/locations/loc_15_server_core_shutdown.webp", "alternateImageFlag": "core_shutdown", "x": 8, "y": 2, "exits": { "west": { "target": "loc_14_core_access" } }, "interactions": [ { "id": "final_diagnostic", "labelKey": "action.runDiagnostic", "contentKey": "terminal.diagnostic", "type": "core", "choices": [ - { "labelKey": "choice.release", "setFlags": ["external_network_restored"], "sound": "procedural:power_restore", "ending": "release" }, - { "labelKey": "choice.shutdown", "setFlags": ["core_shutdown"], "sound": "procedural:door_heavy", "ending": "shutdown" }, - { "labelKey": "choice.containment", "requiresFlags": ["log_01_found", "log_02_found", "log_03_found", "security_disabled", "manual_override_found"], "setFlags": ["containment_active"], "sound": "procedural:alarm_pulse", "ending": "containment" } + { "labelKey": "choice.release", "setFlags": ["external_network_restored"], "sound": "assets/audio/sfx_power_system.mp3", "ending": "release" }, + { "labelKey": "choice.shutdown", "setFlags": ["core_shutdown"], "sound": "assets/audio/sfx_door_heavy.mp3", "ending": "shutdown" }, + { "labelKey": "choice.containment", "requiresFlags": ["log_01_found", "log_02_found", "log_03_found", "security_disabled", "manual_override_found"], "setFlags": ["containment_active"], "sound": "assets/audio/sfx_alarm_low.mp3", "ending": "containment" } ] } ] } diff --git a/src/NullDepth/wwwroot/js/null-depth.js b/src/NullDepth/wwwroot/js/null-depth.js index f9ec50b..b3d0b35 100644 --- a/src/NullDepth/wwwroot/js/null-depth.js +++ b/src/NullDepth/wwwroot/js/null-depth.js @@ -8,6 +8,15 @@ initialize(percent) { this.setMasterVolume(percent); + const unlock = () => { + this.ensureContext(); + if (this.fileAmbient && this.fileAmbient.paused) { + this.fileAmbient.play().catch(() => {}); + } + }; + window.addEventListener("pointerdown", unlock); + window.addEventListener("keydown", unlock); + window.addEventListener("click", unlock); document.addEventListener("visibilitychange", () => { if (document.hidden) { this.context?.suspend(); @@ -22,7 +31,7 @@ setMasterVolume(percent) { this.volume = Math.max(0, Math.min(1, Number(percent) / 100)); if (this.ambient?.gain) this.ambient.gain.gain.value = 0.025 * this.volume; - if (this.fileAmbient) this.fileAmbient.volume = 0.35 * this.volume; + if (this.fileAmbient) this.fileAmbient.volume = 0.55 * this.volume; }, ensureContext() { @@ -32,7 +41,7 @@ }, playAmbient(source) { - if (source === this.ambientKey) return; + if (source === this.ambientKey && this.fileAmbient && !this.fileAmbient.paused) return; this.stopAmbient(); this.ambientKey = source || null; if (!source) return; @@ -60,9 +69,21 @@ const next = new Audio(source); next.loop = true; next.preload = "auto"; - next.volume = 0.35 * this.volume; - next.play().catch(() => {}); + next.volume = 0.55 * this.volume; this.fileAmbient = next; + const playPromise = next.play(); + if (playPromise !== undefined) { + playPromise.catch(() => { + const retry = () => { + if (this.fileAmbient === next && next.paused) { + next.play().catch(() => {}); + } + }; + window.addEventListener("pointerdown", retry, { once: true }); + window.addEventListener("keydown", retry, { once: true }); + window.addEventListener("click", retry, { once: true }); + }); + } }, stopAmbient() {