mirror of
https://github.com/Xevion/RimWorld_ResearchWhatever.git
synced 2025-12-16 10:13:08 -06:00
1.1.2
This commit is contained in:
Binary file not shown.
@@ -8,9 +8,9 @@ using Verse.Sound;
|
|||||||
namespace ResearchWhatever.Patches
|
namespace ResearchWhatever.Patches
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(ResearchManager), "FinishProject")]
|
[HarmonyPatch(typeof(ResearchManager), "FinishProject")]
|
||||||
public static class ResearchManager_FinishProject_ResearchWhateverPatch
|
static class ResearchManager_FinishProject_ResearchWhateverPatch
|
||||||
{
|
{
|
||||||
public static void Prefix(ResearchManager __instance, ref bool doCompletionDialog)
|
internal static void Prefix(ResearchProjectDef proj, ref bool doCompletionDialog)
|
||||||
{
|
{
|
||||||
if (doCompletionDialog)
|
if (doCompletionDialog)
|
||||||
{
|
{
|
||||||
@@ -20,14 +20,14 @@ namespace ResearchWhatever.Patches
|
|||||||
|
|
||||||
doCompletionDialog = false;
|
doCompletionDialog = false;
|
||||||
|
|
||||||
var currentProj = __instance.GetProject();
|
//var currentProj = __instance.GetProject();
|
||||||
switch (comp.NotifyMode)
|
switch (comp.NotifyMode)
|
||||||
{
|
{
|
||||||
case ResearchWhateverNotifyMode.rwnLetter:
|
case ResearchWhateverNotifyMode.rwnLetter:
|
||||||
Find.LetterStack.ReceiveLetter("ResearchFinished".Translate(currentProj.LabelCap), currentProj.description, LetterDefOf.PositiveEvent, null, null, null, null, null);
|
Find.LetterStack.ReceiveLetter("ResearchFinished".Translate(proj.LabelCap), proj.description, LetterDefOf.PositiveEvent, null, null, null, null, null);
|
||||||
break;
|
break;
|
||||||
case ResearchWhateverNotifyMode.rwnNotice:
|
case ResearchWhateverNotifyMode.rwnNotice:
|
||||||
Messages.Message("ResearchFinished".Translate(currentProj.LabelCap).CapitalizeFirst(), MessageTypeDefOf.SilentInput);
|
Messages.Message("ResearchFinished".Translate(proj.LabelCap).CapitalizeFirst(), MessageTypeDefOf.SilentInput);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
61
Source/ResearchWhatever15/Patches/StudyManagerPatch.cs
Normal file
61
Source/ResearchWhatever15/Patches/StudyManagerPatch.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using RimWorld;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Verse;
|
||||||
|
using Verse.Sound;
|
||||||
|
|
||||||
|
namespace ResearchWhatever.Patches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(StudyManager), "StudyAnomaly")]
|
||||||
|
static class StudyManager_StudyAnomaly_ResearchWhateverPatch
|
||||||
|
{
|
||||||
|
internal static void Prefix(Thing studiedThing, Pawn studier, float knowledgeAmount, KnowledgeCategoryDef knowledgeCategory)
|
||||||
|
{
|
||||||
|
if (!ModsConfig.AnomalyActive)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (knowledgeAmount <= 0f)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
var researchManager = Find.ResearchManager;
|
||||||
|
var proj = researchManager.GetProject(knowledgeCategory);
|
||||||
|
|
||||||
|
if (proj != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (knowledgeCategory.overflowCategory != null)
|
||||||
|
proj = researchManager.GetProject(knowledgeCategory.overflowCategory);
|
||||||
|
//
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
//CompStudiable compStudiable = studiedThing.TryGetComp<CompStudiable>();
|
||||||
|
//if (compStudiable == null)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
//if (compStudiable.Completed) ;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SoundDefOf.ResearchStart.PlayOneShotOnCamera(null);
|
||||||
|
researchManager.SetCurrentProject(proj);
|
||||||
|
Thing thing = studiedThing;
|
||||||
|
if (thing.Map == null) thing = thing.ParentHolder as Thing;
|
||||||
|
TutorSystem.Notify_Event("StartResearchProject");
|
||||||
|
Messages.Message("ResearchWhateverNewResearch".Translate(studier.Name.ToStringFull, proj.label).CapitalizeFirst(), new TargetInfo(thing.Position, thing.Map, false), MessageTypeDefOf.SilentInput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Patches\ResearchManagerPatch.cs" />
|
<Compile Include="Patches\ResearchManagerPatch.cs" />
|
||||||
<Compile Include="Patches\StaticConstructorOnStartupUtilityPatch.cs" />
|
<Compile Include="Patches\StaticConstructorOnStartupUtilityPatch.cs" />
|
||||||
|
<Compile Include="Patches\StudyManagerPatch.cs" />
|
||||||
<Compile Include="Patches\WorkGiver_ResearcherPatch.cs" />
|
<Compile Include="Patches\WorkGiver_ResearcherPatch.cs" />
|
||||||
<Compile Include="ResearchWhatever.cs" />
|
<Compile Include="ResearchWhatever.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
11
change.log
11
change.log
@@ -1,11 +1,18 @@
|
|||||||
1.1.0
|
1.1.2
|
||||||
|
- added sound notification when new anomaly project picked;
|
||||||
|
|
||||||
|
1.1.1
|
||||||
|
- fixed notification messages for anomaly projects showing that "current normal project" is finished;
|
||||||
|
- anomaly researchers now automatically start anomaly projects when possible;
|
||||||
|
|
||||||
|
1.1.0
|
||||||
- 1.5 be like;
|
- 1.5 be like;
|
||||||
|
|
||||||
1.0.7
|
1.0.7
|
||||||
- made a minor change that probably should improve cases when mods add their own requirements for research (thanks @Taranchuk);
|
- made a minor change that probably should improve cases when mods add their own requirements for research (thanks @Taranchuk);
|
||||||
|
|
||||||
other
|
other
|
||||||
- little hint to put this mod before "research re-invenred" mod.
|
- little hint to put this mod before "research re-invenred" mod;
|
||||||
|
|
||||||
1.0.6
|
1.0.6
|
||||||
- added checking for new prerequisites;
|
- added checking for new prerequisites;
|
||||||
|
|||||||
Reference in New Issue
Block a user