diff --git a/client/input_parsing/src/input_stream/mod.rs b/client/input_parsing/src/input_stream/mod.rs index 131b54b3..78a398aa 100644 --- a/client/input_parsing/src/input_stream/mod.rs +++ b/client/input_parsing/src/input_stream/mod.rs @@ -3,7 +3,7 @@ mod parrot_stream; mod prewritten_stream; mod test_stream; -pub(crate) use pad_stream::{update_pads, PadStream}; +pub use pad_stream::{update_pads, PadStream}; pub use parrot_stream::{update_parrots, ParrotStream}; pub use prewritten_stream::PreWrittenStream; pub use test_stream::TestStream; diff --git a/client/input_parsing/src/input_stream/pad_stream.rs b/client/input_parsing/src/input_stream/pad_stream.rs index 973d3cd3..dcae70b2 100644 --- a/client/input_parsing/src/input_stream/pad_stream.rs +++ b/client/input_parsing/src/input_stream/pad_stream.rs @@ -5,7 +5,7 @@ use crate::helper_types::{Diff, InputEvent}; use super::{InputStream, ParrotStream}; -#[derive(Default, Component)] +#[derive(Default, Component, Clone)] pub struct PadStream { next_read: Vec, stick_position: IVec2, @@ -76,7 +76,7 @@ impl InputStream for PadStream { } } -pub(crate) fn update_pads( +pub fn update_pads( mut gamepad_events: EventReader, mut readers: Query<(&mut PadStream, &mut ParrotStream, &Player)>, controllers: Res, diff --git a/client/input_parsing/src/lib.rs b/client/input_parsing/src/lib.rs index e6f71ef3..b715d471 100644 --- a/client/input_parsing/src/lib.rs +++ b/client/input_parsing/src/lib.rs @@ -8,8 +8,9 @@ mod motion_input; pub use helper_types::InputEvent; pub use input_parser::InputParser; +pub use input_stream::PadStream; -use input_stream::{update_pads, update_parrots, PadStream, ParrotStream}; +use input_stream::{update_pads, update_parrots, ParrotStream}; const MAX_SECONDS_BETWEEN_SUBSEQUENT_MOTIONS: f32 = 0.2; // In seconds diff --git a/client/lib/src/damage/defense.rs b/client/lib/src/damage/defense.rs index efbd3a41..10b87173 100644 --- a/client/lib/src/damage/defense.rs +++ b/client/lib/src/damage/defense.rs @@ -6,7 +6,7 @@ const REWARD_FLOOR: i32 = 5; const REWARD_RAMP: i32 = 3; const TIME_UNTIL_RESET: usize = (wag_core::FPS * 1.0) as usize; -#[derive(Debug, Default, Component)] +#[derive(Debug, Default, Component, Clone, Copy)] pub struct Defense { streak: i32, streak_last_event: Option, diff --git a/client/lib/src/networking.rs b/client/lib/src/networking.rs index 982c36e8..e6d9c78f 100644 --- a/client/lib/src/networking.rs +++ b/client/lib/src/networking.rs @@ -1,11 +1,16 @@ use bevy::{input::gamepad::GamepadEvent, prelude::*, utils::HashMap}; use bevy_ggrs::*; use bevy_matchbox::prelude::*; +use characters::WAGResources; +use input_parsing::{InputParser, PadStream}; +use player_state::PlayerState; use wag_core::{ - Characters, Controllers, GameState, LocalCharacter, LocalController, OnlineState, - RollbackSchedule, WagInputButton, WagInputEvent, + Characters, Clock, Controllers, Facing, GameState, LocalCharacter, LocalController, + OnlineState, RollbackSchedule, WagInputButton, WagInputEvent, }; +use crate::{damage::Defense, movement::PlayerVelocity}; + type Config = bevy_ggrs::GgrsConfig; pub struct NetworkPlugin; @@ -33,7 +38,16 @@ impl Plugin for NetworkPlugin { .run_if(|session: Option>>| session.is_none()), ) .add_plugins(GgrsPlugin::::default()) - .rollback_component_with_clone::(); + // Probably an incomplete list of things to roll back + .rollback_resource_with_copy::() + .rollback_component_with_clone::() + .rollback_component_with_clone::() + .rollback_component_with_clone::() + .rollback_component_with_clone::() + .rollback_component_with_clone::() + .rollback_component_with_copy::() + .rollback_component_with_copy::() + .rollback_component_with_copy::(); } } diff --git a/client/lib/src/player_state_management/move_activation.rs b/client/lib/src/player_state_management/move_activation.rs index 70ab3f9f..4523b30e 100644 --- a/client/lib/src/player_state_management/move_activation.rs +++ b/client/lib/src/player_state_management/move_activation.rs @@ -9,13 +9,13 @@ use wag_core::{ActionId, Clock, Facing, Player, Stats}; use crate::{movement::PlayerVelocity, ui::Notifications}; -#[derive(Debug, Default, Reflect)] +#[derive(Debug, Default, Reflect, Clone, Copy)] pub(super) struct MoveActivation { pub kind: ActivationType, pub id: ActionId, } -#[derive(Debug, Default, Reflect)] +#[derive(Debug, Default, Reflect, Clone, Copy)] pub(super) enum ActivationType { Continuation, #[default] @@ -25,7 +25,7 @@ pub(super) enum ActivationType { const AUTOCORRECT: usize = (0.1 * wag_core::FPS) as usize; -#[derive(Debug, Default, Component, Reflect)] +#[derive(Debug, Default, Component, Reflect, Clone)] pub struct MoveBuffer { buffer: Vec<(usize, ActionId)>, activation: Option, diff --git a/client/wag_core/src/time/mod.rs b/client/wag_core/src/time/mod.rs index 0297c1db..e059914f 100644 --- a/client/wag_core/src/time/mod.rs +++ b/client/wag_core/src/time/mod.rs @@ -14,7 +14,7 @@ pub const COMBAT_DURATION: f32 = 99.0; pub const POST_ROUND_DURATION: f32 = 4.0; pub const POST_SHOP_DURATION: f32 = 11.0; -#[derive(Reflect, Resource, Debug)] +#[derive(Reflect, Resource, Debug, Clone, Copy)] pub struct Clock { pub frame: usize, start_time: f32,