pub struct Assembler<R: AssemblerRecipe>(/* private fields */);Expand description
The assembler can craft most items in the game.
To use, first build the assembler using Assembler::build, providing the desired recipe and the required resources.
Then, add inputs using inputs, for example assembler.inputs(&tick).0.add(bundle).
The assembler will automatically process the inputs over time, which can be advanced using the Tick.
Outputs can be extracted using outputs, for example assembler.outputs(&tick).0.bundle::<1>().
If you want to change the recipe, use change_recipe, but ensure the assembler is empty first.
See the implementors of the AssemblerRecipe trait for recipes that can be used in the assembler.
Implementations§
Source§impl<R: AssemblerRecipe> Assembler<R>
impl<R: AssemblerRecipe> Assembler<R>
Sourcepub fn build(
tick: &Tick,
recipe: R,
copper_wires: Bundle<CopperWire, 12>,
iron: Bundle<Iron, 6>,
) -> Self
pub fn build( tick: &Tick, recipe: R, copper_wires: Bundle<CopperWire, 12>, iron: Bundle<Iron, 6>, ) -> Self
Builds an assembler. Costs 12 copper wires and 6 iron.
Sourcepub fn change_recipe<R2: AssemblerRecipe>(
self,
recipe: R2,
) -> Result<Assembler<R2>, MachineNotEmptyError<Self>>
pub fn change_recipe<R2: AssemblerRecipe>( self, recipe: R2, ) -> Result<Assembler<R2>, MachineNotEmptyError<Self>>
Changes the Recipe of the assembler.
Returns the original assembler if the the input and output buffers are not empty.
Sourcepub fn inputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Inputs
pub fn inputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Inputs
Update internal state and access input buffers.
Sourcepub const fn input_amounts(&self) -> <R as Recipe>::InputAmountsType
pub const fn input_amounts(&self) -> <R as Recipe>::InputAmountsType
Amount of each input resource needed for one recipe cycle
Sourcepub fn outputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Outputs
pub fn outputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Outputs
Update internal state and access output buffers.
Sourcepub const fn output_amounts(&self) -> <R as Recipe>::OutputAmountsType
pub const fn output_amounts(&self) -> <R as Recipe>::OutputAmountsType
Amount of each output resource created per recipe cycle