From 4ddd7d3c5f514e667f5caf4c28b5710542cfe75c Mon Sep 17 00:00:00 2001 From: mubururu_ <139181059+muburu@users.noreply.github.com> Date: Mon, 23 Dec 2024 08:24:09 -0600 Subject: [PATCH] silent footsteps for ninja (#33280) * waow * nice suggestion * nullable sound * fix stuff --------- Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- Content.Client/Tips/TippyUIController.cs | 2 +- .../Movement/Components/FootstepModifierComponent.cs | 4 ++-- Content.Shared/Movement/Systems/SharedMoverController.cs | 9 ++++----- .../Prototypes/Entities/Clothing/Shoes/specific.yml | 3 +++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Content.Client/Tips/TippyUIController.cs b/Content.Client/Tips/TippyUIController.cs index 7737a3d6982e20..77c10193a5d1fc 100644 --- a/Content.Client/Tips/TippyUIController.cs +++ b/Content.Client/Tips/TippyUIController.cs @@ -104,7 +104,7 @@ private Vector2 UpdatePosition(TippyUI tippy, Vector2 screenSize, FrameEventArgs ? -WaddleRotation : WaddleRotation; - if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step)) + if (EntityManager.TryGetComponent(_entity, out FootstepModifierComponent? step) && step.FootstepSoundCollection != null) { var audioParams = step.FootstepSoundCollection.Params .AddVolume(-7f) diff --git a/Content.Shared/Movement/Components/FootstepModifierComponent.cs b/Content.Shared/Movement/Components/FootstepModifierComponent.cs index bd7b5377bd49de..e658f6d948bb99 100644 --- a/Content.Shared/Movement/Components/FootstepModifierComponent.cs +++ b/Content.Shared/Movement/Components/FootstepModifierComponent.cs @@ -9,6 +9,6 @@ namespace Content.Shared.Movement.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class FootstepModifierComponent : Component { - [DataField(required: true), AutoNetworkedField] - public SoundSpecifier FootstepSoundCollection = default!; + [DataField, AutoNetworkedField] + public SoundSpecifier? FootstepSoundCollection; } diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 472d56b1d692d7..5de74d72940802 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -439,14 +439,14 @@ private bool TryGetSound( if (FootstepModifierQuery.TryComp(uid, out var moverModifier)) { sound = moverModifier.FootstepSoundCollection; - return true; + return sound != null; } if (_inventory.TryGetSlotEntity(uid, "shoes", out var shoes) && FootstepModifierQuery.TryComp(shoes, out var modifier)) { sound = modifier.FootstepSoundCollection; - return true; + return sound != null; } return TryGetFootstepSound(uid, xform, shoes != null, out sound, tileDef: tileDef); @@ -467,10 +467,9 @@ private bool TryGetFootstepSound( if (FootstepModifierQuery.TryComp(xform.MapUid, out var modifier)) { sound = modifier.FootstepSoundCollection; - return true; } - return false; + return sound != null; } var position = grid.LocalToTile(xform.Coordinates); @@ -493,7 +492,7 @@ private bool TryGetFootstepSound( if (FootstepModifierQuery.TryComp(maybeFootstep, out var footstep)) { sound = footstep.FootstepSoundCollection; - return true; + return sound != null; } } diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index 87a0c06c4a0b55..46fb16b1f25805 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -136,6 +136,9 @@ # ninja are masters of sneaking around relatively quickly, won't break cloak walkModifier: 1.1 sprintModifier: 1.3 + - type: FootstepModifier + footstepSoundCollection: + collection: null - type: entity parent: ClothingShoesBaseButcherable