Disable footstep sounds for ghosts (#343)
* Disable footstep sounds for ghosts Adds a check before playing footstep sounds to check if the mover is a ghost. Doesn't play footstep sounds if they are a ghost. * Add FootstepSoundComponent Adds FootstepSoundComponent. If a mob has this component, it will make footstep sounds. Otherwise they will not. As of this commit humans have this component and ghosts do not.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
de141c49c5
commit
0090af6b3b
@@ -0,0 +1,21 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Mobs;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
/// <summary>
|
||||
/// Mobs will only make footstep sounds if they have this component.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class FootstepSoundComponent : Component
|
||||
{
|
||||
public override string Name => "FootstepSound";
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Movement;
|
||||
using Content.Shared.Audio;
|
||||
@@ -153,6 +154,12 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
if (mover.StepSoundDistance > distanceNeeded)
|
||||
{
|
||||
mover.StepSoundDistance = 0;
|
||||
|
||||
if (!mover.Owner.HasComponent<FootstepSoundComponent>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mover.Owner.TryGetComponent<InventoryComponent>(out var inventory)
|
||||
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
|
||||
&& item.Owner.TryGetComponent<FootstepModifierComponent>(out var modifier))
|
||||
|
||||
@@ -67,4 +67,5 @@
|
||||
- type: Teleportable
|
||||
- type: Examiner
|
||||
- type: CharacterInfo
|
||||
- type: FootstepSound
|
||||
|
||||
|
||||
Reference in New Issue
Block a user