Fix match state remaining mutable after and of match and implement initial work on aerials #77

Merged
EIREXE merged 4 commits from schedule_fix_end_of_match into master 2026-09-29 12:40:14 +00:00
2 changed files with 14 additions and 2 deletions
Showing only changes of commit b9611c1b42 - Show all commits
+10 -1
View File
@@ -94,9 +94,13 @@ impl MatchState {
} }
fn advance_frame(&mut self, config: &MatchConfig, frame: i32) { fn advance_frame(&mut self, config: &MatchConfig, frame: i32) {
if self.finished_at_frame.is_some() {
return;
}
self.elapsed_frames = self.elapsed_frames.saturating_add(1); self.elapsed_frames = self.elapsed_frames.saturating_add(1);
if self.finished_at_frame.is_none() && self.is_match_finished(config) { if self.is_match_finished(config) {
self.finished_at_frame = Some(frame); self.finished_at_frame = Some(frame);
} }
} }
@@ -139,6 +143,10 @@ pub fn ggrs_should_run(pause: Option<Res<PauseState>>) -> bool {
!pause.is_some_and(|pause| pause.paused) !pause.is_some_and(|pause| pause.paused)
} }
pub(crate) fn match_is_ongoing(match_state: Option<Res<MatchState>>) -> bool {
match_state.is_none_or(|match_state| match_state.finished_at_frame.is_none())
}
fn toggle_pause( fn toggle_pause(
key: Res<ButtonInput<KeyCode>>, key: Res<ButtonInput<KeyCode>>,
gamepads: Query<&Gamepad>, gamepads: Query<&Gamepad>,
@@ -257,6 +265,7 @@ mod tests {
state.advance_frame(&config, 12); state.advance_frame(&config, 12);
assert_eq!(state.finished_at_frame, Some(11)); assert_eq!(state.finished_at_frame, Some(11));
assert_eq!(state.elapsed_frames, 2);
} }
#[test] #[test]
+4 -1
View File
@@ -9,6 +9,8 @@
use bevy::prelude::*; use bevy::prelude::*;
use bevy_ggrs::prelude::*; use bevy_ggrs::prelude::*;
use crate::match_runtime::match_is_ongoing;
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)] #[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
pub enum GameplaySet { pub enum GameplaySet {
/// Turn this frame's netcode inputs into per-fighter input state. /// Turn this frame's netcode inputs into per-fighter input state.
@@ -47,7 +49,8 @@ impl Plugin for GameplaySchedulePlugin {
GameplaySet::Attacks, GameplaySet::Attacks,
GameplaySet::MatchRules, GameplaySet::MatchRules,
) )
.chain(), .chain()
.run_if(match_is_ongoing),
); );
} }
} }