Files
wylab-station-14/Content.Server/GuideGenerator/ReactionJsonGenerator.cs
Morb0 a7492708b6 Merge remote-tracking branch 'refs/remotes/upstream/master' into upstream-sync
# Conflicts:
#	Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs
#	Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs
#	Content.Server/GuideGenerator/ReagentEntry.cs
#	Content.Shared/Preferences/HumanoidCharacterProfile.cs
#	Resources/Prototypes/Datasets/ion_storm.yml
2024-07-01 14:55:33 +03:00

40 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);
// Corvax-Wiki-Start
if (reactions is not null) AddMixingCategories(reactions, prototype);
// Corvax-Wiki-End
var serializeOptions = new JsonSerializerOptions
{
WriteIndented = true,
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals, // Corvax-Wiki
Converters =
{
new UniversalJsonConverter<EntityEffect>(),
}
};
file.Write(JsonSerializer.Serialize(reactions, serializeOptions));
}
}