summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-04-24 23:55:02 +0200
committerAki <please@ignore.pl>2024-04-05 19:41:19 +0200
commit94d6d863e1b78766cdb5f286e3d9f374c02c5d33 (patch)
treedc6584452463e592e2674dd3e7536cc7cac2158b /sim/src
parent975339d07aeb193564221adff31b55a913d92a1e (diff)
downloadkurator-94d6d863e1b78766cdb5f286e3d9f374c02c5d33.zip
kurator-94d6d863e1b78766cdb5f286e3d9f374c02c5d33.tar.gz
kurator-94d6d863e1b78766cdb5f286e3d9f374c02c5d33.tar.bz2
Fixed Turrets percepting time too fast
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/weapons.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/sim/src/weapons.cpp b/sim/src/weapons.cpp
index bd130dc..28fc6fa 100644
--- a/sim/src/weapons.cpp
+++ b/sim/src/weapons.cpp
@@ -22,8 +22,7 @@ static bool reload_(float& dt, Turret& turret);
void
Turret::shoot_at(State& ctx, const entt::entity& target, const double distance)
{
- float remaining_dt = ctx.clock.dt;
- while (reload_(remaining_dt, *this)) {
+ while (reload_(action, *this)) {
auto& target_points = ctx.registry.get<HitPoints>(target);
const auto& movement = ctx.registry.get<FloatingMovement>(target);
auto damage = type.effective_damage(distance, movement.speed.magnitude());
@@ -47,11 +46,11 @@ update_turrets(State& ctx)
ctx.registry.destroy(entity);
continue;
}
- float remaining_dt = ctx.clock.dt;
- while (remaining_dt > 0.0) {
- if (reload_(remaining_dt, turret))
+ while (turret.action > 0.0) {
+ if (reload_(turret.action, turret))
break;
}
+ turret.action = ctx.clock.dt;
}
}