Files
tbd-station-14/Content.Shared/Actions/EntityWorldTargetActionComponent.cs
ShadowCommander 1df84515c7 Add EntityWorldTargetAction (#29819)
* Add EntityWorldTargetAction initial implementation

* Update obsolete methods

* Partially working EntityWorldTargetAction

* Fix entity selection

* Move and clean up AfterInteract

* Fix building new walls

* Readd no entity or coordinates error

* Consolidate action validation code

* Add summaries to component

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
2024-08-08 12:47:08 +03:00

43 lines
1.4 KiB
C#

using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Actions;
/// <summary>
/// Used on action entities to define an action that triggers when targeting an entity or entity coordinates.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class EntityWorldTargetActionComponent : BaseTargetActionComponent
{
public override BaseActionEvent? BaseEvent => Event;
/// <summary>
/// The local-event to raise when this action is performed.
/// </summary>
[DataField]
[NonSerialized]
public EntityWorldTargetActionEvent? Event;
/// <summary>
/// Determines which entities are valid targets for this action.
/// </summary>
/// <remarks>No whitelist check when null.</remarks>
[DataField] public EntityWhitelist? Whitelist;
/// <summary>
/// Whether this action considers the user as a valid target entity when using this action.
/// </summary>
[DataField] public bool CanTargetSelf = true;
}
[Serializable, NetSerializable]
public sealed class EntityWorldTargetActionComponentState(
EntityWorldTargetActionComponent component,
IEntityManager entManager)
: BaseActionComponentState(component, entManager)
{
public EntityWhitelist? Whitelist = component.Whitelist;
public bool CanTargetSelf = component.CanTargetSelf;
}