From 0436c10a90db450bdaf75ac43608e094bd9f0e8f Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sun, 17 Mar 2024 08:14:27 +0100 Subject: feat: meele attack --- src/server.rs | 8 +++++++- src/shared/projectile.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index 1fe20a4..d9f2653 100644 --- a/src/server.rs +++ b/src/server.rs @@ -269,13 +269,19 @@ fn imperative_attack_attack( }; if cooldown.a_cooldown.is_zero() { cooldown.a_cooldown = Duration::from_secs_f32(1.5); + let instant = *champion == Champion::Meele; commands.spawn(ProjectileBundle { projectile: Projectile { target_player, source_player: *id, damage: 4., + instant, }, - position: ProjectilePosition(position.0), + position: ProjectilePosition(if instant { + target_position.0 + } else { + position.0 + }), replicate: Replicate::default(), }); } diff --git a/src/shared/projectile.rs b/src/shared/projectile.rs index 2e9c6c3..16a064a 100644 --- a/src/shared/projectile.rs +++ b/src/shared/projectile.rs @@ -12,6 +12,7 @@ pub struct Projectile { pub target_player: PlayerId, pub source_player: PlayerId, pub damage: f32, + pub instant: bool, } #[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)] -- cgit v1.2.3