]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
artifacts no longer rigged (#15283)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Mon, 10 Apr 2023 22:35:42 +0000 (22:35 +0000)
committerGitHub <noreply@github.com>
Mon, 10 Apr 2023 22:35:42 +0000 (15:35 -0700)
Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.cs

index d11f83507992ef1e3a7e9ec1111a243df6ef72da..039cc3423c8dfc0e6c5b68920b1ba365ff424cbc 100644 (file)
@@ -18,10 +18,14 @@ public sealed partial class ArtifactSystem : EntitySystem
     [Dependency] private readonly IGameTiming _gameTiming = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
 
+    private ISawmill _sawmill = default!;
+
     public override void Initialize()
     {
         base.Initialize();
 
+        _sawmill = Logger.GetSawmill("artifact");
+
         SubscribeLocalEvent<ArtifactComponent, MapInitEvent>(OnInit);
         SubscribeLocalEvent<ArtifactComponent, PriceCalculationEvent>(GetPrice);
         SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
@@ -73,7 +77,7 @@ public sealed partial class ArtifactSystem : EntitySystem
     }
 
     /// <summary>
-    /// Calculates how many research points the artifact is worht
+    /// Calculates how many research points the artifact is worth
     /// </summary>
     /// <remarks>
     /// General balancing (for fully unlocked artifacts):
@@ -197,12 +201,8 @@ public sealed partial class ArtifactSystem : EntitySystem
         var currentNode = GetNodeFromId(component.CurrentNodeId.Value, component);
 
         var allNodes = currentNode.Edges;
-        Logger.Debug($"our node: {currentNode.Id}");
-        Logger.Debug("other nodes:");
-        foreach (var other in allNodes)
-        {
-            Logger.Debug($"{other}");
-        }
+        _sawmill.Debug("artifact", $"our node: {currentNode.Id}");
+        _sawmill.Debug("artifact", $"other nodes: {string.Join(", ", allNodes)}");
 
         if (TryComp<BiasedArtifactComponent>(uid, out var bias) &&
             TryComp<TraversalDistorterComponent>(bias.Provider, out var trav) &&
@@ -224,13 +224,15 @@ public sealed partial class ArtifactSystem : EntitySystem
             }
         }
 
-        var undiscoveredNodes = allNodes.Where(x => GetNodeFromId(x, component).Discovered).ToList();
+        var undiscoveredNodes = allNodes.Where(x => !GetNodeFromId(x, component).Discovered).ToList();
+        _sawmill.Debug("artifact", $"Undiscovered nodes: {string.Join(", ", undiscoveredNodes)}");
         var newNode = _random.Pick(allNodes);
         if (undiscoveredNodes.Any() && _random.Prob(0.75f))
         {
             newNode = _random.Pick(undiscoveredNodes);
         }
 
+        _sawmill.Debug("artifact", $"Going to node {newNode}");
         return GetNodeFromId(newNode, component);
     }