make stations not attack other stations

This commit is contained in:
2026-04-21 21:42:54 +02:00
parent 6321e13a00
commit 2523cd6a1b
2 changed files with 4 additions and 29 deletions

View File

@@ -121,8 +121,7 @@ void CombatSystem::resolveStationWeapon(Building& station, Tick currentTick,
// Acquire a new target if needed.
if (!w.currentTarget)
{
w.currentTarget = acquireStationTarget(station, stationIsEnemy,
ships, buildings);
w.currentTarget = acquireStationTarget(station, stationIsEnemy, ships);
}
if (!w.currentTarget)
@@ -174,8 +173,7 @@ void CombatSystem::resolveStationWeapon(Building& station, Tick currentTick,
std::optional<EntityId> CombatSystem::acquireStationTarget(
const Building& station, bool stationIsEnemy,
const ShipSystem& ships,
const BuildingSystem& buildings) const
const ShipSystem& ships) const
{
const QVector2D stationCenter(
station.anchor.x() + station.footprint.width() / 2.0f,
@@ -202,27 +200,6 @@ std::optional<EntityId> CombatSystem::acquireStationTarget(
}
}
// Enemy stations also target player buildings (HQ, PlayerDefenceStation).
if (stationIsEnemy)
{
for (const Building& b : buildings.allBuildings())
{
if (b.type != BuildingType::Hq &&
b.type != BuildingType::PlayerDefenceStation)
{
continue;
}
const QVector2D bCenter(b.anchor.x() + b.footprint.width() / 2.0f,
b.anchor.y() + b.footprint.height() / 2.0f);
const float dist = (bCenter - stationCenter).length();
if (dist < bestDist)
{
bestDist = dist;
best = b.id;
}
}
}
return best;
}