Hardsuits, EVA suits, Firesuits, and others now protect your feet from Glass Shards (#26764)
* Hardsuits and softsuits count as having shoes for step triggers * Add softsuit tag prototype * Change to suitEVA tag * Get rid of softsuit tag, found suitEVA tag * Full pass of ShoesRequiredStepTriggerImmune * Adds check to outerClothing for ShoesRequiredStepTriggerImmune * return * fuck Dionas * Convert to comp, space dragons immune as well * Merge conflict * Merge conflict * fix leftover tags * empty spaces * turns out the dragon didn't need it * minor optimization * Add access for system, add comp to baseShoes, check slotflags for every slot besides pockets * fix * fuck it we ball --------- Co-authored-by: Plykiya <plykiya@protonmail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -123,6 +123,11 @@ public sealed class InventoryRelayedEvent<TEvent> : EntityEventArgs
|
||||
}
|
||||
}
|
||||
|
||||
public interface IClothingSlots
|
||||
{
|
||||
SlotFlags Slots { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events that should be relayed to inventory slots should implement this interface.
|
||||
/// </summary>
|
||||
|
||||
@@ -27,6 +27,31 @@ public partial class InventorySystem : EntitySystem
|
||||
.RemoveHandler(HandleViewVariablesSlots, ListViewVariablesSlots);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to find an entity in the specified slot with the specified component.
|
||||
/// </summary>
|
||||
public bool TryGetInventoryEntity<T>(Entity<InventoryComponent?> entity, out EntityUid targetUid)
|
||||
where T : IComponent, IClothingSlots
|
||||
{
|
||||
if (TryGetContainerSlotEnumerator(entity.Owner, out var containerSlotEnumerator))
|
||||
{
|
||||
while (containerSlotEnumerator.NextItem(out var item, out var slot))
|
||||
{
|
||||
if (!TryComp<T>(item, out var required))
|
||||
continue;
|
||||
|
||||
if ((((IClothingSlots) required).Slots & slot.SlotFlags) == 0x0)
|
||||
continue;
|
||||
|
||||
targetUid = item;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
targetUid = EntityUid.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void OnInit(EntityUid uid, InventoryComponent component, ComponentInit args)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(component.TemplateId, out InventoryTemplatePrototype? invTemplate))
|
||||
|
||||
@@ -27,4 +27,6 @@ public enum SlotFlags
|
||||
FEET = 1 << 14,
|
||||
SUITSTORAGE = 1 << 15,
|
||||
All = ~NONE,
|
||||
|
||||
WITHOUT_POCKET = All & ~POCKET
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for marking step trigger events that require the user to wear shoes, such as for glass shards.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ClothingRequiredStepTriggerComponent : Component;
|
||||
@@ -0,0 +1,16 @@
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.StepTrigger.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for cancelling step trigger events if the user is wearing clothing in a valid slot.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(StepTriggerImmuneSystem))]
|
||||
public sealed partial class ClothingRequiredStepTriggerImmuneComponent : Component, IClothingSlots
|
||||
{
|
||||
[DataField]
|
||||
public SlotFlags Slots { get; set; } = SlotFlags.FEET;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for cancelling step trigger events if the user is wearing shoes, such as for glass shards.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShoesRequiredStepTriggerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
@@ -1,41 +0,0 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.StepTrigger.Components;
|
||||
using Content.Shared.Tag;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Systems;
|
||||
|
||||
public sealed class ShoesRequiredStepTriggerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<ShoesRequiredStepTriggerComponent, StepTriggerAttemptEvent>(OnStepTriggerAttempt);
|
||||
SubscribeLocalEvent<ShoesRequiredStepTriggerComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnStepTriggerAttempt(EntityUid uid, ShoesRequiredStepTriggerComponent component, ref StepTriggerAttemptEvent args)
|
||||
{
|
||||
if (_tagSystem.HasTag(args.Tripper, "ShoesRequiredStepTriggerImmune"))
|
||||
{
|
||||
args.Cancelled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp<InventoryComponent>(args.Tripper, out var inventory))
|
||||
return;
|
||||
|
||||
if (_inventory.TryGetSlotEntity(args.Tripper, "shoes", out _, inventory))
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, ShoesRequiredStepTriggerComponent component, ExaminedEvent args)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("shoes-required-step-trigger-examine"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.StepTrigger.Components;
|
||||
using Content.Shared.Tag;
|
||||
|
||||
namespace Content.Shared.StepTrigger.Systems;
|
||||
|
||||
public sealed class StepTriggerImmuneSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<StepTriggerImmuneComponent, StepTriggerAttemptEvent>(OnStepTriggerAttempt);
|
||||
SubscribeLocalEvent<ClothingRequiredStepTriggerComponent, StepTriggerAttemptEvent>(OnStepTriggerClothingAttempt);
|
||||
SubscribeLocalEvent<ClothingRequiredStepTriggerComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnStepTriggerAttempt(Entity<StepTriggerImmuneComponent> ent, ref StepTriggerAttemptEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnStepTriggerClothingAttempt(EntityUid uid, ClothingRequiredStepTriggerComponent component, ref StepTriggerAttemptEvent args)
|
||||
{
|
||||
if (_inventory.TryGetInventoryEntity<ClothingRequiredStepTriggerImmuneComponent>(args.Tripper, out _))
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, ClothingRequiredStepTriggerComponent component, ExaminedEvent args)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("clothing-required-step-trigger-examine"));
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public sealed class ReflectSystem : EntitySystem
|
||||
if (args.Reflected)
|
||||
return;
|
||||
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.All & ~SlotFlags.POCKET))
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.WITHOUT_POCKET))
|
||||
{
|
||||
if (!TryReflectHitscan(uid, ent, args.Shooter, args.SourceItem, args.Direction, out var dir))
|
||||
continue;
|
||||
@@ -70,7 +70,7 @@ public sealed class ReflectSystem : EntitySystem
|
||||
|
||||
private void OnReflectUserCollide(EntityUid uid, ReflectUserComponent component, ref ProjectileReflectAttemptEvent args)
|
||||
{
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.All & ~SlotFlags.POCKET))
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.WITHOUT_POCKET))
|
||||
{
|
||||
if (!TryReflectProjectile(uid, ent, args.ProjUid))
|
||||
continue;
|
||||
@@ -222,7 +222,7 @@ public sealed class ReflectSystem : EntitySystem
|
||||
/// </summary>
|
||||
private void RefreshReflectUser(EntityUid user)
|
||||
{
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(user, SlotFlags.All & ~SlotFlags.POCKET))
|
||||
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(user, SlotFlags.WITHOUT_POCKET))
|
||||
{
|
||||
if (!HasComp<ReflectComponent>(ent))
|
||||
continue;
|
||||
|
||||
@@ -1 +1 @@
|
||||
shoes-required-step-trigger-examine = You probably shouldn't step on this barefoot.
|
||||
clothing-required-step-trigger-examine = You probably shouldn't step on this barefoot.
|
||||
|
||||
@@ -138,6 +138,8 @@
|
||||
Radiation: 0
|
||||
Caustic: 0.75
|
||||
- type: GroupExamine
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterArmorHeavy
|
||||
@@ -234,6 +236,8 @@
|
||||
- type: ExplosionResistance
|
||||
damageCoefficient: 0.5
|
||||
- type: GroupExamine
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBaseLarge
|
||||
@@ -260,6 +264,8 @@
|
||||
- type: Construction
|
||||
graph: BoneArmor
|
||||
node: armor
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBaseLarge
|
||||
@@ -279,3 +285,6 @@
|
||||
Piercing: 0.6
|
||||
Heat: 0.5
|
||||
- type: GroupExamine
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
tags:
|
||||
- Hardsuit
|
||||
- WhitelistChameleon
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
abstract: true
|
||||
@@ -152,6 +154,8 @@
|
||||
- type: HeldSpeedModifier
|
||||
- type: Item
|
||||
size: Huge
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBase
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
tags:
|
||||
- Hardsuit
|
||||
- WhitelistChameleon
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterSuitBomb
|
||||
@@ -63,6 +65,8 @@
|
||||
sprintModifier: 0.7
|
||||
- type: HeldSpeedModifier
|
||||
- type: GroupExamine
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBaseLarge
|
||||
@@ -70,26 +74,28 @@
|
||||
name: atmos fire suit
|
||||
description: An expensive firesuit that protects against even the most deadly of station fires. Designed to protect even if the wearer is set aflame.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/OuterClothing/Suits/atmos_firesuit.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/OuterClothing/Suits/atmos_firesuit.rsi
|
||||
- type: PressureProtection
|
||||
highPressureMultiplier: 0.02
|
||||
lowPressureMultiplier: 1000
|
||||
- type: TemperatureProtection
|
||||
coefficient: 0.001
|
||||
- type: Armor
|
||||
modifiers:
|
||||
coefficients:
|
||||
Slash: 0.9
|
||||
Heat: 0.3
|
||||
Cold: 0.2
|
||||
- type: ClothingSpeedModifier
|
||||
walkModifier: 0.8
|
||||
sprintModifier: 0.8
|
||||
- type: HeldSpeedModifier
|
||||
- type: GroupExamine
|
||||
- type: Sprite
|
||||
sprite: Clothing/OuterClothing/Suits/atmos_firesuit.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/OuterClothing/Suits/atmos_firesuit.rsi
|
||||
- type: PressureProtection
|
||||
highPressureMultiplier: 0.02
|
||||
lowPressureMultiplier: 1000
|
||||
- type: TemperatureProtection
|
||||
coefficient: 0.001
|
||||
- type: Armor
|
||||
modifiers:
|
||||
coefficients:
|
||||
Slash: 0.9
|
||||
Heat: 0.3
|
||||
Cold: 0.2
|
||||
- type: ClothingSpeedModifier
|
||||
walkModifier: 0.8
|
||||
sprintModifier: 0.8
|
||||
- type: HeldSpeedModifier
|
||||
- type: GroupExamine
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: [ClothingOuterBaseLarge, GeigerCounterClothing]
|
||||
@@ -113,6 +119,8 @@
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
toggleable-clothing: !type:ContainerSlot {}
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBaseLarge
|
||||
@@ -164,6 +172,8 @@
|
||||
sprite: Clothing/OuterClothing/Suits/chicken.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/OuterClothing/Suits/chicken.rsi
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBase
|
||||
@@ -189,6 +199,8 @@
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
toggleable-clothing: !type:ContainerSlot {}
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBase
|
||||
@@ -210,6 +222,8 @@
|
||||
- type: Construction
|
||||
graph: ClothingOuterSuitIan
|
||||
node: suit
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: WITHOUT_POCKET
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterBase
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
tags:
|
||||
- ClothMade
|
||||
- WhitelistChameleon
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
|
||||
- type: entity
|
||||
abstract: true
|
||||
|
||||
@@ -205,13 +205,13 @@
|
||||
- type: StandingState
|
||||
- type: Tag
|
||||
tags:
|
||||
- ShoesRequiredStepTriggerImmune
|
||||
- DoorBumpOpener
|
||||
- CanPilot
|
||||
- type: Emoting
|
||||
- type: GuideHelp
|
||||
guides:
|
||||
- Cyborgs
|
||||
- type: StepTriggerImmune
|
||||
|
||||
- type: entity
|
||||
id: BaseBorgChassisNT
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- DoorBumpOpener
|
||||
- ShoesRequiredStepTriggerImmune
|
||||
- type: MobState
|
||||
allowedStates:
|
||||
- Alive
|
||||
@@ -73,6 +72,8 @@
|
||||
- type: InputMover
|
||||
- type: MobMover
|
||||
- type: ZombieImmune
|
||||
- type: ClothingRequiredStepTriggerImmune
|
||||
slots: All
|
||||
|
||||
- type: entity
|
||||
abstract: true
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- DoorBumpOpener
|
||||
- ShoesRequiredStepTriggerImmune
|
||||
- type: MobState
|
||||
allowedStates:
|
||||
- Alive
|
||||
@@ -107,6 +106,7 @@
|
||||
- type: TypingIndicator
|
||||
proto: robot
|
||||
- type: ZombieImmune
|
||||
- type: StepTriggerImmune
|
||||
|
||||
- type: entity
|
||||
parent: MobSiliconBase
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
requiredTriggeredSpeed: 0
|
||||
- type: Mousetrap
|
||||
- type: TriggerOnStepTrigger
|
||||
- type: ShoesRequiredStepTrigger
|
||||
- type: ClothingRequiredStepTrigger
|
||||
- type: DamageUserOnTrigger
|
||||
damage:
|
||||
types:
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
- type: StepTrigger
|
||||
intersectRatio: 0.2
|
||||
- type: TriggerOnStepTrigger
|
||||
- type: ShoesRequiredStepTrigger
|
||||
- type: ClothingRequiredStepTrigger
|
||||
- type: Slippery
|
||||
slipSound:
|
||||
path: /Audio/Effects/glass_step.ogg
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
acts: [ "Destruction" ]
|
||||
- type: StepTrigger
|
||||
intersectRatio: 0.2
|
||||
- type: ShoesRequiredStepTrigger
|
||||
- type: ClothingRequiredStepTrigger
|
||||
- type: Slippery
|
||||
slipSound:
|
||||
path: /Audio/Effects/glass_step.ogg
|
||||
|
||||
@@ -1104,9 +1104,6 @@
|
||||
- type: Tag
|
||||
id: Shiv
|
||||
|
||||
- type: Tag
|
||||
id: ShoesRequiredStepTriggerImmune
|
||||
|
||||
- type: Tag
|
||||
id: Shovel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user