blob: 0beead7900d5cb87caf6afc87d8f9b82edef0b3e (
plain)
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
30
31
|
use crate::protocol::*;
use crate::shared::*;
use bevy::prelude::*;
use lightyear::prelude::server::NetConfig;
use lightyear::prelude::*;
use lightyear::server::config::*;
use lightyear::server::plugin::PluginConfig;
use lightyear::server::plugin::ServerPlugin;
pub struct NetworkPlugin {
pub transport: TransportConfig,
}
impl Plugin for NetworkPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(ServerPlugin::new(PluginConfig::new(
ServerConfig {
net: [NetConfig::Netcode {
config: NetcodeConfig::default()
.with_protocol_id(PROTOCOL_ID)
.with_key(KEY),
io: IoConfig::from_transport(self.transport.clone()),
}]
.to_vec(),
ping: PingConfig::default(),
..Default::default()
},
protocol(),
)));
}
}
|