Instead of just connecting two Structures, Arms now hold Items themselves and behave more similar to Belts.
I also added the new Structure Furnace. It can convert Ores to Plates while using Coal as fuel.
With those changes the Material type now looks like this:
pub enum Material {
Ore(Ore),
Plate(Plate),
Wood,
Coal,
}
pub enum Ore {
Iron,
Copper,
}
pub enum Plate {
Iron,
Copper,
}
To support the conversion from Ore to Plate within the Furnace I added a function to Ore:
impl Ore {
pub fn smelted(&self) -> Plate {
match self {
Self::Iron => Plate::Iron,
Self::Copper => Plate::Copper,
}
}
}
The basic implementation of the Furnace then looks like this:
pub struct Furnace {
pub coal: Option<Material>,
pub ore: Option<Ore>,
pub product: Option<Plate>,
}
impl Furnace {
pub fn step(&mut self) -> bool {
match (self.product, &self.coal, self.ore) {
(None, Some(Material::Coal), Some(ore)) => {
self.coal = None;
self.ore = None;
self.product = Some(ore.smelted());
true
}
_ => false,
}
}
}
With step returning whether anything changed.
Since there’s now a Furnace I updated the example map to:
<<<<<<<
a
c>>>>eFE<<
^
))))>v ^
v ^
U a
>>)>>