diff --git a/Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs b/Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs new file mode 100644 index 00000000000..c6bb285bfb7 --- /dev/null +++ b/Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs @@ -0,0 +1,20 @@ +using Content.Shared.Chemistry.Components; +using Robust.Shared.Audio; + +namespace Content.Server.Fluids.EntitySystems; + +[RegisterComponent] +[Access(typeof(SmokeSystem))] +public partial class SmokeOnTriggerComponent : Component +{ + [DataField("spreadAmount"), ViewVariables(VVAccess.ReadWrite)] + public int SpreadAmount = 20; + + [DataField("time"), ViewVariables(VVAccess.ReadWrite)] + public float Time = 30f; + /// + /// Код взят из https://github.com/space-wizards/space-station-14/pull/16942 + /// + [DataField("sound")] + public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/smoke.ogg"); +} diff --git a/Content.Server/Fluids/EntitySystems/SmokeSystem.cs b/Content.Server/Fluids/EntitySystems/SmokeSystem.cs index 2f62f54fd16..63247bafdf9 100644 --- a/Content.Server/Fluids/EntitySystems/SmokeSystem.cs +++ b/Content.Server/Fluids/EntitySystems/SmokeSystem.cs @@ -1,13 +1,16 @@ using System.Linq; using Content.Server.Chemistry.Components; +using Robust.Shared.Audio; using Content.Server.Chemistry.EntitySystems; using Content.Server.Chemistry.ReactionEffects; +using Content.Server.Explosion.EntitySystems; using Content.Server.Spreader; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reaction; using Content.Shared.FixedPoint; using Content.Shared.Smoking; using Robust.Server.GameObjects; +using Content.Server.Explosion.EntitySystems; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -30,6 +33,7 @@ public sealed class SmokeSystem : EntitySystem [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly SolutionContainerSystem _solutionSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly AudioSystem _audioSystem = default!; /// public override void Initialize() @@ -38,6 +42,7 @@ public override void Initialize() SubscribeLocalEvent(OnSmokeUnpaused); SubscribeLocalEvent(OnReactionAttempt); SubscribeLocalEvent(OnSmokeSpread); + SubscribeLocalEvent(HandleSmokeTrigger); } private void OnSmokeSpread(EntityUid uid, SmokeComponent component, ref SpreadNeighborsEvent args) @@ -220,6 +225,16 @@ public void Start(EntityUid uid, SmokeComponent component, Solution solution, fl timer.Lifetime = duration; } + private void HandleSmokeTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args) + { + var xform = Transform(uid); + var smokeEnt = Spawn("Smoke", xform.Coordinates); + var smoke = EnsureComp(smokeEnt); + smoke.SpreadAmount = comp.SpreadAmount; + _audioSystem.PlayPvs(comp.Sound, xform.Coordinates, AudioParams.Default.WithVariation(0.125f)); + args.Handled = true; + } + /// /// Adds the specified solution to the relevant smoke solution. /// diff --git a/Resources/Locale/ru-RU/ADT/Objects/Weapons/Grenades/grenades.ftl b/Resources/Locale/ru-RU/ADT/Objects/Weapons/Grenades/grenades.ftl new file mode 100644 index 00000000000..035a33be5bc --- /dev/null +++ b/Resources/Locale/ru-RU/ADT/Objects/Weapons/Grenades/grenades.ftl @@ -0,0 +1,7 @@ +ent-ADTSmokeGrenade = Дымовая граната + .desc = Вам определенно не стоит пытаться разобрать её самостоятельно. + .suffix = { "" } + +ent-ADTSSmokeGrenade = Дымовая граната синдиката + .desc = Вам определенно не стоит пытаться разобрать её самостоятельно. Вы чувствуете страх держа её в руках + .suffix = { "" } \ No newline at end of file diff --git a/Resources/Prototypes/ADT/Entities/Objects/Weapons/Throwable/grenades.yml b/Resources/Prototypes/ADT/Entities/Objects/Weapons/Throwable/grenades.yml new file mode 100644 index 00000000000..381ab080001 --- /dev/null +++ b/Resources/Prototypes/ADT/Entities/Objects/Weapons/Throwable/grenades.yml @@ -0,0 +1,45 @@ +- type: entity + name: Smoke Grenade + description: + parent: GrenadeBase + id: ADTSmokeGrenade + components: + - type: Sprite + sprite: ADT/Objects/Weapons/Grenades/smokegrenades.rsi + - type: SmokeOnTrigger + spreadAmount: 70 + time: 40 + sound: /Audio/Effects/smoke.ogg + - type: DeleteOnTrigger + - type: Appearance + - type: OnUseTimerTrigger + delay: 2.5 + beepSound: + path: "/Audio/Effects/beep1.ogg" + params: + volume: 5 + initialBeepDelay: 0 + beepInterval: 2 + +- type: entity + name: Syndicate Smoke Grenade + description: + parent: GrenadeBase + id: ADTSSmokeGrenade + components: + - type: Sprite + sprite: ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi + - type: SmokeOnTrigger + spreadAmount: 120 + time: 60 + sound: /Audio/Effects/smoke.ogg + - type: DeleteOnTrigger + - type: Appearance + - type: OnUseTimerTrigger + delay: 2.5 + beepSound: + path: "/Audio/Effects/beep1.ogg" + params: + volume: 5 + initialBeepDelay: 0 + beepInterval: 2 diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/icon.png b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/icon.png new file mode 100644 index 00000000000..76320918941 Binary files /dev/null and b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/icon.png differ diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/meta.json b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/meta.json new file mode 100644 index 00000000000..2a869bf74f6 --- /dev/null +++ b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/meta.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Created by https://github.com/VigersRay", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "primed" + } + ] +} diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/primed.png b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/primed.png new file mode 100644 index 00000000000..76320918941 Binary files /dev/null and b/Resources/Textures/ADT/Objects/Weapons/Grenades/smokegrenades.rsi/primed.png differ diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/icon.png b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/icon.png new file mode 100644 index 00000000000..e3a8446eec2 Binary files /dev/null and b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/icon.png differ diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/meta.json b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/meta.json new file mode 100644 index 00000000000..2a869bf74f6 --- /dev/null +++ b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/meta.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Created by https://github.com/VigersRay", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "primed" + } + ] +} diff --git a/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/primed.png b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/primed.png new file mode 100644 index 00000000000..e3a8446eec2 Binary files /dev/null and b/Resources/Textures/ADT/Objects/Weapons/Grenades/ssmokegreandes.rsi/primed.png differ