Improve Gas Yaml Serialization (#40070)

* Make yaml gas serialization cleaner

* fix exception

* fix validation code

* rudimentary test & permissive loading

* change it a bit

* Test fixes and adjustments
This commit is contained in:
Nemanja
2025-09-04 14:48:46 -04:00
committed by GitHub
parent d33478e41f
commit 7dbe1b219c
13 changed files with 254 additions and 177 deletions

View File

@@ -458,11 +458,8 @@ namespace Content.Server.Atmos.EntitySystems
continue;
var doReaction = true;
for (var i = 0; i < prototype.MinimumRequirements.Length; i++)
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
{
if(i >= Atmospherics.TotalNumberOfGases)
throw new IndexOutOfRangeException("Reaction Gas Minimum Requirements Array Prototype exceeds total number of gases!");
var req = prototype.MinimumRequirements[i];
if (!(mixture.GetMoles(i) < req))

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Atmos.Reactions
/// <summary>
/// Minimum gas amount requirements.
/// </summary>
[DataField("minimumRequirements")]
[DataField("minimumRequirements", customTypeSerializer: typeof(GasArraySerializer))]
public float[] MinimumRequirements { get; private set; } = new float[Atmospherics.TotalNumberOfGases];
/// <summary>