Files
tbd-station-14/Content.Server/GuideGenerator/ReactionJsonGenerator.cs
SlamBamActionman b9fa941ca6 Turn ReagentEffects into generic EntityEffects (#28168)
* Oh the possibilities

* Merge fixes

* Forgot to remote LavaSystem oops

* Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs

* Throw exception for unimplemented effectargs

* Remove Json and overrideable datafields

* Fix test issues

* Actually fix the compiling issue

* Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
2024-06-30 13:43:43 +10:00

35 lines
898 B
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 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<EntityEffect>(),
}
};
file.Write(JsonSerializer.Serialize(reactions, serializeOptions));
}
}