From ec25dbe4a70e350921fd319b38f9c585683ea152 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Thu, 29 Oct 2020 10:26:23 +0100 Subject: [PATCH] Fix mobs playing a falling sound when dying from crit (#2425) * Fix falling sound playing twice when dying * But actually --- .../GameObjects/EntitySystems/StandingStateSystem.cs | 6 ------ .../GameObjects/Components/Mobs/State/CriticalState.cs | 2 -- .../GameObjects/Components/Mobs/State/DeadState.cs | 2 -- .../GameObjects/Components/Mobs/State/NormalState.cs | 8 +++++--- .../GameObjects/EntitySystems/StandingStateSystem.cs | 10 +++++----- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Content.Client/GameObjects/EntitySystems/StandingStateSystem.cs b/Content.Client/GameObjects/EntitySystems/StandingStateSystem.cs index 212d386c01..b5659fe7b1 100644 --- a/Content.Client/GameObjects/EntitySystems/StandingStateSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/StandingStateSystem.cs @@ -24,12 +24,6 @@ namespace Content.Client.GameObjects.EntitySystems appearance.SetData(RotationVisuals.RotationState, newState); } - if (playSound) - { - var file = AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"); - Get().Play(file, entity, AudioHelpers.WithVariation(0.25f)); - } - return true; } diff --git a/Content.Server/GameObjects/Components/Mobs/State/CriticalState.cs b/Content.Server/GameObjects/Components/Mobs/State/CriticalState.cs index 4592a90f51..0adea20dde 100644 --- a/Content.Server/GameObjects/Components/Mobs/State/CriticalState.cs +++ b/Content.Server/GameObjects/Components/Mobs/State/CriticalState.cs @@ -38,8 +38,6 @@ namespace Content.Server.GameObjects.Components.Mobs.State public override void ExitState(IEntity entity) { - EntitySystem.Get().Standing(entity); - if (entity.TryGetComponent(out ServerOverlayEffectsComponent overlay)) { overlay.ClearOverlays(); diff --git a/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs b/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs index 5c19d0a872..9fc2428975 100644 --- a/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs +++ b/Content.Server/GameObjects/Components/Mobs/State/DeadState.cs @@ -44,8 +44,6 @@ namespace Content.Server.GameObjects.Components.Mobs.State public override void ExitState(IEntity entity) { - EntitySystem.Get().Standing(entity); - if (entity.TryGetComponent(out IPhysicsComponent physics)) { physics.CanCollide = true; diff --git a/Content.Server/GameObjects/Components/Mobs/State/NormalState.cs b/Content.Server/GameObjects/Components/Mobs/State/NormalState.cs index a2416447f7..6b8eb4aab3 100644 --- a/Content.Server/GameObjects/Components/Mobs/State/NormalState.cs +++ b/Content.Server/GameObjects/Components/Mobs/State/NormalState.cs @@ -1,10 +1,10 @@ -using Content.Server.GameObjects.Components.Body; -using Content.Server.GameObjects.Components.Damage; -using Content.Shared.GameObjects.Components.Body; +using Content.Server.GameObjects.Components.Damage; +using Content.Server.GameObjects.EntitySystems; using Content.Shared.GameObjects.Components.Damage; using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Mobs.State; using Robust.Server.GameObjects; +using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; namespace Content.Server.GameObjects.Components.Mobs.State @@ -13,6 +13,8 @@ namespace Content.Server.GameObjects.Components.Mobs.State { public override void EnterState(IEntity entity) { + EntitySystem.Get().Standing(entity); + if (entity.TryGetComponent(out AppearanceComponent appearance)) { appearance.SetData(DamageStateVisuals.State, DamageState.Alive); diff --git a/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs b/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs index 74f99551c3..13974c76e4 100644 --- a/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StandingStateSystem.cs @@ -25,12 +25,12 @@ namespace Content.Server.GameObjects.EntitySystems if (newState != oldState) { appearance.SetData(RotationVisuals.RotationState, newState); - } - if (playSound) - { - var file = AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"); - Get().PlayFromEntity(file, entity, AudioHelpers.WithVariation(0.25f)); + if (playSound) + { + var file = AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"); + Get().PlayFromEntity(file, entity, AudioHelpers.WithVariation(0.25f)); + } } return true;