artifacts no longer rigged (#15283)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-04-10 22:35:42 +00:00
committed by GitHub
parent fe01cfc01b
commit 7c8f4054f3

View File

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