Reactive 3.0 (#5443)
* probably scrapping this * reimpl old behavior * misc fixes and initial yaml * works basically first try
This commit is contained in:
@@ -1,31 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
||||
|
||||
namespace Content.Shared.Chemistry.Reaction
|
||||
namespace Content.Shared.Chemistry.Reaction;
|
||||
|
||||
[RegisterComponent]
|
||||
public class ReactiveComponent : Component
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ReactiveComponent : Component
|
||||
{
|
||||
public override string Name => "Reactive";
|
||||
public override string Name => "Reactive";
|
||||
|
||||
[DataField("reactions", required: true, readOnly: true, serverOnly: true)]
|
||||
public List<ReactiveReagentEffectEntry> Reactions { get; } = default!;
|
||||
}
|
||||
/// <summary>
|
||||
/// A dictionary of reactive groups -> methods that work on them.
|
||||
/// </summary>
|
||||
[DataField("groups", readOnly: true, serverOnly: true,
|
||||
customTypeSerializer:
|
||||
typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
|
||||
public Dictionary<string, HashSet<ReactionMethod>>? ReactiveGroups;
|
||||
|
||||
[DataDefinition]
|
||||
public class ReactiveReagentEffectEntry
|
||||
{
|
||||
[DataField("methods")]
|
||||
public HashSet<ReactionMethod> Methods = default!;
|
||||
|
||||
[DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<ReagentPrototype>))]
|
||||
public HashSet<string>? Reagents = null;
|
||||
|
||||
[DataField("effects", required: true)]
|
||||
public List<ReagentEffect> Effects = default!;
|
||||
}
|
||||
/// <summary>
|
||||
/// Special reactions that this prototype can specify, outside of any that reagents already apply.
|
||||
/// Useful for things like monkey cubes, which have a really prototype-specific effect.
|
||||
/// </summary>
|
||||
[DataField("reactions", true, serverOnly: true)]
|
||||
public List<ReactiveReagentEffectEntry>? Reactions;
|
||||
}
|
||||
|
||||
[DataDefinition]
|
||||
public class ReactiveReagentEffectEntry
|
||||
{
|
||||
[DataField("methods")]
|
||||
public HashSet<ReactionMethod> Methods = default!;
|
||||
|
||||
[DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<ReagentPrototype>))]
|
||||
public HashSet<string>? Reagents = null;
|
||||
|
||||
[DataField("effects", required: true)]
|
||||
public List<ReagentEffect> Effects = default!;
|
||||
[DataField("groups", required: true, readOnly: true, serverOnly: true,
|
||||
customTypeSerializer:typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
|
||||
public Dictionary<string, HashSet<ReactionMethod>> ReactiveGroups { get; } = default!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user