diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs index 12f7dc746d..661c3a11b7 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs @@ -1,9 +1,16 @@ using System; using Content.Server.GameObjects.EntitySystems; +using Content.Shared.Audio; using Robust.Server.GameObjects; +using Robust.Server.GameObjects.EntitySystems; +using Robust.Shared.Audio; using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; using Robust.Shared.Serialization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -18,6 +25,12 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools { SpriteComponent spriteComponent; +#pragma warning disable 649 + [Dependency] private readonly IPrototypeManager _prototypeManager; + [Dependency] private readonly IRobustRandom _robustRandom; + [Dependency] private readonly IEntitySystemManager _entitySystemManager; +#pragma warning restore 649 + public override string Name => "Welder"; /// @@ -133,12 +146,14 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools Activated = false; // Layer 1 is the flame. spriteComponent.LayerSetVisible(1, false); + PlaySoundCollection("welder_off", -5); return true; } else if (CanActivate()) { Activated = true; spriteComponent.LayerSetVisible(1, true); + PlaySoundCollection("welder_on", -5); return true; } else @@ -162,5 +177,13 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools message.AddMarkup(loc.GetString("Fuel: [color={0}]{1}/{2}[/color].", Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity)); } + + private void PlaySoundCollection(string name, float volume) + { + var soundCollection = _prototypeManager.Index(name); + var file = _robustRandom.Pick(soundCollection.PickFiles); + _entitySystemManager.GetEntitySystem() + .Play(file, AudioParams.Default.WithVolume(volume)); + } } } diff --git a/Resources/Audio/effects/zzzt.ogg b/Resources/Audio/effects/zzzt.ogg new file mode 100644 index 0000000000..282448c29b Binary files /dev/null and b/Resources/Audio/effects/zzzt.ogg differ diff --git a/Resources/Audio/items/lighter1.ogg b/Resources/Audio/items/lighter1.ogg new file mode 100644 index 0000000000..d21705c2ab Binary files /dev/null and b/Resources/Audio/items/lighter1.ogg differ diff --git a/Resources/Audio/items/lighter2.ogg b/Resources/Audio/items/lighter2.ogg new file mode 100644 index 0000000000..be06401fc4 Binary files /dev/null and b/Resources/Audio/items/lighter2.ogg differ diff --git a/Resources/Prototypes/Entities/items/tools.yml b/Resources/Prototypes/Entities/items/tools.yml index 4e23db703a..47d69fba5a 100644 --- a/Resources/Prototypes/Entities/items/tools.yml +++ b/Resources/Prototypes/Entities/items/tools.yml @@ -61,6 +61,17 @@ - type: ItemCooldown - type: MeleeWeapon +- type: sound_collection + id: welder_on + files: + - /Audio/items/lighter1.ogg + - /Audio/items/lighter2.ogg + +- type: sound_collection + id: welder_off + files: + - /Audio/effects/zzzt.ogg + - type: entity name: Crowbar parent: BaseItem