Finish subfactory interface

This commit is contained in:
hal8174 2025-04-17 18:50:52 +02:00
parent 82394cc342
commit ff8795cea5
11 changed files with 537 additions and 310 deletions

View file

@ -164,7 +164,7 @@ pub enum EntityType {
},
Production {
name: String,
recipe: String,
recipe: Option<String>,
size: Position,
},
Rail {
@ -276,7 +276,7 @@ impl Entity {
pub fn new_production(
name: impl AsRef<str>,
recipe: impl AsRef<str>,
recipe: Option<impl AsRef<str>>,
position: Position,
direction: Direction,
size: Position,
@ -284,7 +284,7 @@ impl Entity {
Self::new(
EntityType::Production {
name: name.as_ref().to_owned(),
recipe: recipe.as_ref().to_owned(),
recipe: recipe.map(|s| s.as_ref().to_owned()),
size,
},
position,
@ -384,7 +384,7 @@ impl Entity {
name: _,
recipe,
size: _,
} => Some(recipe.clone()),
} => recipe.clone(),
_ => None,
}
}