Add multistation generation
This commit is contained in:
parent
05f4edf83a
commit
ce76626f79
7 changed files with 451 additions and 10 deletions
|
|
@ -1 +1 @@
|
|||
0eNqN0UsKgzAQBuC7zDqCUaMmVyml+BjKgMYSo1Qkd2/USmnrwuU8/m8xM0PZDPgwpC2oGajqdA/qMkNPd100S08XLYICU1ADjgHpGp+guLsyQG3JEm6JtZhuemhLNH6B7clqMCPWwQIEBTB4dL1PdXrBvSRyyWACFfAw9X5NBqttzEPH/tzo0C2P3Gx3+Qk3Pu/GmyuzbzY5UJPTV8jytyp+VX9osth64/MrBiOafl0QaSQTKYVIRCRj7twLWaaXjg==
|
||||
0eNqN0csKgzAQBdB/mXWERhNr8iulFB9DGdAo8UFF8u+NWilFoS4nmXsWdybIyh4bS6YDPQHltWlB3yZo6WnScn4zaYWgwaZUgmNApsAXaO7uDNB01BGuiWUYH6avMrR+gW3JvLcDFsEMBCkwaOrWp2oz416KQ8VgBB1wkXi/IIv5+u3HHRsestkBG/GNjf6z0XlWfthI/bJcHLjidAvisrnXneurpg4rr3yvxWBA2y4b0lcolJJS8kTEwrk3ocSX7Q==
|
||||
|
|
|
|||
1
factorio-blueprint/blueprints/stacker.bp
Normal file
1
factorio-blueprint/blueprints/stacker.bp
Normal file
|
|
@ -0,0 +1 @@
|
|||
0eNqN1tluwjAQBdB/8bOD4j3Or1RVFcCilsCgLKgI5d9rAgOtGjX3McscTXIzdq5svR/CqY2pZ/WVxc0xdax+u7Iu7lKzv51LzSGwmrVN3LORs5i24YvVYnznLKQ+9jHcK6aDy0caDuvQ5hs4VXZ9rt199sVEcHY6drnqmG54llxpOLuwupBOjCP/A8kntBnac9hOTNH8B9kqN7qNbdjcL4tyxlX856MVjweeUcvV05Ur81uWM7CebXg9RyuCFdCwwd9oSW653K5FWeurB2uqZdbhrCXWLrMVzmpi9TLrcVYSK5dZUeIuZWaAzAQ8Xbai0DQQmpC4S6lpIDWhcJdi00BsQuMu5aaR3AzuUm4ayQ0fNke5KSQ3fNoc5aaQ3PBxc5SbQnLz2OJrrX8uvkogi6/EJ87RF6GAL0IKdFXPPT9c6QEX3t6sdeQCb1jiE/dy8/6bd/XYh0Mue/0YcHYObTdVGCu99t4YIypt9Th+A9zvq+s=
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
use factorio_core::{
|
||||
beltoptions::Beltspeed,
|
||||
direction,
|
||||
pathfield::PathField,
|
||||
prelude::{Direction, Position, PositionType, Transformable, Transformation},
|
||||
};
|
||||
|
|
@ -73,6 +74,32 @@ pub enum Quality {
|
|||
Legendary,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum RailType {
|
||||
Straight,
|
||||
CurvedA,
|
||||
CurvedB,
|
||||
RailSignal,
|
||||
ChainSignal,
|
||||
}
|
||||
|
||||
impl RailType {
|
||||
fn string(&self) -> String {
|
||||
match self {
|
||||
RailType::Straight => "straight-rail",
|
||||
RailType::CurvedA => "curved-rail-a",
|
||||
RailType::CurvedB => "curved-rail-b",
|
||||
RailType::RailSignal => "rail-signal",
|
||||
RailType::ChainSignal => "rail-chain-signal",
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn size(&self) -> Position {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Entity {
|
||||
entity: EntityType,
|
||||
position: Position,
|
||||
|
|
@ -94,6 +121,10 @@ pub enum EntityType {
|
|||
recipe: String,
|
||||
size: Position,
|
||||
},
|
||||
Rail {
|
||||
rail_type: RailType,
|
||||
direction: u8,
|
||||
},
|
||||
Unknown {
|
||||
name: String,
|
||||
size: Position,
|
||||
|
|
@ -174,6 +205,17 @@ impl Entity {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn new_rail(rail_type: RailType, position: Position, direction: u8) -> Self {
|
||||
Self::new(
|
||||
EntityType::Rail {
|
||||
rail_type,
|
||||
direction,
|
||||
},
|
||||
position,
|
||||
Direction::Up,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_unknown(
|
||||
name: impl AsRef<str>,
|
||||
position: Position,
|
||||
|
|
@ -218,6 +260,10 @@ impl Entity {
|
|||
recipe: _,
|
||||
size: _,
|
||||
} => name.clone(),
|
||||
EntityType::Rail {
|
||||
rail_type,
|
||||
direction: _,
|
||||
} => rail_type.string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,6 +312,10 @@ impl Entity {
|
|||
size,
|
||||
} => *size,
|
||||
EntityType::ElectricPole(electric_pole_type) => electric_pole_type.size(),
|
||||
EntityType::Rail {
|
||||
rail_type,
|
||||
direction: _,
|
||||
} => rail_type.size(),
|
||||
_ => Position::new(2, 2),
|
||||
}
|
||||
}
|
||||
|
|
@ -343,8 +393,14 @@ impl Blueprint {
|
|||
}
|
||||
|
||||
pub fn add_blueprint(&mut self, other: Self) {
|
||||
let previous_entities = self.entities.len();
|
||||
self.entities.extend(other.entities);
|
||||
self.keys.extend(other.keys);
|
||||
self.keys.extend(
|
||||
other
|
||||
.keys
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, v + previous_entities)),
|
||||
);
|
||||
self.wires.extend(other.wires);
|
||||
}
|
||||
|
||||
|
|
@ -359,11 +415,17 @@ impl Blueprint {
|
|||
i as u32 + 1,
|
||||
BlueprintPosition::new(0.5 * e.position.x as f64, 0.5 * e.position.y as f64),
|
||||
)
|
||||
.direction(match e.direction {
|
||||
Direction::Up => 0,
|
||||
Direction::Right => 4,
|
||||
Direction::Down => 8,
|
||||
Direction::Left => 12,
|
||||
.direction(match &e.entity {
|
||||
&EntityType::Rail {
|
||||
rail_type: _,
|
||||
direction,
|
||||
} => direction,
|
||||
_ => match e.direction {
|
||||
Direction::Up => 0,
|
||||
Direction::Right => 4,
|
||||
Direction::Down => 8,
|
||||
Direction::Left => 12,
|
||||
},
|
||||
})
|
||||
.maybe_underground_type(e.get_maybe_underground_type_string())
|
||||
.maybe_override_stack_size(e.get_maybe_override_stack_size())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue