diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index e827658d2b..57aad41b94 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -1,4 +1,5 @@ using Content.Server.GameObjects.Components.Power; +using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces.GameObjects; using Content.Shared.GameObjects; @@ -50,9 +51,20 @@ namespace Content.Server.GameObjects.Components.Interactable if (Cell != null) return false; - eventArgs.User.GetComponent().Drop(eventArgs.AttackWith, _cellContainer); + var handsComponent = eventArgs.User.GetComponent(); + + if (!handsComponent.Drop(eventArgs.AttackWith, _cellContainer)) + { + return false; + } + + if (Owner.TryGetComponent(out SoundComponent soundComponent)) + { + soundComponent.Play("/Audio/items/weapons/pistol_magin.ogg"); + } + + return true; - return _cellContainer.Insert(eventArgs.AttackWith); } void IExamine.Examine(FormattedMessage message) @@ -85,17 +97,14 @@ namespace Content.Server.GameObjects.Components.Interactable /// True if the light's status was toggled, false otherwise. public bool ToggleStatus() { - // Update the activation state. - Activated = !Activated; - // Update sprite and light states to match the activation. if (Activated) { - SetState(LightState.On); + TurnOff(); } else { - SetState(LightState.Off); + TurnOn(); } // Toggle always succeeds. @@ -104,25 +113,57 @@ namespace Content.Server.GameObjects.Components.Interactable public void TurnOff() { - if (!Activated) return; + if (!Activated) + { + return; + } SetState(LightState.Off); Activated = false; + + if (Owner.TryGetComponent(out SoundComponent soundComponent)) + { + soundComponent.Play("/Audio/items/flashlight_toggle.ogg"); + } } public void TurnOn() { - if (Activated) return; + if (Activated) + { + return; + } var cell = Cell; - if (cell == null) return; + SoundComponent soundComponent; + if (cell == null) + { + if (Owner.TryGetComponent(out soundComponent)) + { + soundComponent.Play("/Audio/machines/button.ogg"); + } + return; + } // To prevent having to worry about frame time in here. // Let's just say you need a whole second of charge before you can turn it on. // Simple enough. - if (cell.AvailableCharge(1) < Wattage) return; + if (cell.AvailableCharge(1) < Wattage) + { + if (Owner.TryGetComponent(out soundComponent)) + { + soundComponent.Play("/Audio/machines/button.ogg"); + } + return; + } + Activated = true; SetState(LightState.On); + + if (Owner.TryGetComponent(out soundComponent)) + { + soundComponent.Play("/Audio/items/flashlight_toggle.ogg"); + } } private void SetState(LightState newState) @@ -145,15 +186,32 @@ namespace Content.Server.GameObjects.Components.Interactable private void EjectCell(IEntity user) { - if (Cell == null) return; + if (Cell == null) + { + return; + } var cell = Cell; - if (!_cellContainer.Remove(cell.Owner)) return; + if (!_cellContainer.Remove(cell.Owner)) + { + return; + } - if (!user.TryGetComponent(out HandsComponent hands) - || !hands.PutInHand(cell.Owner.GetComponent())) + if (!user.TryGetComponent(out HandsComponent hands)) + { + return; + } + + if (!hands.PutInHand(cell.Owner.GetComponent())) + { cell.Owner.Transform.GridPosition = user.Transform.GridPosition; + } + + if (Owner.TryGetComponent(out SoundComponent soundComponent)) + { + soundComponent.Play("/Audio/items/weapons/pistol_magout.ogg"); + } } [Verb] diff --git a/Resources/Audio/items/flashlight_toggle.ogg b/Resources/Audio/items/flashlight_toggle.ogg new file mode 100644 index 0000000000..7839e1f035 Binary files /dev/null and b/Resources/Audio/items/flashlight_toggle.ogg differ diff --git a/Resources/Audio/items/weapons/pistol_cock.ogg b/Resources/Audio/items/weapons/pistol_cock.ogg new file mode 100644 index 0000000000..ff2512af27 Binary files /dev/null and b/Resources/Audio/items/weapons/pistol_cock.ogg differ diff --git a/Resources/Audio/items/weapons/pistol_magin.ogg b/Resources/Audio/items/weapons/pistol_magin.ogg new file mode 100644 index 0000000000..c442f8b162 Binary files /dev/null and b/Resources/Audio/items/weapons/pistol_magin.ogg differ diff --git a/Resources/Audio/items/weapons/pistol_magout.ogg b/Resources/Audio/items/weapons/pistol_magout.ogg new file mode 100644 index 0000000000..334d1a12f2 Binary files /dev/null and b/Resources/Audio/items/weapons/pistol_magout.ogg differ diff --git a/Resources/Audio/items/weapons/sources.txt b/Resources/Audio/items/weapons/sources.txt index 5e7f1a1173..03628c6ca9 100644 --- a/Resources/Audio/items/weapons/sources.txt +++ b/Resources/Audio/items/weapons/sources.txt @@ -5,3 +5,6 @@ smg_empty_alarm.ogg: https://github.com/discordia-space/CEV-Eris/blob/fbde37a864 casingfall1.ogg: https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall1.ogg casingfall2.ogg: https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall2.ogg casingfall3.ogg: https://github.com/discordia-space/CEV-Eris/blob/fbde37a8647a82587d363da999a94cf02c2e128c/sound/weapons/guns/misc/casingfall3.ogg +pistol_cock.ogg: https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/sound/weapons/guns/interact/pistol_cock.ogg +pistol_magin.ogg: https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/sound/weapons/guns/interact/pistol_magin.ogg +pistol_magout.ogg: https://github.com/discordia-space/CEV-Eris/blob/c0293684320e7b70cbcac932b8dddeee35f3a51f/sound/weapons/guns/interact/pistol_magout.ogg diff --git a/Resources/Audio/machines/button.ogg b/Resources/Audio/machines/button.ogg new file mode 100644 index 0000000000..79b458317a Binary files /dev/null and b/Resources/Audio/machines/button.ogg differ diff --git a/Resources/Prototypes/Entities/items/flashlight.yml b/Resources/Prototypes/Entities/items/flashlight.yml index 7d3bbee634..f1b539af7a 100644 --- a/Resources/Prototypes/Entities/items/flashlight.yml +++ b/Resources/Prototypes/Entities/items/flashlight.yml @@ -17,3 +17,4 @@ state: lantern_off - type: PointLight state: Off + - type: Sound diff --git a/Resources/Textures/Objects/lantern.rsi/HandheldLightOnOverlay.png b/Resources/Textures/Objects/lantern.rsi/HandheldLightOnOverlay.png index b08e42294f..dc69a9359b 100644 Binary files a/Resources/Textures/Objects/lantern.rsi/HandheldLightOnOverlay.png and b/Resources/Textures/Objects/lantern.rsi/HandheldLightOnOverlay.png differ