diff --git a/Content.Server/Interaction/Components/InteractionPopupComponent.cs b/Content.Server/Interaction/Components/InteractionPopupComponent.cs index 1109578179..482d9a11b9 100644 --- a/Content.Server/Interaction/Components/InteractionPopupComponent.cs +++ b/Content.Server/Interaction/Components/InteractionPopupComponent.cs @@ -3,65 +3,64 @@ using Content.Shared.Sound; namespace Content.Server.Interaction.Components; [RegisterComponent, Friend(typeof(InteractionPopupSystem))] +public sealed class InteractionPopupComponent : Component +{ + /// + /// Time delay between interactions to avoid spam. + /// + [DataField("interactDelay")] + [ViewVariables(VVAccess.ReadWrite)] + public TimeSpan InteractDelay = TimeSpan.FromSeconds(1.0); - public sealed class InteractionPopupComponent : Component - { - /// - /// Time delay between interactions to avoid spam. - /// - [DataField("interactDelay")] - [ViewVariables(VVAccess.ReadWrite)] - public TimeSpan InteractDelay = TimeSpan.FromSeconds(1.0); + /// + /// String will be used to fetch the localized message to be played if the interaction succeeds. + /// Nullable in case none is specified on the yaml prototype. + /// + [DataField("interactSuccessString")] + public string? InteractSuccessString; - /// - /// String will be used to fetch the localized message to be played if the interaction succeeds. - /// Nullable in case none is specified on the yaml prototype. - /// - [DataField("interactSuccessString")] - public string? InteractSuccessString; + /// + /// String will be used to fetch the localized message to be played if the interaction fails. + /// Nullable in case no message is specified on the yaml prototype. + /// + [DataField("interactFailureString")] + public string? InteractFailureString; - /// - /// String will be used to fetch the localized message to be played if the interaction fails. - /// Nullable in case no message is specified on the yaml prototype. - /// - [DataField("interactFailureString")] - public string? InteractFailureString; + /// + /// Sound effect to be played when the interaction succeeds. + /// Nullable in case no path is specified on the yaml prototype. + /// + [DataField("interactSuccessSound")] + public SoundSpecifier? InteractSuccessSound; - /// - /// Sound effect to be played when the interaction succeeds. - /// Nullable in case no path is specified on the yaml prototype. - /// - [DataField("interactSuccessSound")] - public SoundSpecifier? InteractSuccessSound; + /// + /// Sound effect to be played when the interaction fails. + /// Nullable in case no path is specified on the yaml prototype. + /// + [DataField("interactFailureSound")] + public SoundSpecifier? InteractFailureSound; - /// - /// Sound effect to be played when the interaction fails. - /// Nullable in case no path is specified on the yaml prototype. - /// - [DataField("interactFailureSound")] - public SoundSpecifier? InteractFailureSound; + /// + /// Chance that an interaction attempt will succeed. + /// 1 = always play "success" popup and sound. + /// 0.5 = 50% chance to play either success or failure popup and sound. + /// 0 = always play "failure" popup and sound. + /// + [DataField("successChance")] + public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype. - /// - /// Chance that an interaction attempt will succeed. - /// 1 = always play "success" popup and sound. - /// 0.5 = 50% chance to play either success or failure popup and sound. - /// 0 = always play "failure" popup and sound. - /// - [DataField("successChance")] - public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype. + /// + /// If set, shows a message to all surrounding players but NOT the current player. + /// + [DataField("messagePerceivedByOthers")] + public string? MessagePerceivedByOthers; - /// - /// If set, shows a message to all surrounding players but NOT the current player. - /// - [DataField("messagePerceivedByOthers")] - public string? MessagePerceivedByOthers; + /// + /// Will the sound effect be perceived by entities not involved in the interaction? + /// + [DataField("soundPerceivedByOthers")] + public bool SoundPerceivedByOthers = true; - /// - /// Will the sound effect be perceived by entities not involved in the interaction? - /// - [DataField("soundPerceivedByOthers")] - public bool SoundPerceivedByOthers = true; - - [ViewVariables(VVAccess.ReadWrite)] - public TimeSpan LastInteractTime; - } + [ViewVariables(VVAccess.ReadWrite)] + public TimeSpan LastInteractTime; +} diff --git a/Content.Server/Interaction/InteractionPopupSystem.cs b/Content.Server/Interaction/InteractionPopupSystem.cs index ec6a3a7357..3172bc3b47 100644 --- a/Content.Server/Interaction/InteractionPopupSystem.cs +++ b/Content.Server/Interaction/InteractionPopupSystem.cs @@ -13,8 +13,8 @@ namespace Content.Server.Interaction; public sealed class InteractionPopupSystem : EntitySystem { [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; public override void Initialize() { @@ -24,7 +24,7 @@ public sealed class InteractionPopupSystem : EntitySystem private void OnInteractHand(EntityUid uid, InteractionPopupComponent component, InteractHandEvent args) { - if (args.Handled) + if (args.Handled || args.User == args.Target) return; var curTime = _gameTiming.CurTime;