fix fish petting (#16094)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
using System.Linq;
|
|
||||||
using Content.Server.NPC.Components;
|
using Content.Server.NPC.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Content.Server.NPC.Systems;
|
||||||
|
|
||||||
namespace Content.Server.NPC.Systems
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Outlines faction relationships with each other.
|
/// Outlines faction relationships with each other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class FactionSystem : EntitySystem
|
public sealed class FactionSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
[Dependency] private readonly FactionExceptionSystem _factionException = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||||
|
|
||||||
private ISawmill _sawmill = default!;
|
private ISawmill _sawmill = default!;
|
||||||
|
|
||||||
@@ -115,7 +116,14 @@ namespace Content.Server.NPC.Systems
|
|||||||
if (!Resolve(entity, ref component, false))
|
if (!Resolve(entity, ref component, false))
|
||||||
return Array.Empty<EntityUid>();
|
return Array.Empty<EntityUid>();
|
||||||
|
|
||||||
return GetNearbyFactions(entity, range, component.HostileFactions);
|
var hostiles = GetNearbyFactions(entity, range, component.HostileFactions);
|
||||||
|
if (TryComp<FactionExceptionComponent>(entity, out var factionException))
|
||||||
|
{
|
||||||
|
// ignore anything from enemy faction that we are explicitly friendly towards
|
||||||
|
return hostiles.Where(target => !_factionException.IsIgnored(factionException, target));
|
||||||
|
}
|
||||||
|
|
||||||
|
return hostiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<EntityUid> GetNearbyFriendlies(EntityUid entity, float range, FactionComponent? component = null)
|
public IEnumerable<EntityUid> GetNearbyFriendlies(EntityUid entity, float range, FactionComponent? component = null)
|
||||||
@@ -218,4 +226,4 @@ namespace Content.Server.NPC.Systems
|
|||||||
RefreshFactions();
|
RefreshFactions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user