Improve factory generation

This commit is contained in:
hal8174 2025-02-03 22:59:37 +01:00
parent 0f8bf5000c
commit ec869d4c18
7 changed files with 107 additions and 46 deletions

View file

@ -56,6 +56,20 @@ impl Beltspeed {
}
s
}
pub fn from_items_per_second(x: f64) -> Self {
if x <= 15.0 {
Beltspeed::Normal
} else if x <= 30.0 {
Beltspeed::Fast
} else if x <= 45.0 {
Beltspeed::Express
} else if x <= 60.0 {
Beltspeed::Turbo
} else {
unreachable!()
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]