use meters in config
This commit is contained in:
@@ -132,7 +132,7 @@ void AiSystem::tickThreatResponseBehavior(EntityAdmin& admin, const BuildingSyst
|
||||
PositionComponent& pos, FactionComponent& faction,
|
||||
SensorRangeComponent& sensor, MovementIntentComponent& intent)
|
||||
{
|
||||
const float range = sensor.value;
|
||||
const float range = sensor.value_tiles;
|
||||
|
||||
// Validate current target.
|
||||
bool targetValid = false;
|
||||
@@ -251,7 +251,7 @@ void AiSystem::tickRepairBehavior(EntityAdmin& admin, BuildingSystem& buildings)
|
||||
bool enemyNearby = false;
|
||||
for (const EnemyInfo& enemy : enemies)
|
||||
{
|
||||
if ((enemy.position - pos.value).length() <= sensor.value)
|
||||
if ((enemy.position - pos.value).length() <= sensor.value_tiles)
|
||||
{
|
||||
enemyNearby = true;
|
||||
break;
|
||||
@@ -285,7 +285,7 @@ void AiSystem::tickRepairBehavior(EntityAdmin& admin, BuildingSystem& buildings)
|
||||
if (!targetValid)
|
||||
{
|
||||
rb.currentTarget = std::nullopt;
|
||||
float bestDist = sensor.value;
|
||||
float bestDist = sensor.value_tiles;
|
||||
|
||||
for (const RepairableInfo& r : repairables)
|
||||
{
|
||||
@@ -355,7 +355,7 @@ void AiSystem::tickRepairTools(EntityAdmin& admin)
|
||||
const float dist =
|
||||
(admin.get<PositionComponent>(preferred).value
|
||||
- ownerPos.value).length();
|
||||
if (th.hp > 0.0f && th.hp < th.maxHp && dist <= rt.range)
|
||||
if (th.hp > 0.0f && th.hp < th.maxHp && dist <= rt.range_tiles)
|
||||
{
|
||||
rt.currentTarget = rb.currentTarget;
|
||||
th.hp = std::min(th.hp + rt.ratePerTick, th.maxHp);
|
||||
@@ -366,7 +366,7 @@ void AiSystem::tickRepairTools(EntityAdmin& admin)
|
||||
|
||||
// Preferred target unavailable; scan for nearest damaged friendly in range.
|
||||
rt.currentTarget = std::nullopt;
|
||||
float bestDist = rt.range;
|
||||
float bestDist = rt.range_tiles;
|
||||
for (const RepairableInfo& r : repairables)
|
||||
{
|
||||
if (r.isEnemy) { continue; }
|
||||
@@ -441,7 +441,7 @@ void AiSystem::tickSalvageBehavior(EntityAdmin& admin, ScrapSystem& scraps,
|
||||
PositionComponent& pos,
|
||||
SensorRangeComponent& sensor, MovementIntentComponent& intent)
|
||||
{
|
||||
const float collectRange = salvageBehavior.maxCollectionRange;
|
||||
const float collectRange = salvageBehavior.maxCollectionRange_tiles;
|
||||
const AggregatedCargo& cargoState = cargoByShip[e];
|
||||
|
||||
// Assign nearest SalvageBay if needed.
|
||||
@@ -530,7 +530,7 @@ void AiSystem::tickSalvageBehavior(EntityAdmin& admin, ScrapSystem& scraps,
|
||||
}
|
||||
for (const ScrapInfo& si : allScrap)
|
||||
{
|
||||
if ((si.position - pos.value).length() > c.collectionRange) { continue; }
|
||||
if ((si.position - pos.value).length() > c.collectionRange_tiles) { continue; }
|
||||
if (scraps.consume(si.entity))
|
||||
{
|
||||
++c.current;
|
||||
@@ -555,7 +555,7 @@ void AiSystem::tickSalvageBehavior(EntityAdmin& admin, ScrapSystem& scraps,
|
||||
}
|
||||
else
|
||||
{
|
||||
float bestDist = sensor.value;
|
||||
float bestDist = sensor.value_tiles;
|
||||
std::optional<QVector2D> bestPos;
|
||||
for (const ScrapInfo& si : allScrap)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user