using System.Numerics;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Prototypes;
using Content.Shared.Tag;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared.Nutrition.Components;
///
/// A starting point for the creation of procedural food.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(SharedFoodSequenceSystem))]
public sealed partial class FoodSequenceStartPointComponent : Component
{
///
/// A key that determines which types of food elements can be attached to a food.
///
[DataField(required: true)]
public ProtoId Key = string.Empty;
///
/// The maximum number of layers of food that can be placed on this item.
///
[DataField]
public int MaxLayers = 10;
///
/// Can we put more layers?
///
[DataField]
public bool Finished;
///
/// solution where reagents will be added from newly added ingredients
///
[DataField]
public string Solution = "food";
#region name generation
///
/// LocId with a name generation pattern.
///
[DataField]
public LocId? NameGeneration;
///
/// the part of the name generation used in the pattern
///
[DataField]
public LocId? NamePrefix;
///
/// content in the form of all added ingredients will be separated by these symbols
///
[DataField]
public string? ContentSeparator;
///
/// the part of the name generation used in the pattern
///
[DataField]
public LocId? NameSuffix;
#endregion
#region visual
///
/// list of sprite states to be displayed on this object.
///
[DataField, AutoNetworkedField]
public List FoodLayers = new();
///
/// If true, the generative layers will be placed in reverse order.
///
[DataField]
public bool InverseLayers;
///
/// target layer, where new layers will be added. This allows you to control the order of generative layers and static layers.
///
[DataField]
public string TargetLayerMap = "foodSequenceLayers";
///
/// Start shift from the center of the sprite where the first layer of food will be placed.
///
[DataField]
public Vector2 StartPosition = Vector2.Zero;
///
/// Shift from the start position applied to each subsequent layer.
///
[DataField]
public Vector2 Offset = Vector2.Zero;
///
/// each layer will get a random offset in the specified range
///
[DataField]
public Vector2 MaxLayerOffset = Vector2.Zero;
///
/// each layer will get a random offset in the specified range
///
[DataField]
public Vector2 MinLayerOffset = Vector2.Zero;
[DataField]
public bool AllowHorizontalFlip = true;
public HashSet RevealedLayers = new();
#endregion
}
///
/// class that synchronizes with the client
/// Stores all the necessary information for rendering the FoodSequence element
///
[DataRecord, Serializable, NetSerializable]
public partial record struct FoodSequenceVisualLayer
{
///
/// reference to the original prototype of the layer. Used to edit visual layers.
///
public ProtoId Proto;
///
/// Sprite rendered in sequence
///
public SpriteSpecifier? Sprite { get; set; } = SpriteSpecifier.Invalid;
///
/// Relative size of the sprite displayed in FoodSequence
///
public Vector2 Scale { get; set; } = Vector2.One;
///
/// The offset of a particular layer. Allows a little position randomization of each layer.
///
public Vector2 LocalOffset { get; set; } = Vector2.Zero;
public FoodSequenceVisualLayer(ProtoId proto,
SpriteSpecifier? sprite,
Vector2 scale,
Vector2 offset)
{
Proto = proto;
Sprite = sprite;
Scale = scale;
LocalOffset = offset;
}
}