refactor AI system
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include "PositionComponent.h"
|
||||
#include "SensorRangeComponent.h"
|
||||
#include "ShipIdentityComponent.h"
|
||||
#include "ThreatResponseBehaviorComponent.h"
|
||||
#include "tracing.h"
|
||||
#include "WeaponComponent.h"
|
||||
|
||||
@@ -25,14 +24,11 @@ void CombatSystem::tick(Tick currentTick,
|
||||
{
|
||||
TRACE();
|
||||
// All weapons (ships and stations) are child entities linked via ModuleOwnerComponent.
|
||||
// AttackExecutor has already set each weapon's preferred (in-range) target; here we
|
||||
// validate it, fall back to nearest-target acquisition, and fire.
|
||||
admin.forEach<WeaponComponent, ModuleOwnerComponent>(
|
||||
[&](entt::entity /*e*/, WeaponComponent& weapon, const ModuleOwnerComponent& owner)
|
||||
{
|
||||
if (admin.hasAll<ThreatResponseBehaviorComponent>(owner.owner))
|
||||
{
|
||||
weapon.currentTarget =
|
||||
admin.get<ThreatResponseBehaviorComponent>(owner.owner).currentTarget;
|
||||
}
|
||||
const PositionComponent& pos = admin.get<PositionComponent>(owner.owner);
|
||||
const FactionComponent& faction = admin.get<FactionComponent>(owner.owner);
|
||||
resolveWeapon(owner.owner, weapon, pos, faction, currentTick, admin, outWeaponFiredEvents);
|
||||
|
||||
Reference in New Issue
Block a user