diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-01 17:00:05 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-01 17:00:05 +0300 |
| commit | f3299bc40b6ced7b654255c8391ef7b0ee24aeef (patch) | |
| tree | 9e29faabdf0efbf9dadbc55940dd76c16cc99a54 /apps/fparkan-game/src/player_service.rs | |
| parent | 1e0128c6de44aa73e446451a27469e9873bc7e93 (diff) | |
| download | fparkan-f3299bc40b6ced7b654255c8391ef7b0ee24aeef.tar.xz fparkan-f3299bc40b6ced7b654255c8391ef7b0ee24aeef.zip | |
feat(control): switch onboard self-repair from the cockpit
Diffstat (limited to 'apps/fparkan-game/src/player_service.rs')
| -rw-r--r-- | apps/fparkan-game/src/player_service.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/fparkan-game/src/player_service.rs b/apps/fparkan-game/src/player_service.rs new file mode 100644 index 00000000..a358eaba --- /dev/null +++ b/apps/fparkan-game/src/player_service.rs @@ -0,0 +1,39 @@ +use crate::StaticVulkanApp; +use fparkan_runtime::{at_research_laboratory, order_lab_research, toggle_self_repair}; + +impl StaticVulkanApp { + pub(super) fn handle_player_service(&mut self, clock_ms: u32) { + let (true, Some(cockpit), Some(engine)) = ( + std::mem::take(&mut self.player_service_pressed), + self.cockpit, + self.mission_engine.as_mut(), + ) else { + return; + }; + if self.boarded_hero_index.is_none() && at_research_laboratory(engine, cockpit) { + match order_lab_research(engine, cockpit, clock_ms) { + Ok((component, duration)) => { + self.laboratory_status = Some(format!("Лаборатория — исследуется {component}")); + eprintln!("laboratory_research_order component={component} duration_ms={duration} queue_time_ms={clock_ms}"); + } + Err(error) => eprintln!("laboratory_research_rejected {error}"), + } + return; + } + if let Some(enabled) = toggle_self_repair(engine, cockpit) { + eprintln!("player_self_repair enabled={enabled} queue_time_ms={clock_ms}"); + if let Some(audio) = &mut self.audio { + let voice = if enabled { + "VOICE_REPAIR_SYS_ON" + } else { + "VOICE_REPAIR_SYS_OFF" + }; + if let Err(error) = audio.queue_game_voice(voice) { + eprintln!( + "sim_coverage mission_voice_unavailable=1 notice={voice} reason={error}" + ); + } + } + } + } +} |
