Thieving component and Thieving Gloves (#9158)
* Thieving component and gloves * Fixes popup issue * Forgot to add it for hands * Adds a bool datafield * Comments * Requested changes
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Electrocution;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Slippery;
|
||||
using Content.Shared.Strip.Components;
|
||||
|
||||
namespace Content.Shared.Inventory;
|
||||
|
||||
@@ -15,6 +16,7 @@ public partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshMovementSpeedModifiersEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, GetExplosionResistanceEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, BeforeStripEvent>(RelayInventoryEvent);
|
||||
}
|
||||
|
||||
protected void RelayInventoryEvent<T>(EntityUid uid, InventoryComponent component, T args) where T : EntityEventArgs, IInventoryRelayEvent
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Strip.Components
|
||||
@@ -77,4 +78,23 @@ namespace Content.Shared.Strip.Components
|
||||
Handcuffs = handcuffs;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to modify strip times.
|
||||
/// </summary>
|
||||
[NetSerializable, Serializable]
|
||||
public sealed class BeforeStripEvent : EntityEventArgs, IInventoryRelayEvent
|
||||
{
|
||||
public readonly float InitialTime;
|
||||
public float Time;
|
||||
public float Additive = 0;
|
||||
public bool Stealth;
|
||||
|
||||
public SlotFlags TargetSlots { get; } = SlotFlags.GLOVES;
|
||||
|
||||
public BeforeStripEvent(float initialTime)
|
||||
{
|
||||
InitialTime = Time = initialTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
Content.Shared/Strip/Components/ThievingComponent.cs
Normal file
22
Content.Shared/Strip/Components/ThievingComponent.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Content.Shared.Strip.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Give this to an entity when you want to increase their stripping times
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ThievingComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How much the strip time should be shortened by
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("stealTime")]
|
||||
public float StealTime = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Should it notify the user if they're stripping a pocket?
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("stealthy")]
|
||||
public bool Stealthy;
|
||||
}
|
||||
21
Content.Shared/Strip/ThievingSystem.cs
Normal file
21
Content.Shared/Strip/ThievingSystem.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Strip.Components;
|
||||
|
||||
namespace Content.Shared.Strip;
|
||||
|
||||
public sealed class ThievingSystem : EntitySystem
|
||||
{
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ThievingComponent, BeforeStripEvent>(OnBeforeStrip);
|
||||
}
|
||||
|
||||
private void OnBeforeStrip(EntityUid uid, ThievingComponent component, BeforeStripEvent args)
|
||||
{
|
||||
args.Stealth = component.Stealthy;
|
||||
args.Additive -= component.StealTime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user