]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Thieves can innately pickpocket - thieving gloves rework (#38123)
authorArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
Mon, 16 Jun 2025 22:47:31 +0000 (15:47 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Jun 2025 22:47:31 +0000 (15:47 -0700)
* Thieves can innately pickpocket (#107)

Pickpocketing a skyrim guard's armor off

(cherry picked from commit 21b9f1ddb251ea3c7c6803e78871abefcaecbfb4)

* this isnt moff

* Make predicted, cleanup

* !skating-basketball

* orks are NOT the best trollface

* Implement much more sensible component replication prevention

---------

Co-authored-by: DuckManZach <144298822+duckmanzach@users.noreply.github.com>
Content.Shared/Strip/Components/ThievingComponent.cs
Content.Shared/Strip/ThievingSystem.cs
Resources/Locale/en-US/alerts/alerts.ftl
Resources/Prototypes/Alerts/alerts.yml
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/GameRules/subgamemodes.yml
Resources/Prototypes/Roles/Antags/thief.yml
Resources/Textures/Interface/Alerts/stealthy.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-off.png [new file with mode: 0644]
Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-on.png [new file with mode: 0644]

index a851dd5ef6394fe82ad997a045210a0b5d71631d..f40201723b83fcaa96aefe88b37af9040964c934 100644 (file)
@@ -1,22 +1,44 @@
+using Content.Shared.Alert;
+using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
+
 namespace Content.Shared.Strip.Components;
 
 /// <summary>
 /// Give this to an entity when you want to decrease stripping times
 /// </summary>
-[RegisterComponent]
+[RegisterComponent, NetworkedComponent]
+[AutoGenerateComponentState(fieldDeltas: true)]
 public sealed partial class ThievingComponent : Component
 {
     /// <summary>
     /// How much the strip time should be shortened by
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite)]
-    [DataField("stripTimeReduction")]
+    [DataField, AutoNetworkedField]
     public TimeSpan StripTimeReduction = TimeSpan.FromSeconds(0.5f);
 
     /// <summary>
     /// Should it notify the user if they're stripping a pocket?
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite)]
-    [DataField("stealthy")]
+    [DataField, AutoNetworkedField]
     public bool Stealthy;
+
+    /// <summary>
+    /// Variable pointing at the Alert modal
+    /// </summary>
+    [DataField]
+    public ProtoId<AlertPrototype> StealthyAlertProtoId = "Stealthy";
+
+    /// <summary>
+    /// Prevent component replication to clients other than the owner,
+    /// doesn't affect prediction.
+    /// Get mogged.
+    /// </summary>
+    public override bool SendOnlyToOwner => true;
 }
+
+/// <summary>
+/// Event raised to toggle the thieving component.
+/// </summary>
+public sealed partial class ToggleThievingEvent : BaseAlertEvent;
+
index 2b3d3b38a001b8ad412c409ae95e6e7b1c284b3d..4a76354844b6842f5f97e4f86fc870ba7d3d66f5 100644 (file)
@@ -1,23 +1,54 @@
+using Content.Shared.Alert;
 using Content.Shared.Inventory;
-using Content.Shared.Strip;
 using Content.Shared.Strip.Components;
+using Robust.Shared.GameStates;
 
 namespace Content.Shared.Strip;
 
-public sealed class ThievingSystem : EntitySystem
+public sealed partial class ThievingSystem : EntitySystem
 {
+    [Dependency] private readonly AlertsSystem _alertsSystem = default!;
 
     public override void Initialize()
     {
         base.Initialize();
 
         SubscribeLocalEvent<ThievingComponent, BeforeStripEvent>(OnBeforeStrip);
-        SubscribeLocalEvent<ThievingComponent, InventoryRelayedEvent<BeforeStripEvent>>((e, c, ev) => OnBeforeStrip(e, c, ev.Args));
+        SubscribeLocalEvent<ThievingComponent, InventoryRelayedEvent<BeforeStripEvent>>((e, c, ev) =>
+            OnBeforeStrip(e, c, ev.Args));
+        SubscribeLocalEvent<ThievingComponent, ToggleThievingEvent>(OnToggleStealthy);
+        SubscribeLocalEvent<ThievingComponent, ComponentInit>(OnCompInit);
+        SubscribeLocalEvent<ThievingComponent, ComponentRemove>(OnCompRemoved);
     }
 
     private void OnBeforeStrip(EntityUid uid, ThievingComponent component, BeforeStripEvent args)
     {
         args.Stealth |= component.Stealthy;
-        args.Additive -= component.StripTimeReduction;
+        if (args.Stealth)
+        {
+            args.Additive -= component.StripTimeReduction;
+        }
+    }
+
+    private void OnCompInit(Entity<ThievingComponent> entity, ref ComponentInit args)
+    {
+        _alertsSystem.ShowAlert(entity, entity.Comp.StealthyAlertProtoId, 1);
+    }
+
+    private void OnCompRemoved(Entity<ThievingComponent> entity, ref ComponentRemove args)
+    {
+        _alertsSystem.ClearAlert(entity, entity.Comp.StealthyAlertProtoId);
+    }
+
+    private void OnToggleStealthy(Entity<ThievingComponent> ent, ref ToggleThievingEvent args)
+    {
+        if (args.Handled)
+            return;
+
+        ent.Comp.Stealthy = !ent.Comp.Stealthy;
+        _alertsSystem.ShowAlert(ent.Owner, ent.Comp.StealthyAlertProtoId, (short)(ent.Comp.Stealthy ? 1 : 0));
+        DirtyField(ent.AsNullable(), nameof(ent.Comp.Stealthy), null);
+
+        args.Handled = true;
     }
 }
index eb6d17902761d0e90ab39356a51dc78ce74f5809..45c22abcbce85d6aa62f6ccd3ed6253f7e6b1f42 100644 (file)
@@ -116,3 +116,6 @@ alerts-revenant-corporeal-desc = You have manifested physically. People around y
 
 alerts-rooted-name = Rooted
 alerts-rooted-desc = You are attached to the ground. You can't slip, but you absorb fluids under you.
+
+alerts-stealthy-name = Pickpocketing
+alerts-stealthy-desc = Whether you are currently pickpocketing. Click to toggle.
index 60a23294d3ad2ac491288a50e8ec06f0e4226b8e..6710a15fbcff9ad17b92759a583c2dfb3d5f3734 100644 (file)
@@ -26,6 +26,7 @@
     - alertType: Magboots
     - alertType: Rooted
     - alertType: Pacified
+    - alertType: Stealthy
 
 - type: entity
   id: AlertSpriteView
   name: alerts-pacified-name
   description: alerts-pacified-desc
 
+- type: alert
+  id: Stealthy
+  clickEvent: !type:ToggleThievingEvent
+  icons:
+  - sprite: /Textures/Interface/Alerts/stealthy.rsi
+    state: stealthy-off
+  - sprite: /Textures/Interface/Alerts/stealthy.rsi
+    state: stealthy-on
+  name: alerts-stealthy-name
+  description: alerts-stealthy-desc
+  minSeverity: 0
+  maxSeverity: 1
+
 - type: alert
   id: Adrenaline
   icons:
index 2371ee2c252b7cf076dc779a5e405b333a466791..c177baa5d7b4d5e262ceb4a05dc2dc53851012d8 100644 (file)
   categories:
   - UplinkWearables
 
-# TODO: Revert back to normal thieving gloves when clothes dyeing is added
-- type: listing
-  id: UplinkgClothingThievingGloves
-  name: uplink-clothing-chameleon-thieving-gloves-name
-  description: uplink-clothing-chameleon-thieving-gloves-desc
-  productEntity: ClothingHandsChameleonThief
-  discountCategory: veryRareDiscounts
-  discountDownTo:
-    Telecrystal: 3
-  cost:
-    Telecrystal: 5
-  categories:
-  - UplinkWearables
-
 - type: listing
   id: UplinkClothingOuterVestWeb
   name: uplink-clothing-outer-vest-web-name
index cb764d97877abe71a16796b598ff733a4fb16cc6..2213623c2873c78ced612c34ba94932edf993104 100644 (file)
@@ -27,6 +27,9 @@
       startingGear: ThiefGear
       components:
       - type: Pacified
+      - type: Thieving
+        stripTimeReduction: 2
+        stealthy: true
       mindRoles:
       - MindRoleThief
       briefing:
index b8d21d2e83656c28e8b1ebaefd4ca24e2bed1fd4..4b333ac4957259831a3c8c0c0080966e67df8657 100644 (file)
@@ -15,4 +15,3 @@
     back:
     - ThiefBeacon
     - SatchelThief
-    - ClothingHandsChameleonThief
diff --git a/Resources/Textures/Interface/Alerts/stealthy.rsi/meta.json b/Resources/Textures/Interface/Alerts/stealthy.rsi/meta.json
new file mode 100644 (file)
index 0000000..8c00bfe
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "version": 1,
+    "license": "CC-BY-SA-3.0",
+    "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/4f6190e2895e09116663ef282d3ce1d8b35c032e. Edited by DuckManZach (github)",
+    "size": {
+        "x": 32,
+        "y": 32
+    },
+    "states": [
+        {
+            "name": "stealthy-off"
+        },
+        {
+            "name": "stealthy-on"
+        }
+    ]
+}
diff --git a/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-off.png b/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-off.png
new file mode 100644 (file)
index 0000000..98e3549
Binary files /dev/null and b/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-off.png differ
diff --git a/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-on.png b/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-on.png
new file mode 100644 (file)
index 0000000..3d2abbd
Binary files /dev/null and b/Resources/Textures/Interface/Alerts/stealthy.rsi/stealthy-on.png differ