using Content.Shared.DoAfter; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared._NF.Interaction.Components; /// /// A component for RP fluff items. /// These don't do much mechanically - they display context-sensitive popups for a target /// display a popup after some amount of time and optionally trigger other things. /// [RegisterComponent, NetworkedComponent] public sealed partial class InteractionPopupOnUseComponent : Component { /// /// An optional whitelist for entities this can be used on. /// [DataField] public EntityWhitelist? Whitelist; /// /// The maximum distance this item can be used at. /// [DataField] public float MaxDistance = 1; /// /// Parameters for use on yourself. Null if cannot be used on yourself. /// [DataField] public InteractionData? Self; /// /// Parameters for use on others. Null if cannot be used on others. /// [DataField] public InteractionData? Others; /// /// Verb text to show when using. /// [DataField] public LocId? VerbUse; /// /// Sound effect to be played when the interaction succeeds. /// Nullable in case no path is specified on the yaml prototype. /// [DataField] public SoundSpecifier? InteractSuccessSound; /// /// Sound effect to be played when the interaction fails. /// Nullable in case no path is specified on the yaml prototype. /// [DataField] public SoundSpecifier? InteractFailureSound; /// /// A prototype that will spawn upon successful interaction (as planned only for special effects) /// [DataField] public EntProtoId? InteractSuccessSpawn; /// /// A prototype that will spawn upon failure interaction (as planned only for special effects) /// [DataField] public EntProtoId? InteractFailureSpawn; /// /// Probability (0-1) that an interaction attempt will succeed. /// [DataField] public float SuccessChance = 1.0f; /// /// Will the sound effect be perceived by entities not involved in the interaction? /// [DataField] public bool SoundPerceivedByOthers = true; } [DataDefinition] public partial record struct InteractionData { /// /// The message to display when starting the doafter. /// If UseOnSelfDelay is <= 0, this will not appear. /// [DataField] public TimeSpan Delay; [DataField] public LocId? WhitelistFailed; [DataField] public InteractionMessageSet Actor; /// /// Self-interactions will never invoke the target message set. /// [DataField] public InteractionMessageSet Target; [DataField] public InteractionMessageSet Observers; } [DataDefinition] public partial record struct InteractionMessageSet { /// /// The message to display when starting the doafter. /// If UseOnSelfDelay is <= 0, this will not appear. /// [DataField] public LocId? Start; [DataField] public LocId? Success; [DataField] public LocId? Failure; } [Serializable, NetSerializable] public sealed partial class InteractionPopupOnUseDoAfterEvent : SimpleDoAfterEvent;