fish-station/Content.Server/GuideGenerator/ReactionJsonGenerator.cs
VigersRay 33c1d3814f Merge remote-tracking branch 'refs/remotes/wizards/master'
# Conflicts:
#	Content.Server/GuideGenerator/ReagentEntry.cs
#	Resources/Prototypes/Datasets/ion_storm.yml
#	Resources/Prototypes/GameRules/events.yml
2024-07-01 18:10:48 +03:00

39 lines
1.1 KiB
C#

using System.IO;
using System.Linq;
using System.Text.Json;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.GuideGenerator;
public sealed partial class ReactionJsonGenerator
{
public static void PublishJson(StreamWriter file)
{
var prototype = IoCManager.Resolve<IPrototypeManager>();
var reactions =
prototype
.EnumeratePrototypes<ReactionPrototype>()
.Select(x => new ReactionEntry(x))
.ToDictionary(x => x.Id, x => x);
// Wiki-Start
if (reactions is not null) AddMixingCategories(reactions, prototype);
// Wiki-End
var serializeOptions = new JsonSerializerOptions
{
WriteIndented = true,
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals, // Wiki
Converters =
{
new UniversalJsonConverter<EntityEffect>(),
}
};
file.Write(JsonSerializer.Serialize(reactions, serializeOptions));
}
}