pub mod thruster; use crate::shared::config::part::PartConfig; use bevy::math::{Quat, Vec2}; use bevy::camera::visibility::RenderLayers; use crate::prelude::*; use avian2d::prelude::*; use std::collections::HashMap; use std::sync::LazyLock; #[derive(States, Debug, Clone, PartialEq, Eq, Hash)] pub enum GameplayState { Main, Starguide, } pub const MAIN_LAYER: RenderLayers = RenderLayers::layer(0); pub const STARGUIDE_LAYER: RenderLayers = RenderLayers::layer(1); pub static MAIN_STAR_LAYERS: LazyLock = LazyLock::new(|| RenderLayers::from_layers(&[0, 1])); pub const ORBIT_LAYER: RenderLayers = RenderLayers::layer(2); // corresponding planet name #[derive(Component, Serialize, Deserialize, Debug)] #[require( RigidBody::Dynamic, LinearVelocity, AngularVelocity, ConstantForce, )] pub struct Part { pub strong_config: PartConfig, } #[derive(Component, Debug)] pub struct PartHandle(pub Handle); #[derive(Component, Serialize, Deserialize, Debug)] pub struct Player { pub client: Entity, } #[derive(Message, Debug, Clone)] pub struct DragRequestEvent { pub drag_target: Entity, pub action: DragAction, } #[derive(Debug, Clone)] pub enum DragAction { Attach { snap_target: Entity, peer_snap: Entity }, Free { position: Vec2, rotation: Quat }, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct PlayerStorage { pub fuel_capacity: f32, pub fuel: f32, pub power_capacity: f32, pub power: f32, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct CanCraft; #[derive(Message, Debug, Clone)] pub struct CraftPartRequest { pub crafting_part: Entity, pub crafted_part: String, pub inputs: HashMap, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct Temperature(pub f64); #[derive(Component, Serialize, Deserialize, Debug)] pub struct Cooler { pub cool_temperature: f64, pub heat_cooling_constant: f64, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct Radiator { pub emissivity: f64, pub surface_area: f64, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct Drill { pub drilling: bool, pub resource_multiplier: f32, pub on_planet: Option, } #[derive(Message, Debug, Clone)] pub struct ToggleDrillEvent { pub drill_entity: Entity, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct SingleStorage { pub resource_name: String, pub capacity: f32, pub stored: f32, } #[derive(Component, Serialize, Deserialize, Debug)] pub struct VariableStorage { pub resources: HashMap, pub capacity: f32, }