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:
@@ -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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user