mirror of
https://github.com/Xevion/RimWorld_ResearchWhatever.git
synced 2025-12-15 12:13:06 -06:00
1.0.4
This commit is contained in:
37
Source/ResearchWhatever13/Patches/ResearchManagerPatch.cs
Normal file
37
Source/ResearchWhatever13/Patches/ResearchManagerPatch.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using Verse.Sound;
|
||||
|
||||
namespace ResearchWhatever.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(ResearchManager), "FinishProject")]
|
||||
public static class ResearchManager_FinishProject_ResearchWhateverPatch
|
||||
{
|
||||
public static void Prefix(ResearchManager __instance, ref bool doCompletionDialog)
|
||||
{
|
||||
if (doCompletionDialog)
|
||||
{
|
||||
var comp = Current.Game.GetComponent<ResearchWhateverGameComp>();
|
||||
if (comp.NotifyMode == ResearchWhateverNotifyMode.rwnDefault)
|
||||
return;
|
||||
|
||||
doCompletionDialog = false;
|
||||
|
||||
switch (comp.NotifyMode)
|
||||
{
|
||||
case ResearchWhateverNotifyMode.rwnLetter:
|
||||
Find.LetterStack.ReceiveLetter("ResearchFinished".Translate(__instance.currentProj.LabelCap), __instance.currentProj.description, LetterDefOf.PositiveEvent, null, null, null, null, null);
|
||||
break;
|
||||
case ResearchWhateverNotifyMode.rwnNotice:
|
||||
Messages.Message("ResearchFinished".Translate(__instance.currentProj.LabelCap).CapitalizeFirst(), MessageTypeDefOf.SilentInput);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace ResearchWhatever
|
||||
{
|
||||
//[HarmonyPatch(typeof(StaticConstructorOnStartupUtility), "CallAll")]
|
||||
[HarmonyPatch]
|
||||
static class StaticConstructorOnStartupUtility_CallAll_ResearchWhateverPatch
|
||||
public static class StaticConstructorOnStartupUtility_CallAll_ResearchWhateverPatch
|
||||
{
|
||||
internal static MethodBase TargetMethod()
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace ResearchWhatever
|
||||
return LCallAll;
|
||||
}
|
||||
//
|
||||
static void Postfix()
|
||||
public static void Postfix()
|
||||
{
|
||||
List<ThingDef> list = new List<ThingDef>(
|
||||
from x in DefDatabase<ThingDef>.AllDefsListForReading
|
||||
|
||||
@@ -8,9 +8,9 @@ using Verse.Sound;
|
||||
namespace ResearchWhatever.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(WorkGiver_Researcher), "ShouldSkip")]
|
||||
static class WorkGiver_Researcher_ShouldSkip_ResearchWhateverPatch
|
||||
public static class WorkGiver_Researcher_ShouldSkip_ResearchWhateverPatch
|
||||
{
|
||||
static bool Prefix(ref bool __result)
|
||||
public static bool Prefix(ref bool __result)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
@@ -18,9 +18,9 @@ namespace ResearchWhatever.Patches
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WorkGiver_Researcher), "PotentialWorkThingRequest", MethodType.Getter)]
|
||||
static class WorkGiver_PotentialWorkThingRequest_ResearchWhateverPatch
|
||||
public static class WorkGiver_PotentialWorkThingRequest_ResearchWhateverPatch
|
||||
{
|
||||
static bool Prefix(ref ThingRequest __result)
|
||||
public static bool Prefix(ref ThingRequest __result)
|
||||
{
|
||||
__result = ThingRequest.ForGroup(ThingRequestGroup.ResearchBench);
|
||||
return false;
|
||||
@@ -28,7 +28,7 @@ namespace ResearchWhatever.Patches
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WorkGiver_Researcher), "HasJobOnThing")]
|
||||
static class WorkGiver_Researcher_HasJobOnThing_ResearchWhateverPatch
|
||||
public static class WorkGiver_Researcher_HasJobOnThing_ResearchWhateverPatch
|
||||
{
|
||||
private static bool hasFacilities(this Building_ResearchBench bench, List<ThingDef> requiredFacilities)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace ResearchWhatever.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
static void Prefix(Pawn pawn, Thing t, bool forced)
|
||||
public static void Prefix(Pawn pawn, Thing t, bool forced)
|
||||
{
|
||||
ResearchProjectDef currentProj = Find.ResearchManager.currentProj;
|
||||
if (currentProj != null) return;
|
||||
|
||||
Reference in New Issue
Block a user