update lightyear + fix aiming crash (#67)
This commit is contained in:
@@ -7,8 +7,13 @@ use bevy::{
|
||||
};
|
||||
use bevy_trenchbroom::geometry::Brushes;
|
||||
use lightyear::{
|
||||
link::{LinkConditioner, prelude::*},
|
||||
netcode::Key,
|
||||
prelude::{client::NetcodeConfig, input::native::InputMarker, *},
|
||||
prelude::{
|
||||
client::{Input, InputDelayConfig, NetcodeConfig},
|
||||
input::native::InputMarker,
|
||||
*,
|
||||
},
|
||||
};
|
||||
use nil::prelude::Mutex;
|
||||
use shared::{
|
||||
@@ -25,6 +30,7 @@ use std::{
|
||||
net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||
process::Stdio,
|
||||
sync::{LazyLock, mpsc},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
/// Cache of server processes to be cleared at process exit
|
||||
@@ -78,11 +84,21 @@ fn attempt_connection(mut commands: Commands) -> Result {
|
||||
private_key: Key::default(),
|
||||
protocol_id: 0,
|
||||
};
|
||||
let sync_config = SyncConfig {
|
||||
jitter_multiple: 5,
|
||||
jitter_margin: Duration::from_millis(15),
|
||||
..default()
|
||||
};
|
||||
let conditioner = LinkConditioner::new(LinkConditionerConfig {
|
||||
incoming_latency: Duration::from_millis(10),
|
||||
incoming_jitter: Duration::from_millis(0),
|
||||
incoming_loss: 0.0,
|
||||
});
|
||||
commands
|
||||
.spawn((
|
||||
Name::from("Client"),
|
||||
Client::default(),
|
||||
Link::new(None),
|
||||
Link::new(Some(conditioner)),
|
||||
LocalAddr(client_addr),
|
||||
PeerAddr(server_addr),
|
||||
ReplicationReceiver::default(),
|
||||
@@ -94,6 +110,10 @@ fn attempt_connection(mut commands: Commands) -> Result {
|
||||
},
|
||||
)?,
|
||||
UdpIo::default(),
|
||||
InputTimeline(Timeline::from(Input::new(
|
||||
sync_config,
|
||||
InputDelayConfig::balanced(),
|
||||
))),
|
||||
))
|
||||
.trigger(Connect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user