Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Artifacts no longer gain points on spray, just skip nodes. (new-front…
Browse files Browse the repository at this point in the history
…iers-14#2307)

* Cleanup

* Consume points when spraying nodes

* Artifacts: store skipped points, xenoarch guidebk

---------

Co-authored-by: Whatstone <[email protected]>
  • Loading branch information
dvir001 and whatston3 authored Oct 23, 2024
1 parent 1591b35 commit 2ec27dd
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 26 deletions.
12 changes: 12 additions & 0 deletions Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ public sealed partial class ArtifactComponent : Component
};

[DataField("activateActionEntity")] public EntityUid? ActivateActionEntity;

/// <summary>
/// Frontier: When set to true, any newly visited nodes contribute no new points.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool RemoveGainedPoints = false;

/// <summary>
/// Frontier: Points being skipped (e.g. by triggering a node through spraying an artifact).
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public int SkippedPoints;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ private void ExitNode(EntityUid uid, ArtifactComponent? component = null)

EntityManager.RemoveComponentDeferred(uid, _componentFactory.GetRegistration(name).Type);
}

component.CurrentNodeId = null;
}

Expand Down
36 changes: 29 additions & 7 deletions Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()
Expand Down Expand Up @@ -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
}

/// <summary>
Expand Down Expand Up @@ -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<ArtifactComponent>(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)
Expand All @@ -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);
Expand All @@ -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

Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
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
{

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMin"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMax = 0.05f;

/// <summary>
/// Disintegrate chance
/// </summary>
[DataField("probabilityMax"), ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityMin = 0.15f;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ProbabilityBase = 0.05f;

/// <summary>
/// The range around the artifact that it will spawn the entity
/// </summary>
[DataField("range")]
[DataField]
public float Range = 0.5f;

public override void Effect(EntityEffectBaseArgs args)
{
if (args is not EntityEffectReagentArgs reagentArgs)
return;
var artifact = args.EntityManager.EntitySysManager.GetEntitySystem<ArtifactSystem>();
artifact.DisintegrateArtifact(reagentArgs.TargetEntity, ProbabilityMin, ProbabilityMax, Range);
artifact.NFActivateArtifact(reagentArgs.TargetEntity, ProbabilityBase, Range);
}

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Guidebook/science.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions Resources/Prototypes/Reagents/chemicals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@
Acidic:
methods: [ Touch ]
effects:
- !type:ActivateArtifact
conditions:
- !type:ReagentThreshold
min: 5
- !type:DisintegrateArtifact
- !type:NFActivateArtifact # Frontier: ActivateArtifact<NFActivateArtifact
conditions:
- !type:ReagentThreshold
min: 5
Expand Down
55 changes: 55 additions & 0 deletions Resources/ServerInfo/_NF/Guidebook/Science/Xenoarchaeology.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Document>
# 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
<Box>
<GuideEntityEmbed Entity="ComplexXenoArtifact" Caption=""/>
<GuideEntityEmbed Entity="SimpleXenoArtifactItem" Caption=""/>
</Box>
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
<Box>
<GuideEntityEmbed Entity="MachineArtifactAnalyzer"/>
<GuideEntityEmbed Entity="ComputerAnalysisConsole"/>
</Box>
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
<GuideEntityEmbed Entity="ArtifactFragment" Caption="Artifact Fragment"/>

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.
</Document>

0 comments on commit 2ec27dd

Please sign in to comment.