smoke grenades (#20996)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-12-16 01:49:30 +00:00
committed by GitHub
parent 33b007c23e
commit 7dd472c934
18 changed files with 229 additions and 1 deletions

View File

@@ -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();
}

View File

@@ -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);
}
}

View 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-name-norepinephric-acid = norepinephric acid
reagent-desc-norepinephric-acid = A smooth chemical that blocks the optical receptors, rendering the user blind during metabolization. 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.

View 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-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-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-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. 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.

View File

@@ -49,7 +49,7 @@
- type: StorageFill - type: StorageFill
contents: contents:
- id: GrenadeFlashBang - id: GrenadeFlashBang
- id: GrenadeFlashBang - id: TearGasGrenade
- id: Stunbaton - id: Stunbaton
- id: Handcuffs - id: Handcuffs
- id: Handcuffs - id: Handcuffs

View File

@@ -3,6 +3,7 @@
startingInventory: startingInventory:
Handcuffs: 8 Handcuffs: 8
GrenadeFlashBang: 4 GrenadeFlashBang: 4
TearGasGrenade: 4
ClusterBangFull: 2 ClusterBangFull: 2
GrenadeStinger: 4 GrenadeStinger: 4
Flash: 5 Flash: 5

View File

@@ -138,6 +138,16 @@
categories: categories:
- UplinkExplosives - UplinkExplosives
- type: listing
id: UplinkSmokeGrenade
name: uplink-smoke-grenade-name
description: uplink-smoke-grenade-desc
productEntity: SmokeGrenade
cost:
Telecrystal: 1
categories:
- UplinkExplosives
- type: listing - type: listing
id: UplinkSyndieMiniBomb id: UplinkSyndieMiniBomb
name: uplink-mini-bomb-name name: uplink-mini-bomb-name

View File

@@ -175,6 +175,7 @@
components: components:
- Stunbaton - Stunbaton
- FlashOnTrigger - FlashOnTrigger
- SmokeOnTrigger
- Flash - Flash
- Handcuff - Handcuff
- RangedMagazine - RangedMagazine
@@ -189,6 +190,10 @@
whitelist: whitelist:
components: components:
- Stunbaton - Stunbaton
tear_gas_grenade:
whitelist:
components:
- SmokeOnTrigger
sprite: Clothing/Belt/belt_overlay.rsi sprite: Clothing/Belt/belt_overlay.rsi
- type: Appearance - type: Appearance
@@ -373,6 +378,7 @@
components: components:
- Stunbaton - Stunbaton
- FlashOnTrigger - FlashOnTrigger
- SmokeOnTrigger
- Flash - Flash
- Handcuff - Handcuff
- type: ItemMapper - type: ItemMapper
@@ -385,6 +391,10 @@
whitelist: whitelist:
components: components:
- Stunbaton - Stunbaton
tear_gas_grenade:
whitelist:
components:
- SmokeOnTrigger
sprite: Clothing/Belt/belt_overlay.rsi sprite: Clothing/Belt/belt_overlay.rsi
- type: Appearance - type: Appearance

View File

@@ -345,3 +345,34 @@
- type: TimerTriggerVisuals - type: TimerTriggerVisuals
primingSound: primingSound:
path: /Audio/Effects/hallelujah.ogg 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

View File

@@ -350,3 +350,49 @@
conditions: conditions:
- !type:ReagentThreshold - !type:ReagentThreshold
min: 20 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

View File

@@ -97,6 +97,9 @@
{ {
"name": "stunbaton" "name": "stunbaton"
}, },
{
"name": "tear_gas_grenade"
},
{ {
"name": "wrench" "name": "wrench"
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

View File

@@ -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"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

View File

@@ -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"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B