diff --git a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs index 6691be3d67..48ca7fb42e 100644 --- a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs @@ -1,4 +1,5 @@ using Content.Shared.Interaction; +using Content.Shared.Interaction.Events; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.Map; @@ -26,7 +27,7 @@ namespace Content.Shared.SubFloor SubscribeLocalEvent(OnSubFloorStarted); SubscribeLocalEvent(OnSubFloorTerminating); SubscribeLocalEvent(HandleAnchorChanged); - SubscribeLocalEvent(OnInteractionAttempt); + SubscribeLocalEvent(OnInteractionAttempt); } public override void Shutdown() @@ -37,10 +38,11 @@ namespace Content.Shared.SubFloor _mapManager.TileChanged -= MapManagerOnTileChanged; } - private void OnInteractionAttempt(EntityUid uid, SubFloorHideComponent component, InteractUsingEvent args) + private void OnInteractionAttempt(EntityUid uid, SubFloorHideComponent component, GettingInteractedWithAttemptEvent args) { - // TODO make this use an interact attempt event or something. Handling an InteractUsing is not going to work in general. - args.Handled = component.IsUnderCover; + // No interactions with entities hidden under floor tiles. + if (component.BlockInteractions && component.IsUnderCover) + args.Cancel(); } private void OnSubFloorStarted(EntityUid uid, SubFloorHideComponent component, ComponentStartup _) diff --git a/Content.Shared/SubFloor/SubFloorHideComponent.cs b/Content.Shared/SubFloor/SubFloorHideComponent.cs index a0b97992f4..710c2abf7f 100644 --- a/Content.Shared/SubFloor/SubFloorHideComponent.cs +++ b/Content.Shared/SubFloor/SubFloorHideComponent.cs @@ -20,6 +20,15 @@ namespace Content.Shared.SubFloor [ViewVariables] public bool IsUnderCover { get; set; } = false; + /// + /// Whether interactions with this entity should be blocked while it is under floor tiles. + /// + /// + /// Useful for entities like vents, which are only partially hidden. + /// + [DataField("blockInteractions")] + public bool BlockInteractions { get; set; } = true; + /// /// When revealed using some scanning tool, what transparency should be used to draw this item? /// diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index 26e00179a9..281f1d3031 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -6,6 +6,8 @@ mode: SnapgridCenter components: - type: AtmosDevice + - type: SubFloorHide + blockInteractions: false - type: NodeContainer nodes: inlet: diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml index 299acf45c6..329596dda9 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml @@ -6,6 +6,8 @@ mode: SnapgridCenter components: - type: AtmosDevice + - type: SubFloorHide + blockInteractions: false - type: NodeContainer nodes: inlet: diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index d00ebf0bd4..2f74a03beb 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -6,6 +6,8 @@ mode: SnapgridCenter components: - type: AtmosDevice + - type: SubFloorHide + blockInteractions: false - type: NodeContainer nodes: pipe: