36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Content.Shared.Cargo;
|
|
using Content.Shared.Xenoarchaeology.Artifact;
|
|
using Content.Shared.Xenoarchaeology.Artifact.Components;
|
|
|
|
namespace Content.Server.Xenoarchaeology.Artifact;
|
|
|
|
/// <inheritdoc cref="SharedXenoArtifactSystem"/>
|
|
public sealed partial class XenoArtifactSystem : SharedXenoArtifactSystem
|
|
{
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<XenoArtifactComponent, MapInitEvent>(OnArtifactMapInit);
|
|
SubscribeLocalEvent<XenoArtifactComponent, PriceCalculationEvent>(OnCalculatePrice);
|
|
}
|
|
|
|
private void OnArtifactMapInit(Entity<XenoArtifactComponent> ent, ref MapInitEvent args)
|
|
{
|
|
if (ent.Comp.IsGenerationRequired)
|
|
GenerateArtifactStructure(ent);
|
|
}
|
|
|
|
private void OnCalculatePrice(Entity<XenoArtifactComponent> ent, ref PriceCalculationEvent args)
|
|
{
|
|
foreach (var node in GetAllNodes(ent))
|
|
{
|
|
if (node.Comp.Locked)
|
|
continue;
|
|
|
|
args.Price += node.Comp.ResearchValue * ent.Comp.PriceMultiplier;
|
|
}
|
|
}
|
|
}
|