mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix PlayerInput to handle diagonal inputs
This commit is contained in:
parent
6c681adc4d
commit
5bdb07b314
1 changed files with 6 additions and 4 deletions
|
@ -261,11 +261,13 @@ pub fn send_player_input_packet(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
) {
|
) {
|
||||||
for (entity, physics_state, jumping, last_sent_input) in query.iter_mut() {
|
for (entity, physics_state, jumping, last_sent_input) in query.iter_mut() {
|
||||||
|
let dir = physics_state.move_direction;
|
||||||
|
type D = WalkDirection;
|
||||||
let input = ServerboundPlayerInput {
|
let input = ServerboundPlayerInput {
|
||||||
forward: physics_state.move_direction == WalkDirection::Forward,
|
forward: matches!(dir, D::Forward | D::ForwardLeft | D::ForwardRight),
|
||||||
backward: physics_state.move_direction == WalkDirection::Backward,
|
backward: matches!(dir, D::Backward | D::BackwardLeft | D::BackwardRight),
|
||||||
left: physics_state.move_direction == WalkDirection::Left,
|
left: matches!(dir, D::Left | D::ForwardLeft | D::BackwardLeft),
|
||||||
right: physics_state.move_direction == WalkDirection::Right,
|
right: matches!(dir, D::Right | D::ForwardRight | D::BackwardRight),
|
||||||
jump: **jumping,
|
jump: **jumping,
|
||||||
// TODO: implement sneaking
|
// TODO: implement sneaking
|
||||||
shift: false,
|
shift: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue