From 09c65f2822b99e43ccbc20a84998b1cc3e26eae8 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 28 Feb 2023 01:17:48 +0100 Subject: Added tracking to damage calculations --- sim/src/TurretControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sim/src') diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp index ba54f3f..51f2a46 100644 --- a/sim/src/TurretControl.cpp +++ b/sim/src/TurretControl.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,8 @@ TurretControl::update(State& ctx) control.rounds = def.rounds; if (control.rounds > 0 && consume(remaining_dt, control.delay)) { auto& target_points = ctx.registry.get(state.target); - auto damage = def.effective_damage(distance); + const auto& movement = ctx.registry.get(state.target); + auto damage = def.effective_damage(distance, movement.speed.magnitude()); if (damage > 0.0) { damage = target_points.deal(damage); ctx.dispatcher.trigger(Hit{damage, control.owner, state.target}); -- cgit v1.1