Something went wrong. Try again.
HEXWORK - A Lantern in the Deep: 3D ASCII terminal roguelike RPG in Rust.
Entirely designed and built by Muse Spark 1.3 to evaluate if I like the model.
Something went wrong. Try again.
840 B · 18 lines
Rust
at main
12345678910111213141516171819//! Process panic-hook registration; snapshot capture and formatting are shared.use std::path::Path;use std::sync::{Arc, Mutex};use hexwork_save::artifact::durable_replace;pub(crate) use hexwork_game::crash::{update_panic_state, PanicSnapshot, SharedPanicSnapshot};
pub(crate) fn install_panic_hook(root: &Path) -> SharedPanicSnapshot { let snapshot = Arc::new(Mutex::new(PanicSnapshot::default())); let state = Arc::clone(&snapshot); let path = root.join("crash-epitaph.md"); std::panic::set_hook(Box::new(move |info| { let captured = state.try_lock().ok().map(|guard| guard.clone()); let text = hexwork_game::crash::format_crash(captured.as_ref(), info); let _ = durable_replace(&path, text.as_bytes()); eprintln!("The lantern gutters out. (HEXWORK crashed)"); })); snapshot}