using Content.Shared.Xenoarchaeology.XenoArtifacts; using Robust.Shared.Audio; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Xenoarchaeology.XenoArtifacts; [RegisterComponent, Access(typeof(ArtifactSystem))] public sealed partial class ArtifactComponent : Component { /// /// Every node contained in the tree /// [DataField("nodeTree"), ViewVariables] public List NodeTree = new(); /// /// The current node the artifact is on. /// [DataField("currentNodeId"), ViewVariables] public int? CurrentNodeId; #region Node Tree Gen /// /// Minimum number of nodes to generate, inclusive /// [DataField("nodesMin")] public int NodesMin = 3; /// /// Maximum number of nodes to generate, exclusive /// [DataField("nodesMax")] public int NodesMax = 9; #endregion /// /// Cooldown time between artifact activations (in seconds). /// [DataField("timer"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan CooldownTime = TimeSpan.FromSeconds(5); /// /// Is this artifact under some suppression device? /// f true, will ignore all trigger activations attempts. /// [DataField("isSuppressed"), ViewVariables(VVAccess.ReadWrite)] public bool IsSuppressed; /// /// The last time the artifact was activated. /// [DataField("lastActivationTime", customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan LastActivationTime; /// /// A multiplier applied to the calculated point value /// to determine the monetary value of the artifact /// [DataField("priceMultiplier"), ViewVariables(VVAccess.ReadWrite)] public float PriceMultiplier = 0.05f; /// /// The base amount of research points for each artifact node. /// [DataField("pointsPerNode"), ViewVariables(VVAccess.ReadWrite)] public int PointsPerNode = 6500; /// /// Research points which have been "consumed" from the theoretical max value of the artifact. /// [DataField("consumedPoints"), ViewVariables(VVAccess.ReadWrite)] public int ConsumedPoints; /// /// A multiplier that is raised to the power of the average depth of a node. /// Used for calculating the research point value of an artifact node. /// [DataField("pointDangerMultiplier"), ViewVariables(VVAccess.ReadWrite)] public float PointDangerMultiplier = 1.35f; /// /// The sound that plays when an artifact is activated /// [DataField("activationSound")] public SoundSpecifier ActivationSound = new SoundCollectionSpecifier("ArtifactActivation") { Params = new() { Variation = 0.1f, Volume = 3f } }; [DataField("activateActionEntity")] public EntityUid? ActivateActionEntity; } /// /// A single "node" of an artifact that contains various data about it. /// [DataDefinition] public sealed partial class ArtifactNode : ICloneable { /// /// A numeric id corresponding to each node. /// [DataField("id"), ViewVariables] public int Id; /// /// how "deep" into the node tree. used for generation and price/value calculations /// [DataField("depth"), ViewVariables] public int Depth; /// /// A list of surrounding nodes. Used for tree traversal /// [DataField("edges"), ViewVariables] public HashSet Edges = new(); /// /// Whether or not the node has been entered /// [DataField("discovered"), ViewVariables(VVAccess.ReadWrite)] public bool Discovered; /// /// The trigger for the node /// [DataField("trigger", customTypeSerializer: typeof(PrototypeIdSerializer), required: true), ViewVariables] public string Trigger = default!; /// /// Whether or not the node has been triggered /// [DataField("triggered"), ViewVariables(VVAccess.ReadWrite)] public bool Triggered; /// /// The effect when the node is activated /// [DataField("effect", customTypeSerializer: typeof(PrototypeIdSerializer), required: true), ViewVariables] public string Effect = default!; /// /// Used for storing cumulative information about nodes /// [DataField("nodeData"), ViewVariables] public Dictionary NodeData = new(); public object Clone() { return new ArtifactNode { Id = Id, Depth = Depth, Edges = Edges, Discovered = Discovered, Trigger = Trigger, Triggered = Triggered, Effect = Effect, NodeData = NodeData }; } }