Skip to content

Commit

Permalink
Require UserAction bound for InputPlugin (#665)
Browse files Browse the repository at this point in the history
* Require UserAction bound for InputPlugin because otherwise it gives terrible errors

* Fix warning in simple_box
  • Loading branch information
Aceeri authored Oct 7, 2024
1 parent 7bca1d8 commit 56970e1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/simple_box/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn player_movement(
for input in input_reader.read() {
if let Some(input) = input.input() {
//No need to iterate the position when the input is None
if (input == &Inputs::None) {
if input == &Inputs::None {
continue;
}
for position in position_query.iter_mut() {
Expand Down
2 changes: 1 addition & 1 deletion lightyear/src/client/input/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl Default for InputConfig {
}
}

pub struct InputPlugin<A> {
pub struct InputPlugin<A: UserAction> {
config: InputConfig,
_marker: std::marker::PhantomData<A>,
}
Expand Down
4 changes: 2 additions & 2 deletions lightyear/src/server/input/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::server::events::InputEvent;
use crate::shared::replication::network_target::NetworkTarget;
use crate::shared::sets::{InternalMainSet, ServerMarker};

pub struct InputPlugin<A> {
pub struct InputPlugin<A: UserAction> {
_marker: std::marker::PhantomData<A>,
}

Expand All @@ -32,7 +32,7 @@ impl<A> Default for InputBuffers<A> {
}
}

impl<A> Default for InputPlugin<A> {
impl<A: UserAction> Default for InputPlugin<A> {
fn default() -> Self {
Self {
_marker: std::marker::PhantomData,
Expand Down
4 changes: 2 additions & 2 deletions lightyear/src/shared/input/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use crate::prelude::{MessageRegistry, UserAction};
use crate::protocol::message::MessageType;
use crate::server::config::ServerConfig;

pub struct InputPlugin<A> {
pub struct InputPlugin<A: UserAction> {
_marker: std::marker::PhantomData<A>,
}

impl<A> Default for InputPlugin<A> {
impl<A: UserAction> Default for InputPlugin<A> {
fn default() -> Self {
Self {
_marker: std::marker::PhantomData,
Expand Down

0 comments on commit 56970e1

Please sign in to comment.