Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Perpetuum/Zones/NpcSystem/AI/AggressorAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public override void Update(TimeSpan time)
return;
}

if (smartCreature.HasFriendsNeedingSupport())
{
smartCreature.AI.Push(new SupportAI(smartCreature));

return;
}

if (!smartCreature.ThreatManager.IsThreatened)
{
ReturnToHomePosition();
Expand Down
16 changes: 12 additions & 4 deletions src/Perpetuum/Zones/NpcSystem/AI/CombatAI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Perpetuum.Collections;
using Perpetuum.Modules;
using Perpetuum.Modules.Weapons;
using Perpetuum.PathFinders;
using Perpetuum.Timers;
Expand Down Expand Up @@ -39,9 +40,7 @@ public CombatAI(SmartCreature smartCreature) : base(smartCreature) { }
public override void Enter()
{
stratSelector = InitSelector();
moduleActivators = smartCreature.ActiveModules
.Select(m => new ModuleActivator(m))
.ToList();
moduleActivators = BuildCombatModuleActivators();
IsNpcHasMissiles = smartCreature.ActiveModules
.OfType<MissileWeaponModule>()
.Any();
Expand All @@ -53,7 +52,16 @@ public override void Enter()

protected override List<ModuleActivator> FillModuleActivators()
{
return moduleActivators = smartCreature.ActiveModules
return moduleActivators = BuildCombatModuleActivators();
}

// Remote support modules are owned exclusively by SupportAI — without this
// filter the standard ModuleActivator visitors would happily target the
// current combat lock, healing/energy-feeding the enemy.
private List<ModuleActivator> BuildCombatModuleActivators()
{
return smartCreature.ActiveModules
.Where(m => m is not RemoteArmorRepairModule && m is not EnergyTransfererModule)
.Select(m => new ModuleActivator(m))
.ToList();
}
Expand Down
7 changes: 7 additions & 0 deletions src/Perpetuum/Zones/NpcSystem/AI/IdleAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public override void Update(TimeSpan time)
return;
}

if (smartCreature.HasFriendsNeedingSupport())
{
smartCreature.AI.Push(new SupportAI(smartCreature));

return;
}

if (smartCreature.ThreatManager.IsThreatened)
{
ToAggressorAI();
Expand Down
1 change: 0 additions & 1 deletion src/Perpetuum/Zones/NpcSystem/AI/ModuleActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Perpetuum.Timers;
using Perpetuum.Zones.Locking.Locks;
using Perpetuum.Zones.Terrains;
using System;

namespace Perpetuum.Zones.NpcSystem.AI
{
Expand Down
Loading
Loading