Implement grounded fighter pushing #85
+3
-1
@@ -201,7 +201,9 @@ impl Plugin for FighterPlugin {
|
|||||||
)
|
)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
GgrsSchedule,
|
GgrsSchedule,
|
||||||
push::apply_grounded_pushes.in_set(GameplaySet::Physics),
|
push::apply_grounded_pushes
|
||||||
|
.before(state::state_update_system)
|
||||||
|
.in_set(GameplaySet::StateUpdate),
|
||||||
)
|
)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
|
|||||||
+13
-4
@@ -75,13 +75,12 @@ fn calculate_push_deltas(
|
|||||||
|
|
||||||
pub fn apply_grounded_pushes(
|
pub fn apply_grounded_pushes(
|
||||||
roster: Res<FighterRoster>,
|
roster: Res<FighterRoster>,
|
||||||
fighters: Query<(
|
mut fighters: Query<(
|
||||||
&Fighter,
|
&Fighter,
|
||||||
&FighterTranslation,
|
&mut FighterTranslation,
|
||||||
&FighterFacingDirection,
|
&FighterFacingDirection,
|
||||||
&FighterSurfaceState,
|
&FighterSurfaceState,
|
||||||
)>,
|
)>,
|
||||||
mut translations: Query<&mut FighterTranslation>,
|
|
||||||
manifests: Res<Assets<FighterManifest>>,
|
manifests: Res<Assets<FighterManifest>>,
|
||||||
settings: Res<GameSettings>,
|
settings: Res<GameSettings>,
|
||||||
stage: Res<StageCollision>,
|
stage: Res<StageCollision>,
|
||||||
@@ -115,7 +114,7 @@ pub fn apply_grounded_pushes(
|
|||||||
if delta == FGi32::ZERO {
|
if delta == FGi32::ZERO {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Ok(mut translation) = translations.get_mut(*entity) {
|
if let Ok((_, mut translation, _, _)) = fighters.get_mut(*entity) {
|
||||||
translation.x += delta;
|
translation.x += delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +134,7 @@ mod tests {
|
|||||||
(FGVec2::lit("0", "0"), StagePolyLineSegmentType::Floor),
|
(FGVec2::lit("0", "0"), StagePolyLineSegmentType::Floor),
|
||||||
(FGVec2::lit("10", "0"), StagePolyLineSegmentType::Floor),
|
(FGVec2::lit("10", "0"), StagePolyLineSegmentType::Floor),
|
||||||
(FGVec2::lit("20", "0"), StagePolyLineSegmentType::Floor),
|
(FGVec2::lit("20", "0"), StagePolyLineSegmentType::Floor),
|
||||||
|
(FGVec2::lit("30", "0"), StagePolyLineSegmentType::Floor),
|
||||||
],
|
],
|
||||||
)],
|
)],
|
||||||
}
|
}
|
||||||
@@ -204,4 +204,13 @@ mod tests {
|
|||||||
vec![FGi32::lit("-0.6"), FGi32::ZERO, FGi32::lit("0.6")]
|
vec![FGi32::lit("-0.6"), FGi32::ZERO, FGi32::lit("0.6")]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn system_parameters_initialize_without_query_conflicts() {
|
||||||
|
let mut world = World::new();
|
||||||
|
let mut schedule = Schedule::default();
|
||||||
|
schedule.add_systems(apply_grounded_pushes);
|
||||||
|
|
||||||
|
schedule.initialize(&mut world).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user