Up until now there was no cooldown for Structure
s. Belt
s and Arm
s would move an Item
as soon as it’s given to them.
I introduced a trait for types that change over time.
pub trait Dynamic {
fn tick(&mut self);
}
The updated Furnace
code for example now looks like this:
impl Dynamic for Furnace {
fn tick(&mut self) {
self.cooldown = self.cooldown.saturating_sub(1);
if self.cooldown == 0 {
self.cooldown = 500;
match (self.product, &self.coal, self.ore) {
(None, Some(Material::Coal), Some(ore)) => {
self.coal = None;
self.ore = None;
self.product = Some(ore.smelted());
}
_ => (),
}
}
}
}