FIXED: Chemistry JSON dump tool and companion GitHub Action (#6222)
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
36
Content.Server/GuideGenerator/ReactionJsonGenerator.cs
Normal file
36
Content.Server/GuideGenerator/ReactionJsonGenerator.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GuideGenerator;
|
||||
|
||||
public 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);
|
||||
|
||||
var serializeOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
Converters =
|
||||
{
|
||||
new UniversalJsonConverter<ReagentEffect>(),
|
||||
}
|
||||
};
|
||||
|
||||
file.Write(JsonSerializer.Serialize(reactions, serializeOptions));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user