Fix AudioParams deserialization (#3191)

This commit is contained in:
Leon Friedrich
2022-08-26 11:46:44 +12:00
committed by GitHub
parent 7a636b3b87
commit 31e2ea2770
2 changed files with 8 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ namespace Robust.Shared.Audio
/// If not null, this will randomly modify the pitch scale by adding a number drawn from a normal distribution with this deviation.
/// </summary>
[DataField("variation")]
public float? Variation { get; set; }
public float? Variation { get; set; } = null;
// For the max distance value: it's 2000 in Godot, but I assume that's PIXELS due to the 2D positioning,
// so that's divided by 32 (EyeManager.PIXELSPERMETER).
@@ -91,6 +91,9 @@ namespace Robust.Shared.Audio
/// </summary>
public static readonly AudioParams Default = new(0, 1, "Master", SharedAudioSystem.DefaultSoundRange, 1, 1, false, 0f);
// explicit parameterless constructor required so that default values get set properly.
public AudioParams() { }
public AudioParams(
float volume,
float pitchScale,

View File

@@ -222,7 +222,10 @@ namespace Robust.Shared.Containers
{
[DataField("entities")] public List<EntityUid> Entities = new ();
[DataField("type")] public string? Type;
[DataField("type")] public string? Type = null;
// explicit parameterless constructor is required.
public ContainerPrototypeData() { }
public ContainerPrototypeData(List<EntityUid> entities, string type)
{