diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-04-08 12:56:26 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-04-08 12:56:28 +0200 |
commit | 6471203be63bb5dd7716aa9841014f7e9105d452 (patch) | |
tree | cc48a7407c7842201c3fe6dbd5c98c03c641fd64 /src/protocol.rs | |
parent | 7643fb90dcf148605e3309c2007cd8a4c27914fa (diff) |
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.
Diffstat (limited to 'src/protocol.rs')
-rw-r--r-- | src/protocol.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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::<Channel1>(ChannelSettings { - mode: ChannelMode::UnorderedReliable(Default::default()), + protocol.add_channel::<Input>(ChannelSettings { + mode: ChannelMode::OrderedReliable(Default::default()), ..Default::default() }); protocol |