removed TryGetSound + made some SoundSpecifier datafields required
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Content.Server.Cabinet
|
||||
/// Sound to be played when the cabinet door is opened.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("doorSound")]
|
||||
[DataField("doorSound", required: true)]
|
||||
public SoundSpecifier DoorSound { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.Cabinet
|
||||
comp.ItemContainer =
|
||||
owner.EnsureContainer<ContainerSlot>("item_cabinet", out _);
|
||||
|
||||
if(comp.SpawnPrototype != null)
|
||||
if (comp.SpawnPrototype != null)
|
||||
comp.ItemContainer.Insert(EntityManager.SpawnEntity(comp.SpawnPrototype, owner.Transform.Coordinates));
|
||||
|
||||
UpdateVisuals(comp);
|
||||
@@ -146,10 +146,7 @@ namespace Content.Server.Cabinet
|
||||
|
||||
private static void ClickLatchSound(ItemCabinetComponent comp)
|
||||
{
|
||||
if(comp.DoorSound.TryGetSound(out var doorSound))
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), doorSound, comp.Owner, AudioHelpers.WithVariation(0.15f));
|
||||
}
|
||||
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.DoorSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.15f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user