rustorio_engine/
research.rs

1//! Technologies can be unlocked by consuming science packs.
2//! They usually unlock new recipes or further technologies.
3//!
4//! This module defines the the science pack resources and the `Technology` trait.
5
6use crate::{Sealed, resource_type, resources::Bundle};
7
8resource_type!(
9    /// Red science packs used for research.
10    RedScience);
11
12/// A technology can be unlocked out by calling the `research` method with the required science packs.
13/// This will consume the science packs and the technology itself, and return whatever the technology unlocks, mostly recipes and other technologies.
14pub trait Technology: Sealed {
15    /// The amount of red science required to carry out this technology.
16    const RED_SCIENCE_COST: u32;
17    /// The reward for completing this technology.
18    type Unlocks;
19
20    /// Carries out the research by consuming the required science packs and the research itself, returning whatever this research unlocks.
21    fn research(self, red_science: Bundle<RedScience, { Self::RED_SCIENCE_COST }>) -> Self::Unlocks;
22}