Skip to content

Commit

Permalink
Fix Precog results not cached on init
Browse files Browse the repository at this point in the history
  • Loading branch information
ewokswagger committed Dec 23, 2024
1 parent 3204e46 commit f04d5f0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public sealed class PrecognitionPowerSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
CachePrecognitionResults();

SubscribeLocalEvent<PrecognitionPowerComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<PrecognitionPowerComponent, ComponentShutdown>(OnShutdown);
Expand Down Expand Up @@ -161,12 +162,12 @@ private void OnDoAfter(EntityUid uid, PrecognitionPowerComponent component, Prec
/// Gets the precognition result message corosponding to the passed event id.
/// </summary>
/// <returns>message string corosponding to the event id passed</returns>
private LocId GetResultMessage(EntProtoId eventId)
private LocId? GetResultMessage(EntProtoId eventId)
{
if (!Results.TryGetValue(eventId, out var result))
{
Log.Error($"Prototype {eventId} does not have an associated precognitionResult!");
return string.Empty;
return null;
}

return result.Message;
Expand Down

0 comments on commit f04d5f0

Please sign in to comment.