using Content.Shared.CCVar;
namespace Content.Client.Options;
///
/// Allows specifying sprite alternatives depending on the client's accessibility options.
///
///
/// A list of layer mappings is given that the component applies to,
/// and it will pick one entry to apply based on the settings configuration. Example:
///
///
/// - type: Sprite
/// sprite: Effects/optionsvisualizertest.rsi
/// layers:
/// - state: none
/// map: [ "layer" ]
/// - type: OptionsVisualizer
/// visuals:
/// layer:
/// - options: Default
/// data: { state: none }
/// - options: Test
/// data: { state: test }
/// - options: ReducedMotion
/// data: { state: motion }
/// - options: [Test, ReducedMotion]
/// data: { state: both }
///
///
///
///
[RegisterComponent]
public sealed partial class OptionsVisualizerComponent : Component
{
///
/// A mapping storing data about which sprite layer keys should be controlled.
///
///
/// Each layer stores an array of possible options. The last entry with a
/// matching the active user preferences will be picked.
/// This allows choosing a priority if multiple entries are matched.
///
[DataField(required: true)]
public Dictionary Visuals = default!;
///
/// A single option for a layer to be selected.
///
[DataDefinition]
public sealed partial class LayerDatum
{
///
/// Which options must be set by the user to make this datum match.
///
[DataField]
public OptionVisualizerOptions Options { get; set; }
///
/// The sprite layer data to set on the sprite when this datum matches.
///
[DataField]
public PrototypeLayerData Data { get; set; }
}
}
[Flags]
public enum OptionVisualizerOptions
{
///
/// Corresponds to no special options being set, can be used as a "default" state.
///
Default = 0,
///
/// Corresponds to the CVar being set.
///
Test = 1 << 0,
///
/// Corresponds to the CVar being set.
///
ReducedMotion = 1 << 1,
}