diff --git a/Content.Server/GameObjects/Components/Power/LightBulbComponent.cs b/Content.Server/GameObjects/Components/Power/LightBulbComponent.cs index 9316dd6be9..f8fde7b236 100644 --- a/Content.Server/GameObjects/Components/Power/LightBulbComponent.cs +++ b/Content.Server/GameObjects/Components/Power/LightBulbComponent.cs @@ -1,7 +1,15 @@ using System; +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.Maths; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -24,9 +32,14 @@ namespace Content.Server.GameObjects.Components.Power /// Component that represents a light bulb. Can be broken, or burned, which turns them mostly useless. /// [RegisterComponent] - public class LightBulbComponent : Component + public class LightBulbComponent : Component, ILand { +#pragma warning disable 649 + [Dependency] private readonly IPrototypeManager _prototypeManager; + [Dependency] private readonly IRobustRandom _random; +#pragma warning restore 649 + /// /// Invoked whenever the state of the light bulb changes. /// @@ -104,5 +117,18 @@ namespace Content.Server.GameObjects.Components.Power base.Initialize(); UpdateColor(); } + + public void Land(LandEventArgs eventArgs) + { + if (State == LightBulbState.Broken) + return; + + var soundCollection = _prototypeManager.Index("glassbreak"); + var file = _random.Pick(soundCollection.PickFiles); + + IoCManager.Resolve().GetEntitySystem().Play(file, Owner); + + State = LightBulbState.Broken; + } } } diff --git a/Resources/Audio/effects/glassbreak1.ogg b/Resources/Audio/effects/glassbreak1.ogg new file mode 100644 index 0000000000..fe14cdeda3 Binary files /dev/null and b/Resources/Audio/effects/glassbreak1.ogg differ diff --git a/Resources/Audio/effects/glassbreak2.ogg b/Resources/Audio/effects/glassbreak2.ogg new file mode 100644 index 0000000000..79163acc19 Binary files /dev/null and b/Resources/Audio/effects/glassbreak2.ogg differ diff --git a/Resources/Audio/effects/glassbreak3.ogg b/Resources/Audio/effects/glassbreak3.ogg new file mode 100644 index 0000000000..bc45ab3332 Binary files /dev/null and b/Resources/Audio/effects/glassbreak3.ogg differ diff --git a/Resources/Prototypes/SoundCollections/glassbreak.yml b/Resources/Prototypes/SoundCollections/glassbreak.yml new file mode 100644 index 0000000000..ee3d9278bb --- /dev/null +++ b/Resources/Prototypes/SoundCollections/glassbreak.yml @@ -0,0 +1,6 @@ +- type: sound_collection + id: glassbreak + files: + - /Audio/effects/glassbreak1.ogg + - /Audio/effects/glassbreak2.ogg + - /Audio/effects/glassbreak3.ogg