~starkingdoms/starkingdoms

ref: 7979969ad49f6317692813c1ce338a9e7eac00f5 starkingdoms/crates/unified/src/server_plugins.rs -rw-r--r-- 942 bytes
7979969a — core test 21 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use aeronet_replicon::server::AeronetRepliconServerPlugin;
use aeronet_websocket::server::WebSocketServerPlugin;
use avian2d::prelude::PhysicsInterpolationPlugin;
use bevy::app::{PluginGroup, PluginGroupBuilder};
use std::net::SocketAddr;
use avian2d::PhysicsPlugins;

pub struct ServerPluginGroup {
    pub bind: SocketAddr,
    pub tick_rate: f32,
    pub max_clients: usize,
}
impl PluginGroup for ServerPluginGroup {
    fn build(self) -> PluginGroupBuilder {
        PluginGroupBuilder::start::<Self>()
            .add_group(
                PhysicsPlugins::default()
                    .with_length_unit(100.0)
                    .set(PhysicsInterpolationPlugin::interpolate_all())
            )
            .add(WebSocketServerPlugin)
            .add(AeronetRepliconServerPlugin)
            .add(crate::server::ServerPlugin {
                bind: self.bind,
                max_clients: self.max_clients,
            })

    }
}