fix issue where repair behavior targets enemy HQ in balancing target

This commit is contained in:
2026-06-19 21:36:04 +02:00
parent 9573b9789a
commit 4818997164
3 changed files with 58 additions and 2 deletions

View File

@@ -23,10 +23,14 @@ std::vector<RepairableInfo> buildRepairables(EntityAdmin& admin)
});
admin.forEach<StationBodyComponent, PositionComponent, FactionComponent, HealthComponent>(
[&repairables](entt::entity e, const StationBodyComponent& /*sb*/,
[&repairables, &admin](entt::entity e, const StationBodyComponent& /*sb*/,
const PositionComponent& pos, const FactionComponent& f,
const HealthComponent& h)
{
// The HQ is not a repair target — only ships and defence stations are
// (REQ-SHP-REPAIR). In the balancing arena the HQ is spawned as a station,
// so it is identified by its HqProxyComponent tag.
if (admin.hasAll<HqProxyComponent>(e)) { return; }
repairables.push_back({e, pos.value, f.isEnemy, false, h.hp, h.maxHp});
});
@@ -52,9 +56,13 @@ std::vector<CombatantInfo> buildCombatants(EntityAdmin& admin)
});
admin.forEach<PositionComponent, FactionComponent, HqProxyComponent>(
[&combatants](entt::entity e, const PositionComponent& pos,
[&combatants, &admin](entt::entity e, const PositionComponent& pos,
const FactionComponent& f, const HqProxyComponent& /*hq*/)
{
// An arena HQ carries both StationBodyComponent and HqProxyComponent; it
// is already listed by the station pass above, so skip it here to avoid
// counting it twice.
if (admin.hasAll<StationBodyComponent>(e)) { return; }
combatants.push_back({e, pos.value, f.isEnemy, true});
});