diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-17 08:14:27 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-17 08:14:27 +0100 |
commit | 0436c10a90db450bdaf75ac43608e094bd9f0e8f (patch) | |
tree | 092dd9cc37b0c7f8b70a8aa61a32222c14dfb85f | |
parent | 1812cafee45128d823a00fd19efb736aa1306b28 (diff) |
feat: meele attack
-rw-r--r-- | src/server.rs | 8 | ||||
-rw-r--r-- | src/shared/projectile.rs | 1 |
2 files changed, 8 insertions, 1 deletions
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)] |