Fixes Borgs and Syndicats getting hurt by glass shards and other things + honkbot slipping 2 (#31011)

* Lets do this again

* I noticed this way to late
This commit is contained in:
Verm
2024-09-10 21:12:08 -05:00
committed by GitHub
parent 4f7d3318b9
commit 14d5bbb8cb
15 changed files with 30 additions and 47 deletions

View File

@@ -4,7 +4,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.StepTrigger.Components; namespace Content.Shared.StepTrigger.Components;
/// <summary> /// <summary>
/// This is used for marking step trigger events that require the user to wear shoes, such as for glass shards. /// This is used for marking step trigger events that require the user to wear shoes or have protection of some sort, such as for glass shards.
/// </summary> /// </summary>
[RegisterComponent, NetworkedComponent] [RegisterComponent, NetworkedComponent]
public sealed partial class ClothingRequiredStepTriggerComponent : Component; public sealed partial class PreventableStepTriggerComponent : Component;

View File

@@ -5,11 +5,11 @@ using Robust.Shared.GameStates;
namespace Content.Shared.StepTrigger.Components; namespace Content.Shared.StepTrigger.Components;
/// <summary> /// <summary>
/// This is used for cancelling step trigger events if the user is wearing clothing in a valid slot. /// This is used for cancelling preventable step trigger events if the user is wearing clothing in a valid slot or if the user itself has the component.
/// </summary> /// </summary>
[RegisterComponent, NetworkedComponent] [RegisterComponent, NetworkedComponent]
[Access(typeof(StepTriggerImmuneSystem))] [Access(typeof(StepTriggerImmuneSystem))]
public sealed partial class ClothingRequiredStepTriggerImmuneComponent : Component, IClothingSlots public sealed partial class ProtectedFromStepTriggersComponent : Component, IClothingSlots
{ {
[DataField] [DataField]
public SlotFlags Slots { get; set; } = SlotFlags.FEET; public SlotFlags Slots { get; set; } = SlotFlags.FEET;

View File

@@ -1,9 +0,0 @@
using Robust.Shared.GameStates;
namespace Content.Shared.StepTrigger.Components;
/// <summary>
/// Grants the attached entity to step triggers.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class StepTriggerImmuneComponent : Component;

View File

@@ -1,7 +1,6 @@
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.StepTrigger.Components; using Content.Shared.StepTrigger.Components;
using Content.Shared.Tag;
namespace Content.Shared.StepTrigger.Systems; namespace Content.Shared.StepTrigger.Systems;
@@ -12,25 +11,19 @@ public sealed class StepTriggerImmuneSystem : EntitySystem
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<StepTriggerImmuneComponent, StepTriggerAttemptEvent>(OnStepTriggerAttempt); SubscribeLocalEvent<PreventableStepTriggerComponent, StepTriggerAttemptEvent>(OnStepTriggerClothingAttempt);
SubscribeLocalEvent<ClothingRequiredStepTriggerComponent, StepTriggerAttemptEvent>(OnStepTriggerClothingAttempt); SubscribeLocalEvent<PreventableStepTriggerComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ClothingRequiredStepTriggerComponent, ExaminedEvent>(OnExamined);
} }
private void OnStepTriggerAttempt(Entity<StepTriggerImmuneComponent> ent, ref StepTriggerAttemptEvent args) private void OnStepTriggerClothingAttempt(Entity<PreventableStepTriggerComponent> ent, ref StepTriggerAttemptEvent args)
{ {
args.Cancelled = true; if (HasComp<ProtectedFromStepTriggersComponent>(args.Tripper) || _inventory.TryGetInventoryEntity<ProtectedFromStepTriggersComponent>(args.Tripper, out _))
}
private void OnStepTriggerClothingAttempt(EntityUid uid, ClothingRequiredStepTriggerComponent component, ref StepTriggerAttemptEvent args)
{
if (_inventory.TryGetInventoryEntity<ClothingRequiredStepTriggerImmuneComponent>(args.Tripper, out _))
{ {
args.Cancelled = true; args.Cancelled = true;
} }
} }
private void OnExamined(EntityUid uid, ClothingRequiredStepTriggerComponent component, ExaminedEvent args) private void OnExamined(EntityUid uid, PreventableStepTriggerComponent component, ExaminedEvent args)
{ {
args.PushMarkup(Loc.GetString("clothing-required-step-trigger-examine")); args.PushMarkup(Loc.GetString("clothing-required-step-trigger-examine"));
} }

View File

@@ -210,7 +210,7 @@
Radiation: 0 Radiation: 0
Caustic: 0.75 Caustic: 0.75
- type: GroupExamine - type: GroupExamine
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -308,7 +308,7 @@
- type: ExplosionResistance - type: ExplosionResistance
damageCoefficient: 0.5 damageCoefficient: 0.5
- type: GroupExamine - type: GroupExamine
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -336,7 +336,7 @@
- type: Construction - type: Construction
graph: BoneArmor graph: BoneArmor
node: armor node: armor
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -357,6 +357,6 @@
Piercing: 0.6 Piercing: 0.6
Heat: 0.5 Heat: 0.5
- type: GroupExamine - type: GroupExamine
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET

View File

@@ -135,7 +135,7 @@
tags: tags:
- Hardsuit - Hardsuit
- WhitelistChameleon - WhitelistChameleon
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: DamageOnInteractProtection - type: DamageOnInteractProtection
damageProtection: damageProtection:
@@ -161,7 +161,7 @@
- type: HeldSpeedModifier - type: HeldSpeedModifier
- type: Item - type: Item
size: Huge size: Huge
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: DamageOnInteractProtection - type: DamageOnInteractProtection
damageProtection: damageProtection:

View File

@@ -25,7 +25,7 @@
tags: tags:
- Hardsuit - Hardsuit
- WhitelistChameleon - WhitelistChameleon
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -68,7 +68,7 @@
sprintModifier: 0.7 sprintModifier: 0.7
- type: HeldSpeedModifier - type: HeldSpeedModifier
- type: GroupExamine - type: GroupExamine
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -100,7 +100,7 @@
sprintModifier: 0.8 sprintModifier: 0.8
- type: HeldSpeedModifier - type: HeldSpeedModifier
- type: GroupExamine - type: GroupExamine
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -125,7 +125,7 @@
- type: ContainerContainer - type: ContainerContainer
containers: containers:
toggleable-clothing: !type:ContainerSlot {} toggleable-clothing: !type:ContainerSlot {}
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -198,7 +198,7 @@
sprite: Clothing/OuterClothing/Suits/chicken.rsi sprite: Clothing/OuterClothing/Suits/chicken.rsi
- type: Clothing - type: Clothing
sprite: Clothing/OuterClothing/Suits/chicken.rsi sprite: Clothing/OuterClothing/Suits/chicken.rsi
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -236,7 +236,7 @@
- type: ContainerContainer - type: ContainerContainer
containers: containers:
toggleable-clothing: !type:ContainerSlot {} toggleable-clothing: !type:ContainerSlot {}
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity
@@ -259,7 +259,7 @@
- type: Construction - type: Construction
graph: ClothingOuterSuitIan graph: ClothingOuterSuitIan
node: suit node: suit
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET slots: WITHOUT_POCKET
- type: entity - type: entity

View File

@@ -23,7 +23,7 @@
tags: tags:
- ClothMade - ClothMade
- WhitelistChameleon - WhitelistChameleon
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
- type: entity - type: entity
abstract: true abstract: true

View File

@@ -233,7 +233,7 @@
guides: guides:
- Cyborgs - Cyborgs
- Robotics - Robotics
- type: StepTriggerImmune - type: ProtectedFromStepTriggers
- type: DamageOnInteractProtection - type: DamageOnInteractProtection
damageProtection: damageProtection:
flatReductions: flatReductions:

View File

@@ -2927,7 +2927,7 @@
- DoorBumpOpener - DoorBumpOpener
- type: MovementAlwaysTouching - type: MovementAlwaysTouching
- type: PressureImmunity - type: PressureImmunity
- type: StepTriggerImmune - type: ProtectedFromStepTriggers
- type: Insulated - type: Insulated
- type: InteractionPopup - type: InteractionPopup
successChance: 0.7 successChance: 0.7

View File

@@ -72,8 +72,7 @@
- type: InputMover - type: InputMover
- type: MobMover - type: MobMover
- type: ZombieImmune - type: ZombieImmune
- type: ClothingRequiredStepTriggerImmune - type: ProtectedFromStepTriggers
slots: All
- type: entity - type: entity
abstract: true abstract: true

View File

@@ -108,7 +108,7 @@
- type: TypingIndicator - type: TypingIndicator
proto: robot proto: robot
- type: ZombieImmune - type: ZombieImmune
- type: StepTriggerImmune - type: ProtectedFromStepTriggers
- type: NoSlip - type: NoSlip
- type: Insulated - type: Insulated

View File

@@ -15,7 +15,7 @@
requiredTriggeredSpeed: 2 requiredTriggeredSpeed: 2
- type: Mousetrap - type: Mousetrap
- type: TriggerOnStepTrigger - type: TriggerOnStepTrigger
- type: ClothingRequiredStepTrigger - type: PreventableStepTrigger
- type: DamageUserOnTrigger - type: DamageUserOnTrigger
damage: damage:
types: types:

View File

@@ -121,7 +121,7 @@
- type: StepTrigger - type: StepTrigger
intersectRatio: 0.2 intersectRatio: 0.2
- type: TriggerOnStepTrigger - type: TriggerOnStepTrigger
- type: ClothingRequiredStepTrigger - type: PreventableStepTrigger
- type: Slippery - type: Slippery
slipSound: slipSound:
path: /Audio/Effects/glass_step.ogg path: /Audio/Effects/glass_step.ogg

View File

@@ -65,7 +65,7 @@
acts: [ "Destruction" ] acts: [ "Destruction" ]
- type: StepTrigger - type: StepTrigger
intersectRatio: 0.2 intersectRatio: 0.2
- type: ClothingRequiredStepTrigger - type: PreventableStepTrigger
- type: Slippery - type: Slippery
slipSound: slipSound:
path: /Audio/Effects/glass_step.ogg path: /Audio/Effects/glass_step.ogg