diff --git a/src/actor.rs b/src/actor.rs index 0f6903c..eae69ac 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -33,6 +33,7 @@ impl Plugin for ActorPlugin { )); app.add_systems(FixedUpdate, ( update_physics_lifeforms, + update_power, handle_wants_maxrotation, handle_wants_maxvelocity, )); @@ -198,21 +199,58 @@ impl Default for Engine { #[derive(Component)] pub struct Suit { pub oxygen: f32, - pub power: f32, pub oxygen_max: f32, - pub power_max: f32, pub integrity: f32, // [0.0 - 1.0] } impl Default for Suit { fn default() -> Self { SUIT_SIMPLE } } const SUIT_SIMPLE: Suit = Suit { - power: 1e5, - power_max: 1e5, oxygen: nature::OXY_D, oxygen_max: nature::OXY_D, integrity: 1.0, }; +#[derive(Component)] +pub struct Battery { + pub power: f32, // Watt-seconds + pub capacity: f32, // Watt-seconds + pub reactor: f32, // Watt (production) +} + +impl Default for Battery { + fn default() -> Self { + Self { + power: 10e3 * 3600.0, + capacity: 10e3 * 3600.0, // 10kWh + reactor: 2000e3, // 2MW + } + } +} + +pub fn update_power( + time: Res