aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-24 05:57:49 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-24 06:00:57 +0100
commitfff6538cde0bb83c9f0166b60f7f2ff5a5b15f8d (patch)
tree7aca0f092a1f389a37c46b77e01af399c2e1b17c /src/client.rs
parent486d0a8ef1c2e79473c698bee523e9592a070c5c (diff)
feat: add `right click` input
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs
index 6fe86b6..a1aa250 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -105,7 +105,9 @@ impl Plugin for ClientPlugin {
.add_systems(Update, move_camera)
.add_systems(
FixedPreUpdate,
- buffer_input.in_set(InputSystemSet::BufferInputs),
+ buffer_input
+ .in_set(InputSystemSet::BufferInputs)
+ .before(choose_attack),
)
.add_systems(Last, (gizmos_hover_indicator, gizmos_attack_indicator));
}
@@ -345,6 +347,15 @@ fn buffer_input(
}
}
}
+ } else if mouse_input.just_pressed(MouseButton::Right) {
+ match attack.0 {
+ None => {
+ if let Some(world_position) = cursor_world_position(&windows, &cameras) {
+ client.add_input(Inputs::Imperative(Imperative::WalkTo(world_position)));
+ }
+ }
+ Some(_) => {}
+ }
} else if keyboard_input.just_pressed(KeyCode::KeyS) {
client.add_input(Inputs::Imperative(Imperative::Idle));
} else {