Trigger for OnInteractUsing (#39692)

* Add trigger for InteractOnUsing

* Add blacklist and targetUsed fields

* Update Content.Shared/Trigger/Components/Triggers/TriggerOnInteractUsingComponent.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
ViolentMonk
2025-08-16 14:57:16 -07:00
committed by GitHub
parent 201bc6cc5c
commit 6e8260cf3f
2 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
using Content.Shared.Interaction;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
namespace Content.Shared.Trigger.Components.Triggers;
/// <summary>
/// Triggers when an entity is used to interact with another entity (<see cref="InteractUsingEvent"/>).
/// The user is the player initiating the interaction or the item used, depending on the TargetUsed datafield.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TriggerOnInteractUsingComponent : BaseTriggerOnXComponent
{
/// <summary>
/// Whitelist of entities that can be used to trigger this component.
/// </summary>
/// <remarks>No whitelist check when null.</remarks>
[DataField, AutoNetworkedField]
public EntityWhitelist? Whitelist;
/// <summary>
/// Blacklist of entities that cannot be used to trigger this component.
/// </summary>
/// <remarks>No blacklist check when null.</remarks>
[DataField, AutoNetworkedField]
public EntityWhitelist? Blacklist;
/// <summary>
/// If false, the trigger user will be the user that initiated the interaction.
/// If true, the trigger user will the entity that was used to interact.
/// </summary>
[DataField, AutoNetworkedField]
public bool TargetUsed = false;
}