Skip to content

Commit

Permalink
Добавлены дымовые гранаты в игру
Browse files Browse the repository at this point in the history
  • Loading branch information
1Stepka1 committed Oct 7, 2023
1 parent df5c326 commit 5012a62
Show file tree
Hide file tree
Showing 20 changed files with 219 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Content.Shared.Chemistry.Components;
using Robust.Shared.Audio;

namespace Content.Server.Fluids.EntitySystems;

[RegisterComponent]
[Access(typeof(SmokeSystem))]
public sealed class SmokeOnTriggerComponent : Component

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.

Check failure on line 8 in Content.Server/ADT/SmokeGrenadeComponent/SmokeOnTriggerComponent.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Type SmokeOnTriggerComponent is a DataDefinition but is not partial.
{
[DataField("spreadAmount"), ViewVariables(VVAccess.ReadWrite)]
public int SpreadAmount = 20;

[DataField("time"), ViewVariables(VVAccess.ReadWrite)]
public float Time = 30f;
/// <summary>
/// Код взят из https://github.com/space-wizards/space-station-14/pull/16942
/// </summary>
[DataField("sound")]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/smoke.ogg");
}
15 changes: 15 additions & 0 deletions Content.Server/Fluids/EntitySystems/SmokeSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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!;

/// <inheritdoc/>
public override void Initialize()
Expand All @@ -39,6 +43,7 @@ public override void Initialize()
SubscribeLocalEvent<SmokeComponent, ReactionAttemptEvent>(OnReactionAttempt);
SubscribeLocalEvent<SmokeComponent, SpreadNeighborsEvent>(OnSmokeSpread);
SubscribeLocalEvent<SmokeDissipateSpawnComponent, TimedDespawnEvent>(OnSmokeDissipate);
SubscribeLocalEvent<SmokeOnTriggerComponent, TriggerEvent>(HandleSmokeTrigger);
}

private void OnSmokeDissipate(EntityUid uid, SmokeDissipateSpawnComponent component, ref TimedDespawnEvent args)
Expand Down Expand Up @@ -231,6 +236,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<SmokeComponent>(smokeEnt);
smoke.SpreadAmount = comp.SpreadAmount;
_audioSystem.PlayPvs(comp.Sound, xform.Coordinates, AudioParams.Default.WithVariation(0.125f));
args.Handled = true;
}

/// <summary>
/// Adds the specified solution to the relevant smoke solution.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,18 @@
- id: BoxSurvivalMedical
- id: JawsOfLife

#Senior
- type: entity
noSpawn: true
parent: ClothingBackpackSecurity
id: ADTClothingBackpackSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: ADTSmokeGrenade
- id: ADTSmokeGrenade
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,29 @@
contents:
- id: ADTExtMagazineRifle
amount: 3
#Senior
- type: entity
noSpawn: true
parent: ClothingBackpackDuffelSecurity
id: ADTClothingBackpackDuffelSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: ADTSmokeGrenade
- id: ADTSmokeGrenade

- type: entity
parent: ClothingBackpackDuffelSyndicateAmmoBundle
id: ADTClothingBackpackDuffelSsmokeGrenade
name: Набор дымовых гранат синдиката
description: Набор из 6 штук дымовых гранат синдиката
components:
- type: StorageFill
contents:
- id: ADTSSmokeGrenade
amount: 6
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@
contents:
- id: BoxSurvivalMedical
- id: JawsOfLife

#Senior
- type: entity
noSpawn: true
parent: ClothingBackpackSatchelSecurity
id: ADTClothingBackpackSatchelSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: ADTSmokeGrenade
- id: ADTSmokeGrenade


Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
- type: entity
name: Дымовая граната
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: Дымовая граната
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
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,4 @@
- id: BoxSurvival
- id: Cutlass
- id: WeaponRevolverPirate
- id: ClothingEyesEyepatch

#ADT
- type: entity
noSpawn: true
parent: ClothingBackpackSecurity
id: ADTClothingBackpackSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: ClothingEyesEyepatch
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,4 @@
components:
- type: StorageFill
contents:
- id: BoxSurvival

#ADT
- type: entity
noSpawn: true
parent: ClothingBackpackDuffelSecurity
id: ADTClothingBackpackDuffelSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: BoxSurvival
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,4 @@
- type: StorageFill
contents:
- id: BoxSurvival
- id: RubberStampMime

#ADT
- type: entity
noSpawn: true
parent: ClothingBackpackSatchelSecurity
id: ADTClothingBackpackSatchelSeniorSecurityFilled
components:
- type: StorageFill
contents:
- id: BoxSurvivalSecurity
- id: Flash
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnumRubber
- id: SpeedLoaderMagnum
- id: RubberStampMime
3 changes: 3 additions & 0 deletions Resources/Prototypes/Catalog/Fills/Backpacks/duffelbag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
amount: 2
- id: GrenadeFrag
amount: 2
- id: ADTSSmokeGrenade

- type: entity
parent: ClothingBackpackDuffelSyndicateAmmo
Expand Down Expand Up @@ -299,6 +300,8 @@
- id: WeaponPistolViper
- id: PinpointerNuclear
- id: MicroBombImplanter
- id: ADTSSmokeGrenade
- id: ADTSSmokeGrenade


- type: entity
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Catalog/Fills/Items/belt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
amount: 2
- id: EmpGrenade
amount: 2
- id: ADTSSmokeGrenade #ADT

- type: entity
id: ClothingBeltMilitaryWebbingMedFilled
Expand Down
29 changes: 29 additions & 0 deletions Resources/Prototypes/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@
- UplinkExplosives
restockTime: 30

- type: listing
id: ADTUplinkSmokeGrenade
name: Дымовая граната
description: Дымовая граната распыляет дым на небольшую область, является улучшенной версией обычной
productEntity: ADTSSmokeGrenade
cost:
Telecrystal: 4
categories:
- UplinkExplosives

# Ammo

- type: listing
Expand Down Expand Up @@ -823,6 +833,25 @@
blacklist:
components:
- SurplusBundle
#ADT
- type: listing
id: ADTUplinkSmokeBundle
name: Набор дымовых гранат синдиката
description: Набор из 6 дымовых гранат синдиката
productEntity: ADTClothingBackpackDuffelSsmokeGrenade
cost:
Telecrystal: 18
categories:
- UplinkBundles
conditions:
- !type:StoreWhitelistCondition
whitelist:
tags:
- NukeOpsUplink
- !type:BuyerWhitelistCondition
blacklist:
components:
- SurplusBundle

# Tools

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@
idleState: icon
runningState: icon
staticRecipes:
- ADTSmokeGrenades
- ClothingEyesHudSecurity
- Flash
- Handcuffs
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/Recipes/Lathes/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,12 @@
Steel: 500
Glass: 100
Plastic: 200
#ADT
- type: latheRecipe
id: ADTSmokeGrenades
result: ADTSmokeGrenade
completetime: 2
materials:
Steel: 200
Plastic: 100
Gold: 10
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5012a62

Please sign in to comment.