mirror of
https://github.com/Xevion/RimWorld_ResearchWhatever.git
synced 2025-12-06 03:16:19 -06:00
1.1.3
This commit is contained in:
Binary file not shown.
BIN
About/ModIcon.png
Normal file
BIN
About/ModIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -37,19 +37,36 @@ namespace ResearchWhatever.Patches
|
|||||||
if (proj != null)
|
if (proj != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
proj = DefDatabase<ResearchProjectDef>.AllDefsListForReading.FirstOrDefault((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory);
|
var projs = DefDatabase<ResearchProjectDef>.AllDefsListForReading.Where((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory).ToList();
|
||||||
if (proj == null && knowledgeCategory.overflowCategory != null)
|
if (projs.NullOrEmpty() && knowledgeCategory.overflowCategory != null)
|
||||||
proj = DefDatabase<ResearchProjectDef>.AllDefsListForReading.FirstOrDefault((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory.overflowCategory);
|
projs = DefDatabase<ResearchProjectDef>.AllDefsListForReading.Where((ResearchProjectDef x) => x.CanStartNow && x.knowledgeCategory == knowledgeCategory.overflowCategory).ToList();
|
||||||
|
|
||||||
if (proj == null)
|
if (projs.NullOrEmpty())
|
||||||
{
|
{
|
||||||
//CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
|
CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
|
||||||
//if (compStudiable == null)
|
CompHoldingPlatformTarget compHoldingPlatformTarget = studiedThing.TryGetComp<CompHoldingPlatformTarget>();
|
||||||
// return;
|
|
||||||
|
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;
|
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);
|
SoundDefOf.ResearchStart.PlayOneShotOnCamera(null);
|
||||||
researchManager.SetCurrentProject(proj);
|
researchManager.SetCurrentProject(proj);
|
||||||
Thing thing = studiedThing;
|
Thing thing = studiedThing;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace ResearchWhatever.Patches
|
|||||||
Messages.Message("ResearchWhateverNothingLeftToResearch".Translate(bench.Label).CapitalizeFirst(), new TargetInfo(bench.Position, bench.Map, false), MessageTypeDefOf.NeutralEvent);
|
Messages.Message("ResearchWhateverNothingLeftToResearch".Translate(bench.Label).CapitalizeFirst(), new TargetInfo(bench.Position, bench.Map, false), MessageTypeDefOf.NeutralEvent);
|
||||||
return;
|
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();
|
ResearchProjectDef def = projects.First();
|
||||||
projects.TryRandomElementByWeight(x => x.CostApparent == def.CostApparent ? 1f : 0f, out def);
|
projects.TryRandomElementByWeight(x => x.CostApparent == def.CostApparent ? 1f : 0f, out def);
|
||||||
|
|||||||
@@ -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;
|
- added sound notification when new anomaly project picked;
|
||||||
|
|
||||||
1.1.1
|
1.1.1
|
||||||
|
|||||||
Reference in New Issue
Block a user