use aeronet_transport::AeronetTransportPlugin;
use crate::shared::ecs::{CraftPartRequest, DragRequestEvent, TimeOffset, ToggleDrillEvent};
use crate::shared::net::{register_net, setup_net};
use crate::shared::thrust::ThrustSolution;
use bevy::app::{App, PluginGroup, PluginGroupBuilder};
use bevy::diagnostic::DiagnosticsPlugin;
use bevy::state::app::StatesPlugin;
use bevy_common_assets::toml::TomlAssetPlugin;
use crate::prelude::*;
use crate::shared::config::part::PartConfig;
use crate::shared::config::planet::PlanetConfigCollection;
use crate::shared::config::recipe::RecipesConfig;
use crate::shared::config::world::GlobalWorldConfig;
//use crate::shared::net::register_replication;
use crate::shared::world_config::world_config_plugin;
pub const TICK_RATE: f64 = 20.0;
pub struct SharedPluginGroup;
impl PluginGroup for SharedPluginGroup {
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(AssetPlugin::default())
.add(StatesPlugin)
.add(TransformPlugin)
.add(DiagnosticsPlugin)
.add(AeronetTransportPlugin)
.add(|app: &mut App| {
app.insert_resource(Time::from_hz(TICK_RATE));
app.insert_resource(Time::<Physics>::default().with_relative_speed(1.0));
app.insert_resource(TimeOffset::default());
})
//.add(register_replication)
.add(register_everything)
.add(setup_net)
.add(register_net)
.add(world_config_plugin)
/* Assets */
.add(TomlAssetPlugin::<GlobalWorldConfig>::new(&["wc.toml"]))
.add(TomlAssetPlugin::<PlanetConfigCollection>::new(&["pc.toml"]))
.add(TomlAssetPlugin::<PartConfig>::new(&["part.toml"]))
.add(TomlAssetPlugin::<RecipesConfig>::new(&["rc.toml"]))
}
}
pub fn register_everything(app: &mut App) {
}