diff --git a/Content.Server/Psionics/PsionicsSystem.cs b/Content.Server/Psionics/PsionicsSystem.cs
index 41ff6c30a19..a0844bf4ea6 100644
--- a/Content.Server/Psionics/PsionicsSystem.cs
+++ b/Content.Server/Psionics/PsionicsSystem.cs
@@ -274,6 +274,9 @@ private void OnMobstateChanged(EntityUid uid, PsionicComponent component, MobSta
}
}
+ ///
+ /// When a caster with active summons is attacked, aggro their familiars to the attacker.
+ ///
private void OnDamageChanged(EntityUid uid, PsionicComponent component, DamageChangedEvent args)
{
if (component.Familiars.Count <= 0
@@ -282,15 +285,12 @@ private void OnDamageChanged(EntityUid uid, PsionicComponent component, DamageCh
|| args.Origin is not { } origin)
return;
- foreach (var familiar in component.Familiars)
- {
- if (!TryComp(familiar, out var retaliationComponent))
- continue;
-
- _retaliationSystem.TryRetaliate(familiar, origin, retaliationComponent);
- }
+ SetFamiliarTarget(origin, component);
}
+ ///
+ /// When a caster with active summons attempts to attack something, aggro their familiars to the target.
+ ///
private void OnAttackAttempt(EntityUid uid, PsionicComponent component, AttackAttemptEvent args)
{
if (component.Familiars.Count <= 0
@@ -299,6 +299,11 @@ private void OnAttackAttempt(EntityUid uid, PsionicComponent component, AttackAt
|| component.Familiars.Contains(target))
return;
+ SetFamiliarTarget(target, component);
+ }
+
+ private void SetFamiliarTarget(EntityUid target, PsionicComponent component)
+ {
foreach (var familiar in component.Familiars)
{
if (!TryComp(familiar, out var retaliationComponent))