diff --git a/src/machine/battery.rs b/src/machine/battery.rs new file mode 100644 index 0000000000000000000000000000000000000000..fc91ddd3c7ff53f6dba9380424c6fa096213d3ca --- /dev/null +++ b/src/machine/battery.rs @@ -0,0 +1,9 @@ +use crate::power::{Capacity, Source}; + +use bevy::prelude::*; + +#[derive(Bundle)] +pub struct BatteryBundle { + pub source: Source, + pub capacity: Capacity, +} diff --git a/src/machine/mod.rs b/src/machine/mod.rs index 613a5d8435027f27902aa3fc480752aae281edc8..e18c6d840bcb9e7e03ab539874e21f770631d3aa 100644 --- a/src/machine/mod.rs +++ b/src/machine/mod.rs @@ -7,6 +7,7 @@ use crate::{ use bevy::prelude::*; mod cable; +mod battery; pub const MACHINE_SIZE: Vec2 = Vec2::new(GRID_SIZE.x / 8.0, GRID_SIZE.y / 8.0); diff --git a/src/power.rs b/src/power.rs index e514765415fd188fcbabe579d0c0d15f9df1c7ea..7c01010706635801683bda6b3cb9046c8f376d12 100644 --- a/src/power.rs +++ b/src/power.rs @@ -17,6 +17,9 @@ impl Plugin for PowerPlugin { } } +#[derive(Component, Copy, Clone, Debug, Deref)] +pub struct Capacity(pub f32); + /// Any entity that can emit power (a generator, cable, etc.) should have /// source as one of it's components. The output field defines in which directions /// the entity may output power and the power field controls the amount of