Skip to content

Commit

Permalink
silent footsteps for ninja (space-wizards#33280)
Browse files Browse the repository at this point in the history
* waow

* nice suggestion

* nullable sound

* fix stuff

---------

Co-authored-by: Ed <[email protected]>
Co-authored-by: slarticodefast <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent c873f90 commit 4ddd7d3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Tips/TippyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
9 changes: 4 additions & 5 deletions Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -493,7 +492,7 @@ private bool TryGetFootstepSound(
if (FootstepModifierQuery.TryComp(maybeFootstep, out var footstep))
{
sound = footstep.FootstepSoundCollection;
return true;
return sound != null;
}
}

Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ddd7d3

Please sign in to comment.