Move faction exception and everything it needs to shared (#25154)
* move faction prototype to shared * move faction exception and member stuff to shared * fix breaking changes for random stuff * move pettable friend stuff to shared * mostly fix * final fixy * dragonops * final fixy II * use querys and fix warpspeed fish (probably) * fixer * Rrrr! --------- Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
using Content.Server.NPC.Systems;
|
||||
|
||||
namespace Content.Server.NPC.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Prevents an NPC from attacking ignored entities from enemy factions.
|
||||
/// Can be added to if pettable, see PettableFriendComponent.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(NpcFactionSystem))]
|
||||
public sealed partial class FactionExceptionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection of entities that this NPC will refuse to attack
|
||||
/// </summary>
|
||||
[DataField("ignored")]
|
||||
public HashSet<EntityUid> Ignored = new();
|
||||
|
||||
/// <summary>
|
||||
/// Collection of entities that this NPC will attack, regardless of faction.
|
||||
/// </summary>
|
||||
[DataField("hostiles")]
|
||||
public HashSet<EntityUid> Hostiles = new();
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Content.Server.NPC.Systems;
|
||||
|
||||
namespace Content.Server.NPC.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for tracking entities stored in <see cref="FactionExceptionComponent"/>
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(NpcFactionSystem))]
|
||||
public sealed partial class FactionExceptionTrackerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// entities with <see cref="FactionExceptionComponent"/> that are tracking this entity.
|
||||
/// </summary>
|
||||
[DataField("entities")]
|
||||
public HashSet<EntityUid> Entities = new();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using Content.Server.NPC.Systems;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
||||
|
||||
namespace Content.Server.NPC.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[Access(typeof(NpcFactionSystem))]
|
||||
public sealed partial class NpcFactionMemberComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Factions this entity is a part of.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite),
|
||||
DataField("factions", customTypeSerializer:typeof(PrototypeIdHashSetSerializer<NpcFactionPrototype>))]
|
||||
public HashSet<string> Factions = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cached friendly factions.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly HashSet<string> FriendlyFactions = new();
|
||||
|
||||
/// <summary>
|
||||
/// Cached hostile factions.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly HashSet<string> HostileFactions = new();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Server.NPC.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data about this faction's relations with other factions.
|
||||
/// </summary>
|
||||
[Prototype("npcFaction")]
|
||||
public sealed partial class NpcFactionPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("friendly", customTypeSerializer:typeof(PrototypeIdListSerializer<NpcFactionPrototype>))]
|
||||
public List<string> Friendly = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("hostile", customTypeSerializer:typeof(PrototypeIdListSerializer<NpcFactionPrototype>))]
|
||||
public List<string> Hostile = new();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user