From 6471203be63bb5dd7716aa9841014f7e9105d452 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 8 Apr 2024 12:56:26 +0200 Subject: fix: send inputs via messages instead of input It appears as if lightyear inputs are supposed to be keys that are being held down. This abstraction does not fit well with our inputs, which are one-time actions. In particular, I've found inputs being missed. We hope to improve upon this, by sending inputs as lightyear messages via a reliable, oredered channel. --- src/protocol.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/protocol.rs') diff --git a/src/protocol.rs b/src/protocol.rs index f4c77bb..f75cfab 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -19,8 +19,6 @@ use serde::Serialize; #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub enum Inputs { - Imperative(Imperative), - Activation(Activation), None, } impl UserAction for Inputs {} @@ -39,6 +37,8 @@ pub enum Messages { SelectChampion(SelectChampion), SelectFaction(SelectFaction), HealthChanged(HealthChanged), + Imperative(Imperative), + Activation(Activation), } #[component_protocol(protocol = "MyProtocol")] @@ -60,7 +60,7 @@ pub enum Components { } #[derive(Channel)] -pub struct Channel1; +pub struct Input; protocolize! { Self = MyProtocol, @@ -71,8 +71,8 @@ protocolize! { pub fn protocol() -> MyProtocol { let mut protocol = MyProtocol::default(); - protocol.add_channel::(ChannelSettings { - mode: ChannelMode::UnorderedReliable(Default::default()), + protocol.add_channel::(ChannelSettings { + mode: ChannelMode::OrderedReliable(Default::default()), ..Default::default() }); protocol -- cgit v1.2.3