Resolve warnings
This commit is contained in:
parent
dfdeae5638
commit
b715c4ad06
18 changed files with 48 additions and 35 deletions
|
|
@ -8,6 +8,7 @@ edition = "2024"
|
|||
criterion = "0.3"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.26", features = ["derive"] }
|
||||
image = "0.25.5"
|
||||
proptest = "1.5.0"
|
||||
proptest-derive = "0.5.0"
|
||||
|
|
|
|||
82
factorio-core/src/beltoptions.rs
Normal file
82
factorio-core/src/beltoptions.rs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
use clap::ValueEnum;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
pub enum Beltspeed {
|
||||
Normal,
|
||||
Fast,
|
||||
Express,
|
||||
Turbo,
|
||||
}
|
||||
|
||||
impl Beltspeed {
|
||||
pub fn string(self) -> String {
|
||||
match self {
|
||||
Beltspeed::Normal => "transport-belt",
|
||||
Beltspeed::Fast => "fast-transport-belt",
|
||||
Beltspeed::Express => "express-transport-belt",
|
||||
Beltspeed::Turbo => "turbo-transport-belt",
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
pub fn string_underground(self) -> String {
|
||||
match self {
|
||||
Beltspeed::Normal => "underground-belt",
|
||||
Beltspeed::Fast => "fast-underground-belt",
|
||||
Beltspeed::Express => "express-underground-belt",
|
||||
Beltspeed::Turbo => "turbo-underground-belt",
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
pub fn string_splitter(self) -> String {
|
||||
match self {
|
||||
Beltspeed::Normal => "splitter",
|
||||
Beltspeed::Fast => "fast-splitter",
|
||||
Beltspeed::Express => "express-splitter",
|
||||
Beltspeed::Turbo => "turbo-splitter",
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
pub fn halve(self) -> Self {
|
||||
match self {
|
||||
Beltspeed::Normal => Beltspeed::Normal,
|
||||
Beltspeed::Fast => Beltspeed::Normal,
|
||||
Beltspeed::Express => Beltspeed::Fast,
|
||||
Beltspeed::Turbo => Beltspeed::Fast,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn halvings(self, i: usize) -> Self {
|
||||
let mut s = self;
|
||||
for _ in 0..i {
|
||||
s = s.halve();
|
||||
}
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
pub enum Belttype {
|
||||
Full,
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
|
||||
impl Belttype {
|
||||
pub fn contains_left(self) -> bool {
|
||||
match self {
|
||||
Belttype::Full => true,
|
||||
Belttype::Left => true,
|
||||
Belttype::Right => false,
|
||||
}
|
||||
}
|
||||
pub fn contains_right(self) -> bool {
|
||||
match self {
|
||||
Belttype::Full => true,
|
||||
Belttype::Left => false,
|
||||
Belttype::Right => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
pub mod aabb;
|
||||
pub mod beltoptions;
|
||||
pub mod block;
|
||||
pub mod color;
|
||||
pub mod direction;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue