Skip to content

Commit

Permalink
Cleanup: Use SoundSpecifier instead of string literals in ``Vomit…
Browse files Browse the repository at this point in the history
…System`` (space-wizards#35426)

* Cleanup

* Update

* Update
  • Loading branch information
Winkarst-cpu authored Feb 23, 2025
1 parent 91f2c46 commit fa73217
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Content.Server/Medical/VomitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public sealed class VomitSystem : EntitySystem
[Dependency] private readonly ForensicsSystem _forensics = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;

[ValidatePrototypeId<SoundCollectionPrototype>]
private const string VomitCollection = "Vomit";

private readonly SoundSpecifier _vomitSound = new SoundCollectionSpecifier(VomitCollection,
AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));

/// <summary>
/// Make an entity vomit, if they have a stomach.
/// </summary>
Expand Down Expand Up @@ -94,7 +100,7 @@ public void Vomit(EntityUid uid, float thirstAdded = -40f, float hungerAdded = -
}

// Force sound to play as spill doesn't work if solution is empty.
_audio.PlayPvs("/Audio/Effects/Fluids/splat.ogg", uid, AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));
_audio.PlayPvs(_vomitSound, uid);
_popup.PopupEntity(Loc.GetString("disease-vomit", ("person", Identity.Entity(uid, EntityManager))), uid);
}
}
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/SoundCollections/disease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@
id: Honks
files:
- /Audio/Items/bikehorn.ogg

- type: soundCollection
id: Vomit
files:
- /Audio/Effects/Fluids/splat.ogg

0 comments on commit fa73217

Please sign in to comment.