use log::info;
use crate::util::Rng;
const CRYPTIDS: [&str; 8] = [
"Mothman",
"Chupacabra",
"The Jersey Devil",
"A Skinwalker",
"The Flatwoods Monster",
"A Dogman",
"The Wendigo",
"Slender Man's cousin nobody talks about",
];
pub fn sighting(rng: &mut Rng) {
let cryptid = rng.pick(&CRYPTIDS);
let procs: Vec<_> = procfs::process::all_processes()
.map(|iter| iter.filter_map(Result::ok).collect())
.unwrap_or_default();
if procs.is_empty() {
info!("Cryptid sighting: {cryptid} was spotted, but /proc denied all knowledge of it.");
return;
}
let target = rng.pick(&procs);
let comm = target
.stat()
.map_or_else(|_| "an unnamed process".to_string(), |s| s.comm);
info!(
"Cryptid sighting: {cryptid} has disguised itself as PID {} ({comm}).",
target.pid
);
}