Sounds for stun baton
This commit is contained in:
@@ -49,13 +49,6 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
[ViewVariables] public float KnockdownCap => _knockdownCap;
|
||||
[ViewVariables] public float SlowdownCap => _slowdownCap;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
Timer.Spawn(1000, () => Slowdown(20f));
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
@@ -15,15 +18,22 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
public class StunbatonComponent : MeleeWeaponComponent, IUse
|
||||
{
|
||||
[Dependency] private IRobustRandom _robustRandom;
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
|
||||
public override string Name => "Stunbaton";
|
||||
|
||||
private float _paralyzeTime = 10f;
|
||||
private float _paralyzeChance = 0.25f;
|
||||
private float _slowdownTime = 5f;
|
||||
|
||||
private bool _activated = false;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _paralyzeChance = 0.25f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _paralyzeTime = 10f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _slowdownTime = 5f;
|
||||
|
||||
[ViewVariables]
|
||||
public bool Activated => _activated;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
@@ -37,9 +47,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
public override void OnHitEntities(IEnumerable<IEntity> entities)
|
||||
{
|
||||
if (!_activated)
|
||||
if (!Activated)
|
||||
return;
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
.Play("/Audio/weapons/egloves.ogg", Owner, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (!entity.TryGetComponent(out StunnableComponent stunnable)) continue;
|
||||
@@ -64,6 +77,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
}
|
||||
else
|
||||
{
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
.Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "on";
|
||||
sprite.LayerSetState(0, "stunbaton_on");
|
||||
_activated = true;
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace Content.Server.Mobs
|
||||
appearance.SetData(SharedSpeciesComponent.MobVisuals.RotationState, newState);
|
||||
|
||||
if (playSound)
|
||||
PlaySoundCollection("bodyfall", AudioHelpers.WithVariation(0.25f));
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
|
||||
.Play(AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"), entity, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
if(dropItems)
|
||||
DropAllItemsInHands(entity);
|
||||
@@ -69,13 +70,5 @@ namespace Content.Server.Mobs
|
||||
hands.Drop(heldItem.Owner);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaySoundCollection(string name, AudioParams parameters = default)
|
||||
{
|
||||
var soundCollection = IoCManager.Resolve<IPrototypeManager>().Index<SoundCollectionPrototype>(name);
|
||||
var file = IoCManager.Resolve<IRobustRandom>().Pick(soundCollection.PickFiles);
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
|
||||
.Play(file, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Resources/Audio/effects/Egloves.ogg
Normal file
BIN
Resources/Audio/effects/Egloves.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/effects/sparks1.ogg
Normal file
BIN
Resources/Audio/effects/sparks1.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/effects/sparks2.ogg
Normal file
BIN
Resources/Audio/effects/sparks2.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/effects/sparks3.ogg
Normal file
BIN
Resources/Audio/effects/sparks3.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/effects/sparks4.ogg
Normal file
BIN
Resources/Audio/effects/sparks4.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/weapons/egloves.ogg
Normal file
BIN
Resources/Audio/weapons/egloves.ogg
Normal file
Binary file not shown.
7
Resources/Prototypes/SoundCollections/sparks.yml
Normal file
7
Resources/Prototypes/SoundCollections/sparks.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- type: sound_collection
|
||||
id: sparks
|
||||
files:
|
||||
- /Audio/effects/sparks1.ogg
|
||||
- /Audio/effects/sparks2.ogg
|
||||
- /Audio/effects/sparks3.ogg
|
||||
- /Audio/effects/sparks4.ogg
|
||||
Reference in New Issue
Block a user