summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-02-28 01:17:48 +0100
committerAki <please@ignore.pl>2023-02-28 01:17:48 +0100
commit09c65f2822b99e43ccbc20a84998b1cc3e26eae8 (patch)
treed8bcf0886ca04c90bffa09ec0861e9d0368b2bc2 /sim
parent4e1f59b5c6689e38023f12daee7d5c6f3d4715e5 (diff)
downloadkurator-09c65f2822b99e43ccbc20a84998b1cc3e26eae8.zip
kurator-09c65f2822b99e43ccbc20a84998b1cc3e26eae8.tar.gz
kurator-09c65f2822b99e43ccbc20a84998b1cc3e26eae8.tar.bz2
Added tracking to damage calculations
Diffstat (limited to 'sim')
-rw-r--r--sim/src/TurretControl.cpp4
1 files changed, 3 insertions, 1 deletions
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 <kurator/sim/TurretControl.h>
#include <kurator/sim/components.h>
+#include <kurator/sim/FloatingMovement.h>
#include <kurator/sim/HitPoints.h>
#include <kurator/sim/events.h>
#include <kurator/sim/State.h>
@@ -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<HitPoints>(state.target);
- auto damage = def.effective_damage(distance);
+ const auto& movement = ctx.registry.get<FloatingMovement>(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});