diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 147e282f44..a9cd8ff2ae 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -410,11 +410,15 @@ namespace Content.Server.Strip if (!_inventorySystem.TryGetSlot(component.Owner, slot, out var slotDef)) { - Logger.Error($"{ToPrettyString(user)} attempted to place an item in a non-existent inventory slot ({slot}) on {ToPrettyString(component.Owner)}"); + Logger.Error($"{ToPrettyString(user)} attempted to take an item from a non-existent inventory slot ({slot}) on {ToPrettyString(component.Owner)}"); return; } - var doAfterArgs = new DoAfterEventArgs(user, slotDef.StripTime, CancellationToken.None, component.Owner) + var ev = new BeforeStripEvent(slotDef.StripTime); + RaiseLocalEvent(user, ev); + var finalStripTime = ev.Time + ev.Additive; + + var doAfterArgs = new DoAfterEventArgs(user, finalStripTime, CancellationToken.None, component.Owner) { ExtraCheck = Check, BreakOnStun = true, @@ -425,7 +429,7 @@ namespace Content.Server.Strip if (Check()) { - if (slotDef.StripHidden) + if (slotDef.StripHidden && !ev.Stealth) _popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-hidden", ("slot", slot)), component.Owner, Filter.Entities(component.Owner)); else { @@ -476,7 +480,11 @@ namespace Content.Server.Strip return true; } - var doAfterArgs = new DoAfterEventArgs(user, component.HandStripDelay, CancellationToken.None, component.Owner) + var ev = new BeforeStripEvent(component.HandStripDelay); + RaiseLocalEvent(user, ev); + var finalStripTime = ev.Time + ev.Additive; + + var doAfterArgs = new DoAfterEventArgs(user, finalStripTime, CancellationToken.None, component.Owner) { ExtraCheck = Check, BreakOnStun = true, diff --git a/Content.Shared/Inventory/InventorySystem.Relay.cs b/Content.Shared/Inventory/InventorySystem.Relay.cs index 35d25c0610..1179ded8c6 100644 --- a/Content.Shared/Inventory/InventorySystem.Relay.cs +++ b/Content.Shared/Inventory/InventorySystem.Relay.cs @@ -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(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); + SubscribeLocalEvent(RelayInventoryEvent); } protected void RelayInventoryEvent(EntityUid uid, InventoryComponent component, T args) where T : EntityEventArgs, IInventoryRelayEvent diff --git a/Content.Shared/Strip/Components/SharedStrippableComponent.cs b/Content.Shared/Strip/Components/SharedStrippableComponent.cs index f1b13dc60a..3dcfa99127 100644 --- a/Content.Shared/Strip/Components/SharedStrippableComponent.cs +++ b/Content.Shared/Strip/Components/SharedStrippableComponent.cs @@ -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; } } + + /// + /// Used to modify strip times. + /// + [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; + } + } } diff --git a/Content.Shared/Strip/Components/ThievingComponent.cs b/Content.Shared/Strip/Components/ThievingComponent.cs new file mode 100644 index 0000000000..7afcea5a85 --- /dev/null +++ b/Content.Shared/Strip/Components/ThievingComponent.cs @@ -0,0 +1,22 @@ +namespace Content.Shared.Strip.Components; + +/// +/// Give this to an entity when you want to increase their stripping times +/// +[RegisterComponent] +public sealed class ThievingComponent : Component +{ + /// + /// How much the strip time should be shortened by + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("stealTime")] + public float StealTime = 0.5f; + + /// + /// Should it notify the user if they're stripping a pocket? + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("stealthy")] + public bool Stealthy; +} diff --git a/Content.Shared/Strip/ThievingSystem.cs b/Content.Shared/Strip/ThievingSystem.cs new file mode 100644 index 0000000000..4a630c5015 --- /dev/null +++ b/Content.Shared/Strip/ThievingSystem.cs @@ -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(OnBeforeStrip); + } + + private void OnBeforeStrip(EntityUid uid, ThievingComponent component, BeforeStripEvent args) + { + args.Stealth = component.Stealthy; + args.Additive -= component.StealTime; + } +} diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index 9f05adaf2c..93282e75e5 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -315,6 +315,14 @@ description: These protect you from slips while looking like normal sneakers. price: 2 +- type: uplinkListing + id: UplinkgClothingThievingGloves + category: Armor + itemId: ThievingGloves + listingName: Thieving Gloves + description: Discretely steal from pockets and increase your thieving technique with these fancy new gloves, all while looking like normal gloves! + price: 4 + - type: uplinkListing id: UplinkClothingOuterVestWeb category: Armor diff --git a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml index 2e512d0101..efa38fb3d4 100644 --- a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml +++ b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml @@ -144,6 +144,9 @@ sprite: Clothing/Hands/Gloves/spaceninja.rsi HeatResistance: 1400 - type: Insulated + - type: Thieving + stealTime: 1 + stealthy: true - type: entity parent: ClothingHandsBase @@ -169,3 +172,16 @@ - type: Clothing sprite: Clothing/Hands/Gloves/fingerless.rsi +- type: entity + parent: ClothingHandsBase + id: ThievingGloves + name: black gloves #Intentionally named after regular gloves, they're meant to be sneaky. + description: Seemingly regular black gloves. The fingertips are outfitted with nanotech that makes stealing a breeze. + components: + - type: Sprite + sprite: Clothing/Hands/Gloves/Color/black.rsi + - type: Clothing + sprite: Clothing/Hands/Gloves/Color/black.rsi + - type: Thieving + stealTime: 1.5 + stealthy: true