This commit is contained in:
p.tychinin
2024-05-10 18:42:25 +03:00
parent c24c8a69ab
commit e41d864042
3 changed files with 20 additions and 15 deletions

View File

Binary file not shown.

View File

@@ -15,7 +15,7 @@ namespace ResearchWhatever.Patches
[HarmonyPatch(typeof(StudyManager), "StudyAnomaly")]
static class StudyManager_StudyAnomaly_ResearchWhateverPatch
{
private static readonly PropertyInfo LStudyCompleted = AccessTools.Property(typeof(ITab_StudyNotes), "StudyCompleted");
//private static readonly PropertyInfo LStudyCompleted = AccessTools.Property(typeof(ITab_StudyNotes), "StudyCompleted");
internal static void Prefix(Thing studiedThing, Pawn studier, float knowledgeAmount, KnowledgeCategoryDef knowledgeCategory)
{
if (!ModsConfig.AnomalyActive)
@@ -47,24 +47,26 @@ namespace ResearchWhatever.Patches
{
CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
CompHoldingPlatformTarget compHoldingPlatformTarget = studiedThing.TryGetComp<CompHoldingPlatformTarget>();
bool b = false;
if (compStudiable != null)
if (compStudiable.Completed)
{
compStudiable.studyEnabled = false;
b = true;
}
else
{
if (studiedThing.GetInspectTabs().FirstOrDefault(
x => x is ITab_StudyNotes
|| x.GetType().IsSubclassOf(typeof(ITab_StudyNotes))) is ITab_StudyNotes tab
&& (bool)LStudyCompleted.GetValue(tab))
if (compStudiable.Props.Completable)
if (compStudiable.Completed)
{
compStudiable.studyEnabled = false;
b = true;
}
else { }
else
{
var compStudyUnlocks = studiedThing.TryGetComp<CompStudyUnlocks>();
if (compStudyUnlocks != null)
{
if (compStudyUnlocks.Completed)
{
compStudiable.studyEnabled = false;
b = true;
}
}
}
//
if (compHoldingPlatformTarget != null)

View File

@@ -1,4 +1,7 @@
1.1.4
1.1.5
- fixed studiable objects would toggle off even if there is still something to study in their specific journal;
1.1.4
- studiable objects now also auto-toggle off;
1.1.3