use crate::attachment::{Joint, JointOf, PartInShip, Peer, Ship, SnapOf, SnapOfJoint}; use crate::config::planet::{Planet, PlanetConfigCollection}; use crate::ecs::{DragRequestEvent, Hi, Part, Particles, Player, PlayerStorage}; use bevy::app::{App, PluginGroup, PluginGroupBuilder}; use bevy_common_assets::toml::TomlAssetPlugin; use crate::prelude::*; use bevy_replicon::prelude::{AppRuleExt, Channel, ClientMessageAppExt}; use crate::config::part::PartConfig; use crate::config::world::GlobalWorldConfig; use crate::ecs::thruster::{Thruster, ThrusterOfPart}; use crate::physics::register_physics_components_for_replication; use crate::thrust::ThrustSolution; use crate::world_config::world_config_plugin; pub struct SharedPluginGroup; impl PluginGroup for SharedPluginGroup { fn build(self) -> PluginGroupBuilder { PluginGroupBuilder::start::() .add_group(RepliconPlugins) //.add(RapierPhysicsPlugin::::pixels_per_meter(100.0)) .add(physics_setup_plugin) .add(register_everything) .add(register_physics_components_for_replication) .add(world_config_plugin) /* Assets */ .add(TomlAssetPlugin::::new(&["wc.toml"])) .add(TomlAssetPlugin::::new(&["pc.toml"])) .add(TomlAssetPlugin::::new(&["part.toml"])) } } pub fn register_everything(app: &mut App) { app.add_mapped_client_message::(Channel::Ordered); app.add_mapped_client_message::(Channel::Ordered); app.add_mapped_server_message::(Channel::Ordered); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); app.replicate::(); } fn physics_setup_plugin(app: &mut App) { app.insert_resource(Gravity::ZERO); app.add_systems(Startup, setup_physics); } fn setup_physics( ) { } /* fn setup_physics( mut rapier_config: Query<&mut RapierConfiguration>, mut rapier_context: Query<&mut RapierContextSimulation>, ) { let mut cfg = rapier_config.single_mut().unwrap(); cfg.gravity = Vec2::ZERO; let ctx = rapier_context.single_mut().unwrap(); let mut params = ctx.integration_parameters; params.num_internal_stabilization_iterations = 16; } */