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

@@ -33,10 +33,10 @@ namespace Content.Server.Tools.Components
[DataField("sprite")]
public string Sprite { get; } = string.Empty;
[DataField("useSound")]
[DataField("useSound", required: true)]
public SoundSpecifier Sound { get; } = default!;
[DataField("changeSound")]
[DataField("changeSound", required: true)]
public SoundSpecifier ChangeSound { get; } = default!;
}
@@ -60,8 +60,7 @@ namespace Content.Server.Tools.Components
_currentTool = (_currentTool + 1) % _tools.Count;
SetTool();
var current = _tools[_currentTool];
if(current.ChangeSound.TryGetSound(out var changeSound))
SoundSystem.Play(Filter.Pvs(Owner), changeSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), current.ChangeSound.GetSound(), Owner);
}
private void SetTool()