This commit is contained in:
CGFighter
2022-02-26 09:36:18 +03:00
parent 41c1be31e5
commit e89eb45ccc
5 changed files with 19 additions and 4 deletions

View File

Binary file not shown.

View File

@@ -45,7 +45,6 @@ namespace ResearchWhatever.Patches
static void Prefix(Pawn pawn, Thing t, bool forced)
{
ResearchProjectDef currentProj = Find.ResearchManager.currentProj;
if (currentProj != null) return;
Building_ResearchBench bench = t as Building_ResearchBench;
@@ -62,6 +61,7 @@ namespace ResearchWhatever.Patches
&& x.TechprintRequirementMet
&& x.PrerequisitesCompleted
&& (x.requiredResearchBuilding == null || x.requiredResearchBuilding == bench.def && bench.hasFacilities(x.requiredResearchFacilities))
&& x.GetModExtension<ResearchWhateverExtansion>()?.ignore != true
select x);
if (projects.NullOrEmpty())
@@ -70,7 +70,7 @@ namespace ResearchWhatever.Patches
Messages.Message("ResearchWhateverNothingLeftToResearch".Translate(bench.Label).CapitalizeFirst(), new TargetInfo(bench.Position, bench.Map, false), MessageTypeDefOf.NeutralEvent);
return;
}
projects.SortBy(x => x.CostApparent);
projects.SortBy(x => x.GetModExtension<ResearchWhateverExtansion>()?.lowPriority == true ? 100000000f + x.CostApparent : x.CostApparent);
ResearchProjectDef def = projects.First();
projects.TryRandomElementByWeight(x => x.CostApparent == def.CostApparent ? 1f : 0f, out def);

View File

@@ -67,6 +67,7 @@
<Compile Include="ResearchWhatever.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResearchWhateverComp.cs" />
<Compile Include="ResearchWhateverExtansion.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@@ -0,0 +1,10 @@
using Verse;
namespace ResearchWhatever
{
public class ResearchWhateverExtansion : DefModExtension
{
public bool ignore = false;
public bool lowPriority = false;
}
}

View File

@@ -1,4 +1,8 @@
1.0.2
1.0.3
- added an extension to make it possible to ignore some research or prioritize last;
- made so repeatable research from firefoxpdm.ResearchableStatUpgrades us always bottom priority;
1.0.2
- option gets disabled if building is not of player faction;
1.0.1