Add wagon chest options to multistation

This commit is contained in:
hal8174 2025-04-25 21:31:48 +02:00
parent 7ef42e5202
commit 0ced2c3c44
7 changed files with 110 additions and 71 deletions

View file

@ -49,6 +49,24 @@ impl InserterType {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum ChestType {
Wood,
Iron,
Steel,
}
impl ChestType {
fn string(&self) -> String {
match self {
ChestType::Wood => "wooden-chest",
ChestType::Iron => "iron-chest",
ChestType::Steel => "steel-chest",
}
.to_owned()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ElectricPoleType {
Small,
@ -172,6 +190,7 @@ pub enum EntityType {
rail_type: RailType,
},
Roboport,
Chest(ChestType),
Unknown {
name: String,
size: Position,
@ -219,6 +238,10 @@ impl Entity {
)
}
pub fn new_chest(chest_type: ChestType, position: Position) -> Self {
Self::new(EntityType::Chest(chest_type), position, Direction::Up)
}
pub fn new_splitter(beltspeed: Beltspeed, position: Position, direction: Direction) -> Self {
Self::new(
EntityType::Splitter {
@ -356,6 +379,7 @@ impl Entity {
} => name.clone(),
EntityType::Rail { rail_type } => rail_type.string(),
EntityType::Roboport => "roboport".to_string(),
EntityType::Chest(chest_type) => chest_type.string(),
}
}

View file

@ -99,7 +99,6 @@ impl Serialize for SerializeEntityWrapper<'_> {
}
match &self.1.entity {
super::EntityType::Belt(_beltspeed) => (),
super::EntityType::UndergroundBelt(_beltspeed, underground_type) => {
entity_map.serialize_entry(
"type",
@ -134,7 +133,6 @@ impl Serialize for SerializeEntityWrapper<'_> {
)?;
}
}
super::EntityType::ElectricPole(_electric_pole_type) => (),
super::EntityType::Inserter {
inserter_type: _,
override_stack_size,
@ -150,13 +148,7 @@ impl Serialize for SerializeEntityWrapper<'_> {
} => {
entity_map.serialize_entry("recipe", recipe)?;
}
super::EntityType::Rail { rail_type: _ } => (),
super::EntityType::Roboport => (),
super::EntityType::Unknown {
name: _,
size: _,
misc: _,
} => (),
_ => (),
}
entity_map.end()