From c86d51fe925516ad31063ecb73f238c5f5b47563 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 18 Mar 2024 23:53:52 +0100 Subject: [PATCH] cleanup --- src/actor.rs | 13 ++++--------- src/nature.rs | 6 ++++++ src/settings.rs | 2 +- src/world.rs | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index c6acd05..aee46d2 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -1,10 +1,5 @@ use bevy::prelude::*; - -#[allow(unused)] pub const OXYGEN_USE_KG_PER_S: f32 = 1e-5; -#[allow(unused)] pub const OXY_S: f32 = OXYGEN_USE_KG_PER_S; -#[allow(unused)] pub const OXY_M: f32 = OXYGEN_USE_KG_PER_S * 60.0; -#[allow(unused)] pub const OXY_H: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0; -#[allow(unused)] pub const OXY_D: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0 * 24.0; +use crate::nature; pub struct ActorPlugin; impl Plugin for ActorPlugin { @@ -55,8 +50,8 @@ impl Default for Suit { fn default() -> Self { SUIT_SIMPLE } } const SUIT_SIMPLE: Suit = Suit { power: 1e5, power_max: 1e5, - oxygen: OXY_D, - oxygen_max: OXY_D, + oxygen: nature::OXY_D, + oxygen_max: nature::OXY_D, }; pub fn update( @@ -72,7 +67,7 @@ pub fn update( lifeform.adrenaline_jolt = 0.0 } lifeform.adrenaline = (lifeform.adrenaline - 0.0001 + lifeform.adrenaline_jolt * 0.01).clamp(0.0, 1.0); - suit.oxygen = (suit.oxygen - OXY_S*d).clamp(0.0, 1.0); + suit.oxygen = (suit.oxygen - nature::OXY_S*d).clamp(0.0, 1.0); } } diff --git a/src/nature.rs b/src/nature.rs index bffd1d5..4c1ebe7 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -2,6 +2,12 @@ // nobody cares how it works, but I guess we need it as an ingredient for // the universe *sigh* so here we go. +pub const OXYGEN_USE_KG_PER_S: f32 = 1e-5; +pub const OXY_S: f32 = OXYGEN_USE_KG_PER_S; +pub const OXY_M: f32 = OXYGEN_USE_KG_PER_S * 60.0; +pub const OXY_H: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0; +pub const OXY_D: f32 = OXYGEN_USE_KG_PER_S * 60.0 * 60.0 * 24.0; + pub fn star_color_index_to_rgb(color_index: f32) -> (f32, f32, f32) { let temperature = 4600.0 * ((1.0 / (0.92 * color_index + 1.7)) + (1.0 / (0.92 * color_index + 0.62))); diff --git a/src/settings.rs b/src/settings.rs index 13318f3..57027e3 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -26,7 +26,7 @@ pub struct Settings { impl Default for Settings { fn default() -> Self { Settings { - mute_sfx: true, + mute_sfx: false, mute_music: true, volume_sfx: 100, volume_music: 100, diff --git a/src/world.rs b/src/world.rs index 0e5d74d..54c150f 100644 --- a/src/world.rs +++ b/src/world.rs @@ -71,7 +71,7 @@ pub fn setup( actor::Actor::default(), actor::LifeForm::default(), actor::Suit { - oxygen: actor::OXY_M, + oxygen: nature::OXY_M, ..default() } ));