removed TryGetSound + made some SoundSpecifier datafields required

This commit is contained in:
Galactic Chimp
2021-07-31 19:52:33 +02:00
parent 8ff703c338
commit 57016d14b4
114 changed files with 519 additions and 785 deletions

View File

@@ -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>

View File

@@ -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));
}
}