diff --git a/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs b/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs index 0e0e48f25d..4fe4709379 100644 --- a/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs +++ b/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs @@ -1,4 +1,5 @@ using Content.Shared.StepTrigger.Systems; +using Content.Shared.Whitelist; using Robust.Shared.GameStates; using Robust.Shared.Serialization; @@ -39,6 +40,12 @@ public sealed class StepTriggerComponent : Component /// [DataField("requiredTriggeredSpeed")] public float RequiredTriggerSpeed = 3.5f; + + /// + /// If any entities occupy the blacklist on the same tile then steptrigger won't work. + /// + [DataField("blacklist")] + public EntityWhitelist? Blacklist; } [RegisterComponent] diff --git a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs index b6398ca21d..44274e0d7c 100644 --- a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs +++ b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs @@ -1,6 +1,8 @@ using Content.Shared.StepTrigger.Components; +using Content.Shared.Tag; using Robust.Shared.Collections; using Robust.Shared.GameStates; +using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; @@ -37,20 +39,38 @@ public sealed class StepTriggerSystem : EntitySystem var query = GetEntityQuery(); var enumerator = EntityQueryEnumerator(); - while (enumerator.MoveNext(out var active, out var trigger, out var transform)) + while (enumerator.MoveNext(out var uid, out var active, out var trigger, out var transform)) { - if (!Update(trigger, transform, query)) + if (!Update(uid, trigger, transform, query)) continue; - RemCompDeferred(trigger.Owner, active); + RemCompDeferred(uid, active); } } - private bool Update(StepTriggerComponent component, TransformComponent transform, EntityQuery query) + private bool Update(EntityUid uid, StepTriggerComponent component, TransformComponent transform, EntityQuery query) { if (!component.Active || component.Colliding.Count == 0) + { return true; + } + + if (component.Blacklist != null && TryComp(transform.GridUid, out var grid)) + { + var anch = grid.GetAnchoredEntitiesEnumerator(grid.LocalToTile(transform.Coordinates)); + + while (anch.MoveNext(out var ent)) + { + if (ent == uid) + continue; + + if (component.Blacklist.IsValid(ent.Value, EntityManager) == true) + { + return false; + } + } + } foreach (var otherUid in component.Colliding) { diff --git a/Resources/Prototypes/Entities/Structures/catwalk.yml b/Resources/Prototypes/Entities/Structures/catwalk.yml index 16b13946ef..3fbe08dd64 100644 --- a/Resources/Prototypes/Entities/Structures/catwalk.yml +++ b/Resources/Prototypes/Entities/Structures/catwalk.yml @@ -22,6 +22,9 @@ - type: FootstepModifier footstepSoundCollection: collection: FootstepCatwalk + - type: Tag + tags: + - Catwalk - type: Construction graph: Catwalk node: Catwalk diff --git a/Resources/Prototypes/Entities/Tiles/lava.yml b/Resources/Prototypes/Entities/Tiles/lava.yml index 5d17c23692..40eac1a751 100644 --- a/Resources/Prototypes/Entities/Tiles/lava.yml +++ b/Resources/Prototypes/Entities/Tiles/lava.yml @@ -9,6 +9,9 @@ - type: StepTrigger requiredTriggeredSpeed: 0 intersectRatio: 0.1 + blacklist: + tags: + - Catwalk - type: Lava - type: Transform anchored: true diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 5e353bf8fd..312d1a197e 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -111,6 +111,10 @@ - type: Tag id: CartridgeRocket +# Allows you to walk over tile entities such as lava without steptrigger +- type: Tag + id: Catwalk + - type: Tag id: Cigarette