Refactor actions to be entities with components (#19900)
This commit is contained in:
35
Content.Shared/Actions/EntityTargetActionComponent.cs
Normal file
35
Content.Shared/Actions/EntityTargetActionComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Actions;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class EntityTargetActionComponent : BaseTargetActionComponent
|
||||
{
|
||||
public override BaseActionEvent? BaseEvent => Event;
|
||||
|
||||
/// <summary>
|
||||
/// The local-event to raise when this action is performed.
|
||||
/// </summary>
|
||||
[DataField("event")]
|
||||
[NonSerialized]
|
||||
public EntityTargetActionEvent? Event;
|
||||
|
||||
[DataField("whitelist")] public EntityWhitelist? Whitelist;
|
||||
|
||||
[DataField("canTargetSelf")] public bool CanTargetSelf = true;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class EntityTargetActionComponentState : BaseActionComponentState
|
||||
{
|
||||
public EntityWhitelist? Whitelist;
|
||||
public bool CanTargetSelf;
|
||||
|
||||
public EntityTargetActionComponentState(EntityTargetActionComponent component) : base(component)
|
||||
{
|
||||
Whitelist = component.Whitelist;
|
||||
CanTargetSelf = component.CanTargetSelf;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user