]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
smoke grenades (#20996)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sat, 16 Dec 2023 01:49:30 +0000 (01:49 +0000)
committerGitHub <noreply@github.com>
Sat, 16 Dec 2023 01:49:30 +0000 (17:49 -0800)
Co-authored-by: deltanedas <@deltanedas:kde.org>
18 files changed:
Content.Server/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs [new file with mode: 0644]
Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/reagents/meta/narcotics.ftl
Resources/Locale/en-US/store/uplink-catalog.ftl
Resources/Prototypes/Catalog/Fills/Items/belt.yml
Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/Entities/Clothing/Belt/belts.yml
Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml
Resources/Prototypes/Reagents/narcotics.yml
Resources/Textures/Clothing/Belt/belt_overlay.rsi/meta.json
Resources/Textures/Clothing/Belt/belt_overlay.rsi/tear_gas_grenade.png [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/primed.png [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/primed.png [new file with mode: 0644]

diff --git a/Content.Server/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs b/Content.Server/Explosion/Components/OnTrigger/SmokeOnTriggerComponent.cs
new file mode 100644 (file)
index 0000000..d71e934
--- /dev/null
@@ -0,0 +1,41 @@
+using Content.Server.Explosion.EntitySystems;
+using Content.Shared.Chemistry.Components;
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Explosion.Components;
+
+/// <summary>
+/// Creates a smoke cloud when triggered, with an optional solution to include in it.
+/// No sound is played incase a grenade is stealthy, use <see cref="SoundOnTriggerComponent"/> if you want a sound.
+/// </summary>
+[RegisterComponent, Access(typeof(SmokeOnTriggerSystem))]
+public sealed partial class SmokeOnTriggerComponent : Component
+{
+    /// <summary>
+    /// How long the smoke stays for, after it has spread.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float Duration = 10;
+
+    /// <summary>
+    /// How much the smoke will spread.
+    /// </summary>
+    [DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
+    public int SpreadAmount;
+
+    /// <summary>
+    /// Smoke entity to spawn.
+    /// Defaults to smoke but you can use foam if you want.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public ProtoId<EntityPrototype> SmokePrototype = "Smoke";
+
+    /// <summary>
+    /// Solution to add to each smoke cloud.
+    /// </summary>
+    /// <remarks>
+    /// When using repeating trigger this essentially gets multiplied so dont do anything crazy like omnizine or lexorin.
+    /// </remarks>
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public Solution Solution = new();
+}
diff --git a/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/SmokeOnTriggerSystem.cs
new file mode 100644 (file)
index 0000000..3ddb411
--- /dev/null
@@ -0,0 +1,46 @@
+using Content.Server.Explosion.Components;
+using Content.Server.Fluids.EntitySystems;
+using Content.Shared.Chemistry.Components;
+using Content.Shared.Coordinates.Helpers;
+using Content.Shared.Maps;
+using Robust.Shared.Map;
+
+namespace Content.Server.Explosion.EntitySystems;
+
+/// <summary>
+/// Handles creating smoke when <see cref="SmokeOnTriggerComponent"/> is triggered.
+/// </summary>
+public sealed class SmokeOnTriggerSystem : EntitySystem
+{
+    [Dependency] private readonly IMapManager _mapMan = default!;
+    [Dependency] private readonly SmokeSystem _smoke = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<SmokeOnTriggerComponent, TriggerEvent>(OnTrigger);
+    }
+
+    private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
+    {
+        var xform = Transform(uid);
+        if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
+            !grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
+            tileRef.Tile.IsSpace())
+        {
+            return;
+        }
+
+        var coords = grid.MapToGrid(xform.MapPosition);
+        var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
+        if (!TryComp<SmokeComponent>(ent, out var smoke))
+        {
+            Logger.Error($"Smoke prototype {comp.SmokePrototype} was missing SmokeComponent");
+            Del(ent);
+            return;
+        }
+
+        _smoke.StartSmoke(ent, comp.Solution, comp.Duration, comp.SpreadAmount, smoke);
+    }
+}
index 7e5e41037ec381a4d7a97aa1b9dbe790c714b0f1..7eed44835c2ba8489058d9f614b3192942416f23 100644 (file)
@@ -36,3 +36,6 @@ reagent-desc-mute-toxin = A thick chemical that coats the vocal cords, making th
 
 reagent-name-norepinephric-acid = norepinephric acid
 reagent-desc-norepinephric-acid = A smooth chemical that blocks the optical receptors, rendering the user blind during metabolization.
+
+reagent-name-tear-gas = tear gas
+reagent-desc-tear-gas = A chemical that causes severe irritation and crying, commonly used in riot control.
index 9725024c9ca4d412cedee5fb7673730f0ddb9e5d..a016d791d752cb63078abc56aaa4621a0aad93b2 100644 (file)
@@ -33,6 +33,9 @@ uplink-explosive-grenade-desc = A simplistic grenade with a three-and-a-half-sec
 uplink-flash-grenade-name = Flashbang
 uplink-flash-grenade-desc = A standard-issue flashbang, capable of blinding and slowing down anyone without proper protection. This, of course, includes you; make sure you're properly equipped before using it.
 
+uplink-smoke-grenade-name = Smoke Grenade
+uplink-smoke-grenade-desc = A grenade that releases a huge cloud of smoke, perfect for killing someone in the shadows or making a sneaky getaway.
+
 uplink-mini-bomb-name = Minibomb
 uplink-mini-bomb-desc = A low-yield, high-impact precision sabotage explosive with a five-second long fuse. Perfect for quickly destroying a machine, dead body, or whatever else needs to go.
 
index ec683b852317afe055a0016cc1b03fffbb372dc2..8f66c870fc07ee56e4963cb87403975645b457a9 100644 (file)
@@ -49,7 +49,7 @@
   - type: StorageFill
     contents:
       - id: GrenadeFlashBang
-      - id: GrenadeFlashBang
+      - id: TearGasGrenade
       - id: Stunbaton
       - id: Handcuffs
       - id: Handcuffs
index cd319c3b427936411ac2e81be03fb5bd2493332e..75f0cad84b8d75fdd83649e83cddfbf310c2eca9 100644 (file)
@@ -3,6 +3,7 @@
   startingInventory:
     Handcuffs: 8
     GrenadeFlashBang: 4
+    TearGasGrenade: 4
     ClusterBangFull: 2
     GrenadeStinger: 4
     Flash: 5
index dc668fd6a28c069abafab706e03d6697ebd163dc..de4789ae79ded98af4960a9583a767d87e5494a7 100644 (file)
   categories:
   - UplinkExplosives
 
+- type: listing
+  id: UplinkSmokeGrenade
+  name: uplink-smoke-grenade-name
+  description: uplink-smoke-grenade-desc
+  productEntity: SmokeGrenade
+  cost:
+    Telecrystal: 1
+  categories:
+  - UplinkExplosives
+
 - type: listing
   id: UplinkSyndieMiniBomb
   name: uplink-mini-bomb-name
index 79b726a6a9443f013b89da34377abac564614169..d0ff683cdc87c8ac0baf9b294256d587523f57d8 100644 (file)
       components:
         - Stunbaton
         - FlashOnTrigger
+        - SmokeOnTrigger
         - Flash
         - Handcuff
         - RangedMagazine
         whitelist:
           components:
           - Stunbaton
+      tear_gas_grenade:
+        whitelist:
+          components:
+          - SmokeOnTrigger
     sprite: Clothing/Belt/belt_overlay.rsi
   - type: Appearance
 
       components:
         - Stunbaton
         - FlashOnTrigger
+        - SmokeOnTrigger
         - Flash
         - Handcuff
   - type: ItemMapper
         whitelist:
           components:
           - Stunbaton
+      tear_gas_grenade:
+        whitelist:
+          components:
+          - SmokeOnTrigger
     sprite: Clothing/Belt/belt_overlay.rsi
   - type: Appearance
 
index 7f5124a5ebca690b9825ae1747654bc4f7f7d88b..a3727351ece5fcaf466db873a7a9355f8d4a8b2b 100644 (file)
   - type: TimerTriggerVisuals
     primingSound:
       path: /Audio/Effects/hallelujah.ogg
+
+- type: entity
+  parent: GrenadeBase
+  id: SmokeGrenade
+  name: smoke grenade
+  description: A tactical grenade that releases a large, long-lasting cloud of smoke when used.
+  components:
+  - type: Sprite
+    sprite: Objects/Weapons/Grenades/smoke.rsi
+  - type: SmokeOnTrigger
+    duration: 30
+    spreadAmount: 50
+  - type: SoundOnTrigger
+    sound: /Audio/Effects/smoke.ogg
+  - type: DeleteOnTrigger
+
+- type: entity
+  parent: SmokeGrenade
+  id: TearGasGrenade
+  name: tear gas grenade
+  description: A riot control tear gas grenade. Causes irritation, pain and makes you cry your eyes out.
+  components:
+  - type: Sprite
+    sprite: Objects/Weapons/Grenades/tear_gas.rsi
+  - type: SmokeOnTrigger
+    duration: 10
+    spreadAmount: 30
+    solution:
+      reagents:
+      - ReagentId: TearGas
+        Quantity: 50
index 2678f4cd714f2fea3d68313a3ef6fcedb5e6885e..d05cc29ab02ac7beee9a3f92c3c0421baaae753e 100644 (file)
         conditions:
         - !type:ReagentThreshold
           min: 20
+
+- type: reagent
+  id: TearGas
+  name: reagent-name-tear-gas
+  group: Narcotics
+  desc: reagent-desc-tear-gas
+  physicalDesc: reagent-physical-desc-milky
+  flavor: salty
+  color: "#96a8b5"
+  boilingPoint: 255.0
+  meltingPoint: 36.0
+  metabolisms:
+    Narcotic:
+      effects:
+      - !type:PopupMessage
+        type: Local
+        probability: 0.08
+        messages:
+        - generic-reagent-effect-burning-eyes
+        - generic-reagent-effect-burning-eyes-a-bit
+        - generic-reagent-effect-tearing-up
+        - norepinephricacid-effect-eyelids
+        - norepinephricacid-effect-eyes-itch
+        - norepinephricacid-effect-vision-fade
+        - norepinephricacid-effect-vision-fail
+      - !type:PopupMessage
+        type: Local
+        visualType: MediumCaution
+        probability: 0.03
+        messages:
+        - norepinephricacid-effect-eye-disconnect
+        - norepinephricacid-effect-eye-pain
+        - norepinephricacid-effect-darkness
+        - norepinephricacid-effect-blindness
+        conditions:
+        - !type:ReagentThreshold
+          min: 15
+      - !type:Emote
+        emote: Scream
+        probability: 0.08
+      - !type:GenericStatusEffect
+        key: TemporaryBlindness
+        component: TemporaryBlindness
+        conditions:
+        - !type:ReagentThreshold
+          min: 20
index b8464e42430855b899420b39f860d6d3fdc33294..18b282d9dfa39b4d9dd17b61a7bf9af700cf3dc1 100644 (file)
@@ -97,6 +97,9 @@
     {
       "name": "stunbaton"
     },
+    {
+      "name": "tear_gas_grenade"
+    },
     {
       "name": "wrench"
     },
diff --git a/Resources/Textures/Clothing/Belt/belt_overlay.rsi/tear_gas_grenade.png b/Resources/Textures/Clothing/Belt/belt_overlay.rsi/tear_gas_grenade.png
new file mode 100644 (file)
index 0000000..3558e00
Binary files /dev/null and b/Resources/Textures/Clothing/Belt/belt_overlay.rsi/tear_gas_grenade.png differ
diff --git a/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/icon.png b/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/icon.png
new file mode 100644 (file)
index 0000000..c6365e6
Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/icon.png differ
diff --git a/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/meta.json b/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/meta.json
new file mode 100644 (file)
index 0000000..525248c
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "version": 1,
+  "license": "CC-BY-SA-3.0",
+  "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/blob/524270a5bcc1e0ea844b98c5a204986cec9721ac/icons/obj/weapons/grenade.dmi",
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "states": [
+    {
+      "name": "icon"
+    },
+    {
+      "name": "primed"
+    }
+  ]
+}
diff --git a/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/primed.png b/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/primed.png
new file mode 100644 (file)
index 0000000..ef7ca55
Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/smoke.rsi/primed.png differ
diff --git a/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/icon.png b/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/icon.png
new file mode 100644 (file)
index 0000000..e3980ea
Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/icon.png differ
diff --git a/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/meta.json b/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/meta.json
new file mode 100644 (file)
index 0000000..60b9195
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "version": 1,
+  "license": "CC-BY-SA-3.0",
+  "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/blob/524270a5bcc1e0ea844b98c5a204986cec9721ac/icons/obj/weapons/grenade.dmi and modified by deltanedas (github)",
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "states": [
+    {
+      "name": "icon"
+    },
+    {
+      "name": "primed"
+    }
+  ]
+}
diff --git a/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/primed.png b/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/primed.png
new file mode 100644 (file)
index 0000000..ca49e02
Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Grenades/tear_gas.rsi/primed.png differ