Cleanup: Use `SoundCollectionSpecifier instead of string literals in BibleSystem` (#35448)

* Cleanup

* Update
This commit is contained in:
Winkarst
2025-02-25 00:23:50 +03:00
committed by GitHub
parent ebc1bff4cb
commit 004e54af51
4 changed files with 35 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ namespace Content.Server.Bible
}
summonableComp.AlreadySummoned = false;
_popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", uid)), uid, PopupType.Medium);
_audio.PlayPvs("/Audio/Effects/radpulse9.ogg", uid, AudioParams.Default.WithVolume(-4f));
_audio.PlayPvs(summonableComp.SummonSound, uid);
// Clean up the accumulator and respawn tracking component
summonableComp.Accumulator = 0;
_remQueue.Enqueue(uid);
@@ -126,7 +126,7 @@ namespace Content.Server.Bible
var selfFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-self", ("target", Identity.Entity(args.Target.Value, EntityManager)), ("bible", uid));
_popupSystem.PopupEntity(selfFailMessage, args.User, args.User, PopupType.MediumCaution);
_audio.PlayPvs("/Audio/Effects/hit_kick.ogg", args.User);
_audio.PlayPvs(component.BibleHitSound, args.User);
_damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true, origin: uid);
_delay.TryResetDelay((uid, useDelay));
return;

View File

@@ -1,11 +1,23 @@
using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Server.Bible.Components
{
[RegisterComponent]
public sealed partial class BibleComponent : Component
{
/// <summary>
/// Default sound when bible hits somebody.
/// </summary>
private static readonly ProtoId<SoundCollectionPrototype> DefaultBibleHit = new("BibleHit");
/// <summary>
/// Sound to play when bible hits somebody.
/// </summary>
[DataField]
public SoundSpecifier BibleHitSound = new SoundCollectionSpecifier(DefaultBibleHit, AudioParams.Default.WithVolume(-4f));
/// <summary>
/// Damage that will be healed on a success
/// </summary>

View File

@@ -1,3 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -9,6 +10,17 @@ namespace Content.Server.Bible.Components
[RegisterComponent]
public sealed partial class SummonableComponent : Component
{
/// <summary>
/// Default sound to play when entity is summoned.
/// </summary>
private static readonly ProtoId<SoundCollectionPrototype> DefaultSummonSound = new("Summon");
/// <summary>
/// Sound to play when entity is summoned.
/// </summary>
[DataField]
public SoundSpecifier SummonSound = new SoundCollectionSpecifier(DefaultSummonSound, AudioParams.Default.WithVolume(-4f));
/// <summary>
/// Used for a special item only the Chaplain can summon. Usually a mob, but supports regular items too.
/// </summary>

View File

@@ -0,0 +1,9 @@
- type: soundCollection
id: Summon
files:
- /Audio/Effects/radpulse9.ogg
- type: soundCollection
id: BibleHit
files:
- /Audio/Effects/hit_kick.ogg