Fixed flashlights staying enabled after taking the battery out of them (#2158)
* Fixed flashlights staying enabled after taking the battery out of them * Refactored code for flashlights shutting off after the battery is removed * Fixed casing in makeNoise
This commit is contained in:
@@ -124,7 +124,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TurnOff()
|
private void TurnOff(bool makeNoise = true)
|
||||||
{
|
{
|
||||||
if (!Activated)
|
if (!Activated)
|
||||||
{
|
{
|
||||||
@@ -134,8 +134,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
SetState(false);
|
SetState(false);
|
||||||
Activated = false;
|
Activated = false;
|
||||||
|
|
||||||
|
if (makeNoise)
|
||||||
|
{
|
||||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/flashlight_toggle.ogg", Owner);
|
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/flashlight_toggle.ogg", Owner);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void TurnOn(IEntity user)
|
private void TurnOn(IEntity user)
|
||||||
{
|
{
|
||||||
@@ -237,6 +240,9 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
|
cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assuming the battery has just been taken out of the flashlight, make sure it's getting disabled
|
||||||
|
TurnOff(false);
|
||||||
|
|
||||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/pistol_magout.ogg", Owner);
|
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/pistol_magout.ogg", Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user