This commit is contained in:
p.tychinin
2024-05-07 04:03:56 +03:00
parent 323b82bdc4
commit fe0957365d
5 changed files with 33 additions and 11 deletions

View File

Binary file not shown.

BIN
About/ModIcon.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -37,19 +37,36 @@ namespace ResearchWhatever.Patches
if (proj != null)
return;
proj = DefDatabase<ResearchProjectDef>.AllDefsListForReading.FirstOrDefault((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory);
if (proj == null && knowledgeCategory.overflowCategory != null)
proj = DefDatabase<ResearchProjectDef>.AllDefsListForReading.FirstOrDefault((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory.overflowCategory);
if (proj == null)
var projs = DefDatabase<ResearchProjectDef>.AllDefsListForReading.Where((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory).ToList();
if (projs.NullOrEmpty() && knowledgeCategory.overflowCategory != null)
projs = DefDatabase<ResearchProjectDef>.AllDefsListForReading.Where((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory.overflowCategory).ToList();
if (projs.NullOrEmpty())
{
//CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
//if (compStudiable == null)
// return;
CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
CompHoldingPlatformTarget compHoldingPlatformTarget = studiedThing.TryGetComp<CompHoldingPlatformTarget>();
bool b = false;
if (compStudiable != null && compStudiable.Completed)
{
compStudiable.studyEnabled = false;
b = true;
}
//
//if (compStudiable.Completed) ;
if (compHoldingPlatformTarget != null)
{
compHoldingPlatformTarget.containmentMode = EntityContainmentMode.MaintainOnly;
b = b || compStudiable != null;
}
if (b) Messages.Message("ResearchWhateverNothingLeftToResearch".Translate(studiedThing.Label).CapitalizeFirst(), new TargetInfo(studiedThing.PositionHeld, studiedThing.MapHeld, false), MessageTypeDefOf.NeutralEvent);
return;
}
projs.SortBy(x => x.CostApparent - x.ProgressApparent);
proj = projs.First();
projs.TryRandomElementByWeight(x => x.CostApparent == proj.CostApparent ? 1f : 0f, out proj);
SoundDefOf.ResearchStart.PlayOneShotOnCamera(null);
researchManager.SetCurrentProject(proj);
Thing thing = studiedThing;

View File

@@ -73,7 +73,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.GetModExtension<ResearchWhateverExtansion>()?.lowPriority == true ? 100000000f + x.CostApparent : x.CostApparent);
projects.SortBy(x => x.GetModExtension<ResearchWhateverExtansion>()?.lowPriority == true ? 100000000f + x.CostApparent - x.ProgressApparent : x.CostApparent - x.ProgressApparent);
ResearchProjectDef def = projects.First();
projects.TryRandomElementByWeight(x => x.CostApparent == def.CostApparent ? 1f : 0f, out def);

View File

@@ -1,4 +1,9 @@
1.1.2
1.1.3
- mod now automatically picks CHEAPEST anomaly research;
- if anomly is fully studied and nothing left to research, study will be automatically toggled off;
- cheapest project now takes into account already made progress;
1.1.2
- added sound notification when new anomaly project picked;
1.1.1