It will be pulled in automatically by Bevy, now. I've also set a default fuel level of 5 units.
52 lines
945 B
Rust
52 lines
945 B
Rust
use bevy::prelude::*;
|
|
|
|
/// Data component for info about the player's current set of cards.
|
|
///
|
|
/// [`Self::capacity`] is the maximum hand size.
|
|
///
|
|
/// [`Self::low_water_mark`] is the threshold for drawing new cards on-room-enter.
|
|
#[derive(Component)]
|
|
pub struct PlayerHand {
|
|
cards: Vec<Entity>,
|
|
capacity: u8,
|
|
low_water_mark: u8,
|
|
}
|
|
|
|
pub mod machines {
|
|
|
|
use bevy::prelude::*;
|
|
|
|
use crate::game::consumables::Fuel;
|
|
|
|
#[derive(Component)]
|
|
#[require(Fuel)]
|
|
pub struct CuttingMachine;
|
|
|
|
#[derive(Component)]
|
|
#[require(Fuel)]
|
|
pub struct RotatingMachine;
|
|
|
|
#[derive(Component)]
|
|
#[require(Fuel)]
|
|
pub struct FlippingMachine;
|
|
|
|
#[derive(Component)]
|
|
#[require(Fuel)]
|
|
pub struct TransposingMachine;
|
|
}
|
|
|
|
pub mod consumables {
|
|
use bevy::prelude::*;
|
|
|
|
#[derive(Component)]
|
|
pub struct Fuel(pub u32);
|
|
|
|
impl Default for Fuel {
|
|
fn default() -> Self {
|
|
Self(5)
|
|
}
|
|
}
|
|
#[derive(Event)]
|
|
pub struct FuelChanged;
|
|
}
|