summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-27 00:27:39 +0100
committerAki <please@ignore.pl>2023-01-27 00:27:39 +0100
commit75440771ca95a28556586233a0a8399022a5559f (patch)
treeb2cbadb1937eba2aa914030e6048b2b78a84fa6f /sim
parenta40e6361ba7172e0a3f3b16e2d286db9928e94e2 (diff)
downloadkurator-75440771ca95a28556586233a0a8399022a5559f.zip
kurator-75440771ca95a28556586233a0a8399022a5559f.tar.gz
kurator-75440771ca95a28556586233a0a8399022a5559f.tar.bz2
Added effective range calculation for turrets
This is now used when deciding if turret should start shooting or not.
Diffstat (limited to 'sim')
-rw-r--r--sim/src/Builder.cpp2
-rw-r--r--sim/src/TurretControl.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/sim/src/Builder.cpp b/sim/src/Builder.cpp
index e6984fe..b5762b3 100644
--- a/sim/src/Builder.cpp
+++ b/sim/src/Builder.cpp
@@ -38,7 +38,7 @@ Builder::operator()(const universe::ShipType& ship_type, const int team) const
ship_type.max_speed,
ship_type.max_speed * 2.0,
ship_type.max_speed * 3.0);
- registry.emplace<AIState>(entity, 6000.0, Point{0.0, 0.0});
+ registry.emplace<AIState>(entity, 15000.0, Point{0.0, 0.0});
registry.emplace<HitPoints>(
entity,
ship_type.base_shield_points,
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp
index e2596c8..bfac27f 100644
--- a/sim/src/TurretControl.cpp
+++ b/sim/src/TurretControl.cpp
@@ -34,7 +34,7 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co
continue;
const auto& target = registry.get<Transform>(state.target);
const auto distance = transform.position.distance(target.position);
- if (distance > def.optimal_range * 2.5)
+ if (distance > def.effective_range())
continue;
auto remaining_dt = dt;
while (remaining_dt > 0.0) {