use crate::config::part::PartConfig;
use bevy::ecs::entity::MapEntities;
use bevy::math::{Quat, Vec2};
use bevy::prelude::{Component, Entity, Event, Handle, Resource};
use bevy_rapier2d::dynamics::RigidBody;
use bevy_rapier2d::prelude::*;
use bevy_replicon::prelude::Replicated;
use serde::{Deserialize, Serialize};
#[derive(Component)]
pub struct MainCamera;
#[derive(Component)]
pub struct StarfieldFront;
#[derive(Component)]
pub struct StarfieldMid;
#[derive(Component)]
pub struct StarfieldBack;
#[derive(Component)]
pub struct FuelText;
#[derive(Component)]
pub struct PowerText;
#[derive(Resource, Default)]
pub struct CursorWorldCoordinates(pub Option<Vec2>);
#[derive(Debug, Deserialize, Event, Serialize)]
pub enum ThrustEvent {
Up(bool),
Down(bool),
Left(bool),
Right(bool),
}
#[derive(Component, Serialize, Deserialize, Debug)]
#[require(
ReadMassProperties,
RigidBody::Dynamic,
ExternalForce,
ExternalImpulse,
Replicated
)]
pub struct Part {
pub strong_config: PartConfig,
}
#[derive(Component, Debug)]
pub struct PartHandle(pub Handle<PartConfig>);
#[derive(Component, Serialize, Deserialize, Debug)]
pub struct Player {
#[entities]
pub client: Entity,
}
#[derive(Component, Default, Serialize, Deserialize, Debug)]
#[allow(clippy::struct_excessive_bools, reason = "It's not a state machine")]
pub struct PlayerThrust {
pub up: bool,
pub down: bool,
pub left: bool,
pub right: bool,
}
#[derive(Component, Serialize, Deserialize, Debug)]
pub struct Particles {
pub effect: String,
pub active: bool,
}
#[derive(Serialize, Deserialize, Event, Debug, MapEntities, Clone)]
pub struct DragRequestEvent {
#[entities]
pub drag_target: Entity,
pub drag_to: Vec2,
pub set_rotation: Quat,
#[entities]
pub snap_target: Option<Entity>,
}
#[derive(Component, Serialize, Deserialize, Debug)]
pub struct PlayerStorage {
pub fuel_capacity: f32,
pub fuel: f32,
pub power_capacity: f32,
pub power: f32,
}