From 2ec27dde65fc895dc372aece5bfc30dbab740e64 Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:20:09 +0300 Subject: [PATCH] Artifacts no longer gain points on spray, just skip nodes. (#2307) * Cleanup * Consume points when spraying nodes * Artifacts: store skipped points, xenoarch guidebk --------- Co-authored-by: Whatstone --- .../XenoArtifacts/ArtifactComponent.cs | 12 ++++ .../XenoArtifacts/ArtifactSystem.Nodes.cs | 1 + .../XenoArtifacts/ArtifactSystem.cs | 36 +++++++++--- .../Effects/NFActivateArtifact.cs} | 19 ++----- Resources/Prototypes/Guidebook/science.yml | 2 +- Resources/Prototypes/Reagents/chemicals.yml | 6 +- .../_NF/Guidebook/Science/Xenoarchaeology.xml | 55 +++++++++++++++++++ 7 files changed, 105 insertions(+), 26 deletions(-) rename Content.Server/{EntityEffects/Effects/DisintegrateArtifact.cs => _NF/EntityEffects/Effects/NFActivateArtifact.cs} (56%) create mode 100644 Resources/ServerInfo/_NF/Guidebook/Science/Xenoarchaeology.xml diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs index d18684cbc88..e097c9c193f 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs @@ -93,6 +93,18 @@ public sealed partial class ArtifactComponent : Component }; [DataField("activateActionEntity")] public EntityUid? ActivateActionEntity; + + /// + /// Frontier: When set to true, any newly visited nodes contribute no new points. + /// + [ViewVariables(VVAccess.ReadWrite)] + public bool RemoveGainedPoints = false; + + /// + /// Frontier: Points being skipped (e.g. by triggering a node through spraying an artifact). + /// + [ViewVariables(VVAccess.ReadWrite)] + public int SkippedPoints; } /// diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs index a0e8420011f..e92555a2291 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Nodes.cs @@ -227,6 +227,7 @@ private void ExitNode(EntityUid uid, ArtifactComponent? component = null) EntityManager.RemoveComponentDeferred(uid, _componentFactory.GetRegistration(name).Type); } + component.CurrentNodeId = null; } diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs index 9bab3c26640..439c2aeb4ed 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs @@ -14,6 +14,8 @@ using Robust.Shared.Random; using Robust.Shared.Serialization.Manager; using Robust.Shared.Timing; +using Content.Server.Station.Components; // Frontier +using Content.Server.Station.Systems; // Frontier namespace Content.Server.Xenoarchaeology.XenoArtifacts; @@ -27,6 +29,7 @@ public sealed partial class ArtifactSystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly StationSystem _station = default!; // Frontier public override void Initialize() @@ -75,7 +78,7 @@ public int GetResearchPointValue(EntityUid uid, ArtifactComponent? component = n var sumValue = component.NodeTree.Sum(n => GetNodePointValue(n, component, getMaxPrice)); var fullyExploredBonus = component.NodeTree.All(x => x.Triggered) || getMaxPrice ? 1.25f : 1; - return (int) (sumValue * fullyExploredBonus) - component.ConsumedPoints; + return (int) (sumValue * fullyExploredBonus) - component.ConsumedPoints - component.SkippedPoints; // Frontier: subtract SkippedPoints } /// @@ -135,9 +138,12 @@ public void RandomizeArtifact(EntityUid uid, ArtifactComponent component) EnterNode(uid, ref firstNode, component); } - // Frontier: randomly disintegrate an artifact. - public void DisintegrateArtifact(EntityUid uid, float probabilityMin, float probabilityMax, float range) + // Frontier: activate and randomly disintegrate an artifact. + public void NFActivateArtifact(EntityUid uid, float disintegrateProb, float range) { + if (!TryComp(uid, out var artifactComp)) + return; + // Frontier - prevent both artifact activation and disintegration on protected grids (no grimforged in the safezone). var xform = Transform(uid); if (xform.GridUid != null) @@ -146,11 +152,13 @@ public void DisintegrateArtifact(EntityUid uid, float probabilityMin, float prob return; } - // Make a chance between probabilityMin and probabilityMax - var randomChanceForDisintegration = _random.NextFloat(probabilityMin, probabilityMax); - var willDisintegrate = _random.Prob(randomChanceForDisintegration); + // Science should happen on shuttles or stations. + if (_station.GetOwningStation(xform.GridUid) == null) + { + disintegrateProb += 0.15f; + } - if (willDisintegrate) + if (_random.Prob(disintegrateProb)) { var artifactCoord = _transform.GetMapCoordinates(uid); var flashEntity = Spawn("EffectFlashBluespace", artifactCoord); @@ -164,6 +172,14 @@ public void DisintegrateArtifact(EntityUid uid, float probabilityMin, float prob _entityManager.DeleteEntity(uid); } + else + { + // Activate the artifact, but consume any points from newly visited nodes. + bool oldRemove = artifactComp.RemoveGainedPoints; + artifactComp.RemoveGainedPoints = true; + TryActivateArtifact(uid, uid, artifactComp); + artifactComp.RemoveGainedPoints = oldRemove; + } } // End Frontier @@ -225,7 +241,13 @@ public void ForceActivateArtifact(EntityUid uid, EntityUid? user = null, Artifac var currentNode = GetNodeFromId(component.CurrentNodeId.Value, component); + bool untriggered = !currentNode.Triggered; // Frontier: cache triggered value + currentNode.Triggered = true; + // Frontier: remove points from spraying artifacts - must be done after Triggered is set + if (component.RemoveGainedPoints && untriggered) + component.SkippedPoints += (int)GetNodePointValue(currentNode, component); + // End Frontier if (currentNode.Edges.Count == 0) return; diff --git a/Content.Server/EntityEffects/Effects/DisintegrateArtifact.cs b/Content.Server/_NF/EntityEffects/Effects/NFActivateArtifact.cs similarity index 56% rename from Content.Server/EntityEffects/Effects/DisintegrateArtifact.cs rename to Content.Server/_NF/EntityEffects/Effects/NFActivateArtifact.cs index 711c31a96e7..3ff8d868fb2 100644 --- a/Content.Server/EntityEffects/Effects/DisintegrateArtifact.cs +++ b/Content.Server/_NF/EntityEffects/Effects/NFActivateArtifact.cs @@ -1,28 +1,21 @@ -using Content.Server.Xenoarchaeology.XenoArtifacts; +using Content.Server.Xenoarchaeology.XenoArtifacts; using Content.Shared.EntityEffects; using Robust.Shared.Prototypes; namespace Content.Server.Chemistry.EntityEffects; -public sealed partial class DisintegrateArtifact : EntityEffect +public sealed partial class NFActivateArtifact : EntityEffect { - - /// - /// Disintegrate chance - /// - [DataField("probabilityMin"), ViewVariables(VVAccess.ReadWrite)] - public float ProbabilityMax = 0.05f; - /// /// Disintegrate chance /// - [DataField("probabilityMax"), ViewVariables(VVAccess.ReadWrite)] - public float ProbabilityMin = 0.15f; + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float ProbabilityBase = 0.05f; /// /// The range around the artifact that it will spawn the entity /// - [DataField("range")] + [DataField] public float Range = 0.5f; public override void Effect(EntityEffectBaseArgs args) @@ -30,7 +23,7 @@ public override void Effect(EntityEffectBaseArgs args) if (args is not EntityEffectReagentArgs reagentArgs) return; var artifact = args.EntityManager.EntitySysManager.GetEntitySystem(); - artifact.DisintegrateArtifact(reagentArgs.TargetEntity, ProbabilityMin, ProbabilityMax, Range); + artifact.NFActivateArtifact(reagentArgs.TargetEntity, ProbabilityBase, Range); } protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => diff --git a/Resources/Prototypes/Guidebook/science.yml b/Resources/Prototypes/Guidebook/science.yml index f164384ea6b..c1fa698c223 100644 --- a/Resources/Prototypes/Guidebook/science.yml +++ b/Resources/Prototypes/Guidebook/science.yml @@ -36,7 +36,7 @@ - type: guideEntry id: Xenoarchaeology name: guide-entry-xenoarchaeology - text: "/ServerInfo/Guidebook/Science/Xenoarchaeology.xml" + text: "/ServerInfo/_NF/Guidebook/Science/Xenoarchaeology.xml" # Frontier: added _NF folder children: - ArtifactReports diff --git a/Resources/Prototypes/Reagents/chemicals.yml b/Resources/Prototypes/Reagents/chemicals.yml index 61dac648f94..47788c40daa 100644 --- a/Resources/Prototypes/Reagents/chemicals.yml +++ b/Resources/Prototypes/Reagents/chemicals.yml @@ -76,11 +76,7 @@ Acidic: methods: [ Touch ] effects: - - !type:ActivateArtifact - conditions: - - !type:ReagentThreshold - min: 5 - - !type:DisintegrateArtifact + - !type:NFActivateArtifact # Frontier: ActivateArtifact +# Xenoarchaeology +Xenoarchaeology is a field of science focused on researching and experimenting on alien artifacts. + +Artifacts can be found by mining asteroids found around the sector, or you can buy some from miners or salvagers. + +By researching the unique things each artifact can do, you gain Research Points, increase the artifact's sale value, and potentially discover a useful ability or two! + +## Artifact Nodes + + + + +Artifacts consist of a randomly-generated tree of nodes. These nodes have a "[color=#a4885c]depth[/color]", representing how dangerous the node is, and the number of other nodes connected to it, called "[color=#a4885c]edges[/color]", + +Artifacts always start at depth zero, the root of the tree. Travelling the tree to find as many nodes as possible is the main goal of the scientists working on them. Knowledge is extracted from nodes to gain Research Points and increase the artifact's sale value. + +Each node has two components: its [color=#a4885c]stimulus[/color] and a [color=#a4885c]reaction[/color]. + +A stimulus is the external behavior that triggers the reaction. There's a variety of these, and higher depth nodes have more difficult to accomplish stimuli. Some stimuli will need improvisation to trigger, and you may need special materials or resources to get everything you need. + +Some reactions are instantaneous effects while others are permanent changes. Once an artifact is triggered, the reaction causes the artifact to randomly move to another node it is linked to. + +With some experimental science, you can begin to grasp how the different nodes of an artifact are connected, and how to move between them by repeatedly activating nodes. + +All non-zero-depth nodes will have exactly one edge that leads up to its parent node. All other edges a node has lead down to the next depth. + +## Artifact Analyzer and Analysis Console + + + + +The main equipment that you'll be using for Xenoarchaeology is the [color=#a4885c]artifact analyzer[/color] and the [color=#a4885c]analysis console[/color]. You can use these to create reports that contain valuable information about an artifact. + +To set them up, simply link them with a network configurator and set an artifact on top of the analyzer. Every science vessel has at least one of these machines already set up. + +Use the console's [color=#a4885c]scan[/color] button to discover what stimulus the artifact needs and what its reaction will do. Scanning takes thirty seconds. + +Use the [color=#a4885c]print[/color] button to save the scan result, so you can refer to it later. + +Once you've discovered a new node, you can extract points from the artifact using the [color=#a4885c]Extract[/color] button. + +## Artifexium and You + +With difficult to trigger stimuli, one risky alternative is the use of [color=#a4885c]artifexium[/color]. In order to get artifexium, artifact fragments can be [color=#a4885c]ground[/color] in a [color=#a4885c]reagent grinder[/color]. This artifexium can then be [color=#a4885c]sprayed[/color] or [color=#a4885c]splashed[/color] on an artifact to cause a trigger. + +It is worth note that artifexium can cause unwanted reactions and reduced yield when interacting with alien artifacts. Use it sparingly, and it can be a useful tool. + +For reasons yet understood by science, use of artifexium is more stable when performed in laboratories than on rocks in the void. Our xenoarchaeologists suggest that these artifacts may exhibit sentient properties and be more stable in social settings. + +## Assembling Artifacts + + +It is possible to gather multiple artifact fragments and assemble them into a working artifact. You can ask for these from mining ships, who usually find these while mining asteroids or on Expeditions. +