From 69584a302d132dc2bcc3837437e7347a3e0a5114 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 14 Mar 2024 06:43:53 +0100 Subject: feat: players can teleport --- src/client/network.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/client/network.rs (limited to 'src/client/network.rs') diff --git a/src/client/network.rs b/src/client/network.rs new file mode 100644 index 0000000..4d1a128 --- /dev/null +++ b/src/client/network.rs @@ -0,0 +1,35 @@ +use crate::protocol::*; +use crate::shared::*; +use bevy::prelude::*; +use lightyear::client::config::*; +use lightyear::client::plugin::ClientPlugin; +use lightyear::client::plugin::PluginConfig; +use lightyear::client::resource::Authentication; +use lightyear::prelude::client::NetConfig; +use lightyear::prelude::*; +use lightyear::transport::LOCAL_SOCKET; + +pub struct NetworkPlugin { + pub transport: TransportConfig, +} + +impl Plugin for NetworkPlugin { + fn build(&self, app: &mut App) { + app.add_plugins(ClientPlugin::new(PluginConfig::new( + ClientConfig { + net: NetConfig::Netcode { + config: Default::default(), + auth: Authentication::Manual { + server_addr: LOCAL_SOCKET, + client_id: CLIENT_ID, + private_key: KEY, + protocol_id: PROTOCOL_ID, + }, + io: IoConfig::from_transport(self.transport.clone()), + }, + ..Default::default() + }, + protocol(), + ))); + } +} -- cgit v1.2.3