XenoArch [Science Overhaul] (#12204)

* multi-node xeno artifacts

* refactor existing artifact effects

* more tweaks to generation

* more shit plus fix tests

* more generation stuff plus threat levels

* doink

* now make it build

* defer the artifact activation to not cause errors

also pricing

* some changes

* all of the yaml + ui stuff for artifact analyzer

* machine linking and starting to make the ui functional

* artifact analyzer display

* a shit ton of artifact analyzer stuff

* more changes; making destroy work properly; progress bar tweaks

* getting shit going!

ALL RIGHT

* small tweaks that didn't help much

* Komm susser todd: the end of analysis

* recipes and hints and ui, oh my!

* add some in-game sources

gotta prepare for day 1 launch

* node data + ditch random seed in place of id

* bunch of triggers

* finish off the last few triggers

* implement machine examine verb

* knock, flicker, blink, throw

* shatter, foam, shuffle, heat

* fix all the shit i broke

* *some* of these have to be good, no?

25 effects

* callin' it there for effects

* comments + reword some trigger hints

* don't mind this little commit here

* byref event

* fix brokey node entry

* fix low pressure trigger

* mirror review plus fixing 0x40's bug

also the throw artifact threw incorrectly

* randomize the event message a teeny bit
This commit is contained in:
Nemanja
2022-11-06 18:05:44 -05:00
committed by GitHub
parent 0d4a605a94
commit 273e0968e4
107 changed files with 3321 additions and 358 deletions

View File

@@ -1,39 +1,143 @@
using Content.Shared.Xenoarchaeology.XenoArtifacts;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Server.Xenoarchaeology.XenoArtifacts;
[RegisterComponent]
public sealed class ArtifactComponent : Component
{
/// <summary>
/// Should artifact pick a random trigger on startup?
/// The artifact's node tree.
/// </summary>
[DataField("randomTrigger")]
public bool RandomTrigger = true;
[ViewVariables]
public ArtifactTree? NodeTree;
/// <summary>
/// List of all possible triggers activations.
/// Should be same as components names.
/// The current node the artifact is on.
/// </summary>
[DataField("possibleTriggers")]
public string[] PossibleTriggers = {
"ArtifactInteractionTrigger",
"ArtifactGasTrigger",
"ArtifactHeatTrigger",
"ArtifactElectricityTrigger",
};
[ViewVariables]
public ArtifactNode? CurrentNode;
#region Node Tree Gen
/// <summary>
/// Minimum number of nodes to generate, inclusive
/// </summary>
[DataField("nodesMin")]
public int NodesMin = 3;
/// <summary>
/// Cooldown time between artifact activations (in seconds).
/// Maximum number of nodes to generate, exclusive
/// </summary>
[DataField("timer")]
[DataField("nodesMax")]
public int NodesMax = 9;
#endregion
/// <summary>
/// Cooldown time between artifact activations (in seconds).
/// </summary>
[DataField("timer", customTypeSerializer: typeof(TimespanSerializer))]
[ViewVariables(VVAccess.ReadWrite)]
public double CooldownTime = 10;
public TimeSpan CooldownTime = TimeSpan.FromSeconds(5);
/// <summary>
/// Is this artifact under some suppression device?
/// If true, will ignore all trigger activations attempts.
/// Is this artifact under some suppression device?
/// f true, will ignore all trigger activations attempts.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool IsSuppressed;
/// <summary>
/// The last time the artifact was activated.
/// </summary>
[DataField("lastActivationTime", customTypeSerializer: typeof(TimespanSerializer))]
public TimeSpan LastActivationTime;
}
/// <summary>
/// A tree of nodes.
/// </summary>
[DataDefinition]
public sealed class ArtifactTree
{
/// <summary>
/// The first node of the tree
/// </summary>
[ViewVariables]
public ArtifactNode StartNode = default!;
/// <summary>
/// Every node contained in the tree
/// </summary>
[ViewVariables]
public readonly List<ArtifactNode> AllNodes = new();
}
/// <summary>
/// A single "node" of an artifact that contains various data about it.
/// </summary>
[DataDefinition]
public sealed class ArtifactNode : ICloneable
{
/// <summary>
/// A numeric id corresponding to each node. used for display purposes
/// </summary>
[ViewVariables]
public int Id;
/// <summary>
/// how "deep" into the node tree. used for generation and price/value calculations
/// </summary>
[ViewVariables]
public int Depth = 0;
/// <summary>
/// A list of surrounding nodes. Used for tree traversal
/// </summary>
[ViewVariables]
public List<ArtifactNode> Edges = new();
/// <summary>
/// Whether or not the node has been entered
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool Discovered = false;
/// <summary>
/// The trigger for the node
/// </summary>
[ViewVariables]
public ArtifactTriggerPrototype Trigger = default!;
/// <summary>
/// Whether or not the node has been triggered
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool Triggered = false;
/// <summary>
/// The effect when the node is activated
/// </summary>
[ViewVariables]
public ArtifactEffectPrototype Effect = default!;
/// <summary>
/// Used for storing cumulative information about nodes
/// </summary>
[ViewVariables]
public Dictionary<string, object> NodeData = new();
public object Clone()
{
return new ArtifactNode
{
Id = Id,
Depth = Depth,
Edges = Edges,
Discovered = Discovered,
Trigger = Trigger,
Triggered = Triggered,
Effect = Effect,
NodeData = NodeData
};
}
}