From 7faced6aaa63fc94b6e9972a11874014540324dc Mon Sep 17 00:00:00 2001 From: Evy <evysgarden@protonmail.com> Date: Thu, 29 Sep 2022 13:41:44 +0200 Subject: [PATCH] initial battery work --- src/machine/battery.rs | 9 +++++++++ src/machine/mod.rs | 1 + src/power.rs | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 src/machine/battery.rs diff --git a/src/machine/battery.rs b/src/machine/battery.rs new file mode 100644 index 0000000..fc91ddd --- /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 613a5d8..e18c6d8 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 e514765..7c01010 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 -- GitLab