Skip to content

Commit

Permalink
fix: check for availability properly
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteTimesSix committed Apr 27, 2023
1 parent 38d5d29 commit cd9b167
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static void BuildCache()
if (Find.ResearchManager.currentProj == null)
return;

foreach (var opportunity in MatchingOpportunities.Where(o => !o.IsFinished && o.requirement is ROComp_RequiresThing))
foreach (var opportunity in MatchingOpportunities.Where(o => o.CurrentAvailability == OpportunityAvailability.Available && o.requirement is ROComp_RequiresThing))
{
var thingDef = (opportunity.requirement as ROComp_RequiresThing)?.thingDef;
if (thingDef == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static void BuildCache()
if (Find.ResearchManager.currentProj == null)
return;

foreach (var opportunity in MatchingOpportunities.Where(o => !o.IsFinished && o.requirement is ROComp_RequiresThing))
foreach (var opportunity in MatchingOpportunities.Where(o => o.CurrentAvailability == OpportunityAvailability.Available && o.requirement is ROComp_RequiresThing))
{
var thingDef = (opportunity.requirement as ROComp_RequiresThing)?.thingDef;
if (thingDef == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static void BuildCache()
if (Find.ResearchManager.currentProj == null)
return;

foreach (var opportunity in MatchingOpportunities.Where(o => !o.IsFinished && o.requirement is ROComp_RequiresTerrain))
foreach (var opportunity in MatchingOpportunities.Where(o => o.CurrentAvailability == OpportunityAvailability.Available && o.requirement is ROComp_RequiresTerrain))
{
var terrainDef = (opportunity.requirement as ROComp_RequiresTerrain)?.terrainDef;
if (terrainDef == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static ResearchOpportunity OpportunityCache
{
if (cacheBuiltOnTick != Find.TickManager.TicksAbs)
{
_opportunityCache = MatchingOpportunities.FirstOrDefault();
_opportunityCache = MatchingOpportunities.Where(o => o.CurrentAvailability == OpportunityAvailability.Available).FirstOrDefault();
}
return _opportunityCache;
}
Expand Down
Binary file modified ResearchReinvented/v1.4/Assemblies/ResearchReinvented.dll
Binary file not shown.

0 comments on commit cd9b167

Please sign in to comment.