diff --git a/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs b/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs index df0c1d7ea4..d12c2c983e 100644 --- a/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs +++ b/Content.Shared/StepTrigger/Components/StepTriggerComponent.cs @@ -54,22 +54,18 @@ public sealed partial class StepTriggerComponent : Component public bool IgnoreWeightless; /// - /// Does this have separate "StepOn" and "StepOff" triggers. + /// Does this have separate "StepOn" and "StepOff" triggers. /// [DataField, AutoNetworkedField] public bool StepOn = false; /// - /// If TriggerGroups is specified, it will check StepTriggerImmunityComponent to have the same TriggerType to activate immunity + /// If TriggerGroups is specified, it will check StepTriggerImmunityComponent to have the same TriggerType to activate immunity /// - // WD EDIT [DataField] public StepTriggerGroup? TriggerGroups; } [RegisterComponent] [Access(typeof(StepTriggerSystem))] -public sealed partial class StepTriggerActiveComponent : Component -{ - -} +public sealed partial class StepTriggerActiveComponent : Component { } diff --git a/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs b/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs index 2a91b4b62e..1b92905fa6 100644 --- a/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs +++ b/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs @@ -18,7 +18,7 @@ namespace Content.Shared.StepTrigger.Components; public sealed partial class StepTriggerImmuneComponent : Component { /// - /// WhiteList of immunity step triggers. + /// WhiteList of immunity step triggers. /// [DataField] public StepTriggerGroup? Whitelist; diff --git a/Content.Shared/StepTrigger/Prototypes/StepTriggerGroup.cs b/Content.Shared/StepTrigger/Prototypes/StepTriggerGroup.cs index 8863a5de61..5b64085e9a 100644 --- a/Content.Shared/StepTrigger/Prototypes/StepTriggerGroup.cs +++ b/Content.Shared/StepTrigger/Prototypes/StepTriggerGroup.cs @@ -1,77 +1,72 @@ -using Content.Shared.Damage.Prototypes; -using Content.Shared.StepTrigger.Components; -using Content.Shared.StepTrigger.Systems; +using Content.Shared.StepTrigger.Components; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; -namespace Content.Shared.StepTrigger.Prototypes +namespace Content.Shared.StepTrigger.Prototypes; + +/// +/// A group of +/// Used to determine StepTriggerTypes like Tags. +/// Used for better work with Immunity. +/// StepTriggerTypes in StepTriggerTypes.yml +/// +/// +/// stepTriggerGroups: +/// types: +/// - Lava +/// - Landmine +/// - Shard +/// - Chasm +/// - Mousetrap +/// - SlipTile +/// - SlipEntity +/// +[DataDefinition] +[Serializable, NetSerializable] +public sealed partial class StepTriggerGroup { + [DataField] + public List>? Types = null; + /// - /// A group of - /// Used to determine StepTriggerTypes like Tags. - /// Used for better work with Immunity. - /// StepTriggerTypes in StepTriggerTypes.yml - /// WD EDIT + /// Checks if types of this StepTriggerGroup is similar to types of AnotherGroup /// - /// - /// stepTriggerGroups: - /// types: - /// - Lava - /// - Landmine - /// - Shard - /// - Chasm - /// - Mousetrap - /// - SlipTile - /// - SlipEntity - /// - [DataDefinition] - [Serializable, NetSerializable] - public sealed partial class StepTriggerGroup + public bool IsValid(StepTriggerGroup? anotherGroup) { - [DataField] - public List>? Types = null; - - /// - /// Checks if types of this StepTriggerGroup is similar to types of AnotherGroup - /// - public bool IsValid(StepTriggerGroup? AnotherGroup) - { - if (Types != null) - { - foreach (var type in Types) - { - if (AnotherGroup != null - && AnotherGroup.Types != null - && AnotherGroup.Types.Contains(type)) - return true; - } - } + if (Types is null) return false; - } - /// - /// Checks validation (if types of this StepTriggerGroup are similar to types of - /// another StepTriggerComponent. - /// - public bool IsValid(StepTriggerComponent component) + foreach (var type in Types) { - if (component.TriggerGroups != null) - { - return IsValid(component.TriggerGroups); - } - return false; + if (anotherGroup != null + && anotherGroup.Types != null + && anotherGroup.Types.Contains(type)) + return true; } + return false; + } - /// - /// Checks validation (if types of this StepTriggerGroup are similar to types of - /// another StepTriggerImmuneComponent. - /// - public bool IsValid(StepTriggerImmuneComponent component) - { - if (component.Whitelist != null) - return IsValid(component.Whitelist); + /// + /// Checks validation (if types of this StepTriggerGroup are similar to types of + /// another StepTriggerComponent. + /// + public bool IsValid(StepTriggerComponent component) + { + if (component.TriggerGroups is null) return false; - } + + return IsValid(component.TriggerGroups); + } + + /// + /// Checks validation (if types of this StepTriggerGroup are similar to types of + /// another StepTriggerImmuneComponent. + /// + public bool IsValid(StepTriggerImmuneComponent component) + { + if (component.Whitelist is null) + return false; + + return IsValid(component.Whitelist); } } diff --git a/Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs b/Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs index 0142d2a453..732eb4b732 100644 --- a/Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs +++ b/Content.Shared/StepTrigger/Prototypes/StepTriggerTypePrototype.cs @@ -1,19 +1,15 @@ using Robust.Shared.Prototypes; -namespace Content.Shared.StepTrigger.Prototypes -{ - /// - /// Prototype representing a StepTriggerType in YAML. - /// Meant to only have an ID property, as that is the only thing that - /// gets saved in StepTriggerGroup. - /// - // WD EDIT - [Prototype("stepTriggerType")] - public sealed partial class StepTriggerTypePrototype : IPrototype - { - [ViewVariables] - [IdDataField] - public string ID { get; private set; } = default!; - } -} +namespace Content.Shared.StepTrigger.Prototypes; +/// +/// Prototype representing a StepTriggerType in YAML. +/// Meant to only have an ID property, as that is the only thing that +/// gets saved in StepTriggerGroup. +/// +[Prototype] +public sealed partial class StepTriggerTypePrototype : IPrototype +{ + [ViewVariables, IdDataField] + public string ID { get; private set; } = default!; +} diff --git a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs index d1ae0e9afb..d0cd5c4b4e 100644 --- a/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs +++ b/Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs @@ -4,7 +4,6 @@ using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; -using Enumerable = System.Linq.Enumerable; namespace Content.Shared.StepTrigger.Systems; @@ -119,7 +118,6 @@ public sealed class StepTriggerSystem : EntitySystem private bool CanTrigger(EntityUid uid, EntityUid otherUid, StepTriggerComponent component) { - // WD EDIT START if (!component.Active || component.CurrentlySteppedOn.Contains(otherUid)) return false; @@ -129,7 +127,6 @@ public sealed class StepTriggerSystem : EntitySystem && component.TriggerGroups != null && component.TriggerGroups.IsValid(stepTriggerImmuneComponent)) return false; - // WD EDIT END // Can't trigger if we don't ignore weightless entities // and the entity is flying or currently weightless diff --git a/Resources/Prototypes/Entities/Effects/chemistry_effects.yml b/Resources/Prototypes/Entities/Effects/chemistry_effects.yml index 29e77c5a29..469bab3278 100644 --- a/Resources/Prototypes/Entities/Effects/chemistry_effects.yml +++ b/Resources/Prototypes/Entities/Effects/chemistry_effects.yml @@ -77,7 +77,7 @@ animationState: foam-dissolve - type: Slippery - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipTile # disabled until foam reagent duplication is fixed diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index eed2b8a58a..01eed04313 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1689,10 +1689,10 @@ - type: FireVisuals sprite: Mobs/Effects/onfire.rsi normalState: Mouse_burning - - type: StepTriggerImmune # WD EDIT START + - type: StepTriggerImmune whitelist: types: - - Landmine # END + - Landmine - type: entity parent: MobMouse diff --git a/Resources/Prototypes/Entities/Mobs/Player/ipc.yml b/Resources/Prototypes/Entities/Mobs/Player/ipc.yml index c69b40c1f8..247226dc7d 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/ipc.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/ipc.yml @@ -111,7 +111,7 @@ - type: OfferItem - type: LayingDown - type: Carriable - - type: StepTriggerImmune #WD EDIT + - type: StepTriggerImmune whitelist: types: - Shard diff --git a/Resources/Prototypes/Entities/Mobs/Species/diona.yml b/Resources/Prototypes/Entities/Mobs/Species/diona.yml index 42383d9a42..81c9e59616 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/diona.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/diona.yml @@ -114,6 +114,10 @@ walkModifier: 0.75 - type: SpeedModifierImmunity - type: NoSlip + - type: StepTriggerImmune + whitelist: + types: + - Shard - type: entity parent: BaseSpeciesDummy diff --git a/Resources/Prototypes/Entities/Mobs/Species/harpy.yml b/Resources/Prototypes/Entities/Mobs/Species/harpy.yml index 5dbeb6a21d..8882da868b 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/harpy.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/harpy.yml @@ -123,7 +123,7 @@ - GalacticCommon - SolCommon - type: StepTriggerImmune - whitelist: # WD EDIT + whitelist: types: - Shard - Landmine diff --git a/Resources/Prototypes/Entities/Objects/Devices/mousetrap.yml b/Resources/Prototypes/Entities/Objects/Devices/mousetrap.yml index 7e3d5c14ab..a93cd545bf 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/mousetrap.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/mousetrap.yml @@ -13,7 +13,7 @@ - type: StepTrigger intersectRatio: 0.2 requiredTriggeredSpeed: 0 - triggerGroups: # WD EDIT + triggerGroups: types: - Mousetrap - type: Mousetrap diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml index 1768af15c2..1a38899783 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml @@ -272,7 +272,7 @@ paralyzeTime: 4 launchForwardsMultiplier: 1.5 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipEntity - type: CollisionWake diff --git a/Resources/Prototypes/Entities/Objects/Fun/dice.yml b/Resources/Prototypes/Entities/Objects/Fun/dice.yml index aba6ebcb4c..f7395ef9ca 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/dice.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/dice.yml @@ -119,7 +119,7 @@ mask: - ItemMask - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - Shard intersectRatio: 0.2 diff --git a/Resources/Prototypes/Entities/Objects/Materials/shards.yml b/Resources/Prototypes/Entities/Objects/Materials/shards.yml index 9e832cd473..3468534314 100644 --- a/Resources/Prototypes/Entities/Objects/Materials/shards.yml +++ b/Resources/Prototypes/Entities/Objects/Materials/shards.yml @@ -64,7 +64,7 @@ - !type:DoActsBehavior acts: [ "Destruction" ] - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - Shard intersectRatio: 0.2 diff --git a/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml b/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml index a6ff916089..97053660a1 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml @@ -40,7 +40,7 @@ params: maxDistance: 10 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - Landmine requiredTriggeredSpeed: 0 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml index f816a37486..5fe88f8d0c 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml @@ -24,7 +24,7 @@ paralyzeTime: 2 launchForwardsMultiplier: 1.5 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipEntity intersectRatio: 0.2 @@ -160,7 +160,7 @@ paralyzeTime: 5 launchForwardsMultiplier: 2.5 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipEntity intersectRatio: 0.04 @@ -204,7 +204,7 @@ - type: Slippery paralyzeTime: 2 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipEntity - type: Item diff --git a/Resources/Prototypes/Entities/Tiles/bananium.yml b/Resources/Prototypes/Entities/Tiles/bananium.yml index 9f1703c516..9e8a46b2c3 100644 --- a/Resources/Prototypes/Entities/Tiles/bananium.yml +++ b/Resources/Prototypes/Entities/Tiles/bananium.yml @@ -47,7 +47,7 @@ paralyzeTime: 2 launchForwardsMultiplier: 1.5 - type: StepTrigger - triggerGroups: # WD EDIT + triggerGroups: types: - SlipTile intersectRatio: 0.2 diff --git a/Resources/Prototypes/Entities/Tiles/chasm.yml b/Resources/Prototypes/Entities/Tiles/chasm.yml index c77228c2d5..85bc7b5ab3 100644 --- a/Resources/Prototypes/Entities/Tiles/chasm.yml +++ b/Resources/Prototypes/Entities/Tiles/chasm.yml @@ -14,7 +14,7 @@ blacklist: tags: - Catwalk - triggerGroups: # WD EDIT + triggerGroups: types: - Chasm - type: Transform diff --git a/Resources/Prototypes/Entities/Tiles/lava.yml b/Resources/Prototypes/Entities/Tiles/lava.yml index 5ede7efa39..9d61304af9 100644 --- a/Resources/Prototypes/Entities/Tiles/lava.yml +++ b/Resources/Prototypes/Entities/Tiles/lava.yml @@ -13,7 +13,7 @@ blacklist: tags: - Catwalk - triggerGroups: # WD EDIT + triggerGroups: types: - Lava - type: Lava diff --git a/Resources/Prototypes/Entities/Tiles/liquid_plasma.yml b/Resources/Prototypes/Entities/Tiles/liquid_plasma.yml index 7b33437b46..500286ead3 100644 --- a/Resources/Prototypes/Entities/Tiles/liquid_plasma.yml +++ b/Resources/Prototypes/Entities/Tiles/liquid_plasma.yml @@ -13,7 +13,7 @@ blacklist: tags: - Catwalk - triggerGroups: # WD EDIT + triggerGroups: types: - Lava - type: Lava diff --git a/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/felinid.yml b/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/felinid.yml index 4f0938d927..411eb13444 100644 --- a/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/felinid.yml +++ b/Resources/Prototypes/Nyanotrasen/Entities/Mobs/Species/felinid.yml @@ -80,7 +80,7 @@ stripTimeReduction: 0 stripTimeMultiplier: 0.667 - type: StepTriggerImmune - whitelist: # WD EDIT + whitelist: types: - Shard - Landmine diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index ed7c0c8a47..fa79666c7a 100644 --- a/Resources/Prototypes/Traits/skills.yml +++ b/Resources/Prototypes/Traits/skills.yml @@ -270,7 +270,7 @@ points: -3 components: - type: StepTriggerImmune - whitelist: # WD EDIT + whitelist: types: - Shard - Landmine