diff options
-rw-r--r-- | sim/include/kurator/sim/components.h | 1 | ||||
-rw-r--r-- | sim/src/BaseBattle.cpp | 2 | ||||
-rw-r--r-- | sim/src/Builder.cpp | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/sim/include/kurator/sim/components.h b/sim/include/kurator/sim/components.h index 41c8053..6fbab55 100644 --- a/sim/include/kurator/sim/components.h +++ b/sim/include/kurator/sim/components.h @@ -27,6 +27,7 @@ struct Team struct AIState { + double keep_at_range; Point destination; entt::entity target = entt::null; }; diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp index 448a5d7..945ef89 100644 --- a/sim/src/BaseBattle.cpp +++ b/sim/src/BaseBattle.cpp @@ -78,7 +78,7 @@ BaseBattle::keep_at_range() continue; const auto target = _registry.get<Transform>(ai.target); const Point offset = target.position - self.position; - ai.destination = target.position - offset.normalized().scale(6000.0); + ai.destination = target.position - offset.normalized().scale(ai.keep_at_range); } } diff --git a/sim/src/Builder.cpp b/sim/src/Builder.cpp index dd10326..a5319fd 100644 --- a/sim/src/Builder.cpp +++ b/sim/src/Builder.cpp @@ -36,7 +36,7 @@ Builder::operator()(const universe::ShipType& ship_type, const int team) const ship_type.max_speed * 2.0, ship_type.max_speed * 3.0, 100.0); - registry.emplace<AIState>(entity, Point{0.0, 0.0}); + registry.emplace<AIState>(entity, 6000.0, Point{0.0, 0.0}); registry.emplace<HitPoints>(entity, ship_type.base_health_points); return entity; } |