refactor AI system

This commit is contained in:
2026-06-15 09:16:56 +02:00
parent 8451f5a281
commit e8dd73bcb0
67 changed files with 1731 additions and 919 deletions

View File

@@ -17,9 +17,9 @@
#include "ScrapSystem.h"
#include "ShipSystem.h"
#include "Simulation.h"
#include "AttackBehavior.h"
#include "StationBodyComponent.h"
#include "Tick.h"
#include "ThreatResponseBehaviorComponent.h"
#include "WeaponComponent.h"
static GameConfig loadConfig()
@@ -80,17 +80,18 @@ struct CombatFixture
void wireEnemyTarget(entt::entity enemy, entt::entity playerTarget)
{
// Set target on weapon child entity (CombatSystem syncs from ThreatResponse each tick,
// but also setting directly ensures the first tick fires without waiting for sync).
// Set the target directly on the weapon child entity. CombatSystem now
// fires at whatever target a weapon already has (AttackExecutor would set
// it in a full tick); setting it here drives CombatSystem in isolation.
const entt::entity wc = findWeaponChild(admin, enemy);
if (wc != entt::null)
{
admin.get<WeaponComponent>(wc).currentTarget = playerTarget;
admin.get<WeaponComponent>(wc).cooldownTicks = 0.0f;
}
if (admin.hasAll<ThreatResponseBehaviorComponent>(enemy))
if (admin.hasAll<AttackBehavior>(enemy))
{
admin.get<ThreatResponseBehaviorComponent>(enemy).currentTarget = playerTarget;
admin.get<AttackBehavior>(enemy).currentTarget = playerTarget;
}
}
};