This commit is contained in:
yuni 2024-03-18 23:53:52 +01:00
parent 054c9f0361
commit c86d51fe92
4 changed files with 12 additions and 11 deletions

View file

@ -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);
}
}

View file

@ -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)));

View file

@ -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,

View file

@ -71,7 +71,7 @@ pub fn setup(
actor::Actor::default(),
actor::LifeForm::default(),
actor::Suit {
oxygen: actor::OXY_M,
oxygen: nature::OXY_M,
..default()
}
));