From 83d3e2f6c56c173969314f52c3d06332dfc976b0 Mon Sep 17 00:00:00 2001 From: "p.tychinin" Date: Sat, 6 Apr 2024 14:27:54 +0300 Subject: [PATCH] 1.1 --- 1.5/Assemblies/ResearchWhatever.dll | Bin 0 -> 16384 bytes .../firefoxpdm.ResearchableStatUpgrades.xml | 33 +++++++ About/About.xml | 1 + Source/ResearchWhatever15/.gitignore | 3 + .../Patches/ResearchManagerPatch.cs | 38 ++++++++ .../StaticConstructorOnStartupUtilityPatch.cs | 49 ++++++++++ .../Patches/WorkGiver_ResearcherPatch.cs | 86 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++ Source/ResearchWhatever15/ResearchWhatever.cs | 17 ++++ .../ResearchWhatever.csproj | 74 +++++++++++++++ .../ResearchWhatever15/ResearchWhatever.sln | 25 +++++ .../ResearchWhateverComp.cs | 76 ++++++++++++++++ .../ResearchWhateverExtansion.cs | 10 ++ .../ResearchWhateverGameComp.cs | 24 +++++ Source/ResearchWhatever15/packages.config | 4 + change.log | 7 +- 16 files changed, 481 insertions(+), 2 deletions(-) create mode 100644 1.5/Assemblies/ResearchWhatever.dll create mode 100644 1.5/Patches/firefoxpdm.ResearchableStatUpgrades.xml create mode 100644 Source/ResearchWhatever15/.gitignore create mode 100644 Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs create mode 100644 Source/ResearchWhatever15/Patches/StaticConstructorOnStartupUtilityPatch.cs create mode 100644 Source/ResearchWhatever15/Patches/WorkGiver_ResearcherPatch.cs create mode 100644 Source/ResearchWhatever15/Properties/AssemblyInfo.cs create mode 100644 Source/ResearchWhatever15/ResearchWhatever.cs create mode 100644 Source/ResearchWhatever15/ResearchWhatever.csproj create mode 100644 Source/ResearchWhatever15/ResearchWhatever.sln create mode 100644 Source/ResearchWhatever15/ResearchWhateverComp.cs create mode 100644 Source/ResearchWhatever15/ResearchWhateverExtansion.cs create mode 100644 Source/ResearchWhatever15/ResearchWhateverGameComp.cs create mode 100644 Source/ResearchWhatever15/packages.config diff --git a/1.5/Assemblies/ResearchWhatever.dll b/1.5/Assemblies/ResearchWhatever.dll new file mode 100644 index 0000000000000000000000000000000000000000..00334d64832001a5f9d93ddbb85a4072995d7963 GIT binary patch literal 16384 zcmeHu4RjROmFBHit?E{*)#`5a1DHT#z;5)@BOzhH28_@T$d*7x0_>PXw7N@Dn^sp- z)eQ()SZxxIapGi1f|nd8Gj_Z=YsTJW$lsVGp0Q((V;>(+!0Vsv#`c;Md$OL)Oyb?l zP9{6X``uU7t(JiJ3w18;8@ZMXG~+%jE#rmv2@zVhKKdAnM;S0>2T-vf$+GI z(4&==-sKMK{w|_kMWyrKyZ>(r(%z&i!xc(1(OOV6n|j}F+{3u`;vx#jvat1Lg42xX z0U)6BPo=#d=cfFB=I)?O!f!M9Zs)>YjGYZJ_cu-C1MTizwmNgGFN=qXJSCML;9E=Z zXjVUz1^$IK0H~8=b@T=%e_?19H7zp^OzO551$NZ6xJrJT;I62trwlY?U1=H@^V*23 zRHId{EDSx?InNAJp@Dqf3|?rTc#a8x-v>L>)(*0Nn2*b_{vzY^Y*1sG*sa|PXxJIoqXx2*dtiZgchYDOjW zYEtUe+8v_WKo0O$*fgJ~E?VZ9A6;7?SqG~5dB|}am<-;?bqv-6xFvb z|7z=uO(@r2vPWe|o$=w3cC@RDZ06RrqIO4Z{YJ4Q8tDL@hX<9~dMJBEvr6~kjsXTO z#FXY$Bbb&AjiRnz6Ol5GmLLYLO)_i}we_me4Gt9z?G~a>^LezXd8qM(l*ks)r$UTO zGD-F@Fd4m`3mRfivwBdDAiFg*xoRulxB^{n1f}U)Z}>yXg<8nE!l(w}wYvIp)=fdK z6Vyc8CJ7URZ7pb&3;2o2UbK{PdCkqj=mXN&AK8Z6BvPPPO!fmBH!*pgnB2klMfP2t z901n343l#Zg$NYZ8f%2%hF&Y0)T`?1C*e#NW)r3`WV+}i<`8TWw4jvcjUan^ZC^Gj z^_rSPXem?B8#ZDHZ`*~42OKNhjUG2oI*x(}raezB%sk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x``g_aLDuZ^!Aj*T>}Tidp-sjanTP1EqI zVZG^^)^)9`+t#jXj;%@H&w=m`wgq30;vZ3;LW`o?x(166$s3)glN<1b>6+*&=smz;dHmxt7O?H+cj zHD+Y?n91>j{5WJ!!QU4>5#ED$5_mVcr{Mj;WBowyWm<+B%`@c7KjyU!7vCiu5p_8LTO3{(sCe9lgyHZALk z{>=4VFjeFkgHP;yqPm#VN!g|u+o^#KGbI&Qvuo=tE46nj@ZDy=3IJq?!FP2?{_G~Ra zkC?c}V4oQcKS*X2XBa*q@^34?S5f2{c~o*?i)3)l%ZNR!JcFN3%+B_w)Af@j?K~^_L)6_ zvm2j_W-P)oKj6s?#?U7HFq_9*Z_M?@TG^)^qvI3yIHD^B>xB{7_Nlwz#ku_;?)UfW UxBq7Nk literal 0 HcmV?d00001 diff --git a/1.5/Patches/firefoxpdm.ResearchableStatUpgrades.xml b/1.5/Patches/firefoxpdm.ResearchableStatUpgrades.xml new file mode 100644 index 0000000..c8b6d1d --- /dev/null +++ b/1.5/Patches/firefoxpdm.ResearchableStatUpgrades.xml @@ -0,0 +1,33 @@ + + + + Always + +
  • Defs/ResearchProjectDef[defName="StackingRepeatable"]/modExtensions
  • +
  • + Defs/ResearchProjectDef[defName="StackingRepeatable"]/modExtensions + +
  • + + true +
  • + + +
    +
    + + + Always + +
  • Defs/ResearchProjectDef[defName="ProductivityRepeatable"]/modExtensions
  • +
  • + Defs/ResearchProjectDef[defName="ProductivityRepeatable"]/modExtensions + +
  • + true +
  • + + +
    +
    +
    \ No newline at end of file diff --git a/About/About.xml b/About/About.xml index 8b1c550..b3901cf 100644 --- a/About/About.xml +++ b/About/About.xml @@ -5,6 +5,7 @@
  • 1.3
  • 1.4
  • +
  • 1.5
  • none avilmask.ResearchWhatever diff --git a/Source/ResearchWhatever15/.gitignore b/Source/ResearchWhatever15/.gitignore new file mode 100644 index 0000000..1c6aa8a --- /dev/null +++ b/Source/ResearchWhatever15/.gitignore @@ -0,0 +1,3 @@ +/.vs/ +/obj/ +/packages/ \ No newline at end of file diff --git a/Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs b/Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs new file mode 100644 index 0000000..4ab47cb --- /dev/null +++ b/Source/ResearchWhatever15/Patches/ResearchManagerPatch.cs @@ -0,0 +1,38 @@ +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(); + if (comp.NotifyMode == ResearchWhateverNotifyMode.rwnDefault) + return; + + doCompletionDialog = false; + + var currentProj = __instance.GetProject(); + switch (comp.NotifyMode) + { + case ResearchWhateverNotifyMode.rwnLetter: + Find.LetterStack.ReceiveLetter("ResearchFinished".Translate(currentProj.LabelCap), currentProj.description, LetterDefOf.PositiveEvent, null, null, null, null, null); + break; + case ResearchWhateverNotifyMode.rwnNotice: + Messages.Message("ResearchFinished".Translate(currentProj.LabelCap).CapitalizeFirst(), MessageTypeDefOf.SilentInput); + break; + default: + break; + } + } + } + } +} diff --git a/Source/ResearchWhatever15/Patches/StaticConstructorOnStartupUtilityPatch.cs b/Source/ResearchWhatever15/Patches/StaticConstructorOnStartupUtilityPatch.cs new file mode 100644 index 0000000..3d175d4 --- /dev/null +++ b/Source/ResearchWhatever15/Patches/StaticConstructorOnStartupUtilityPatch.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using Verse; +using HarmonyLib; +using System.Reflection; +using RimWorld; + + +namespace ResearchWhatever +{ + public static class StaticConstructorOnStartupUtility_Patch + { + //[HarmonyPatch(typeof(StaticConstructorOnStartupUtility), "CallAll")] + [HarmonyPatch] + public static class StaticConstructorOnStartupUtility_CallAll_ResearchWhateverPatch + { + internal static MethodBase TargetMethod() + { + MethodBase LCallAll = AccessTools.Method("BetterLoading.Stage.InitialLoad.StageRunStaticCctors:PreCallAll"); + if (LCallAll == null) + { + LCallAll = AccessTools.Method("Verse.StaticConstructorOnStartupUtility:CallAll"); + if (LCallAll == null) + throw new Exception("Couldn't find StaticConstructorOnStartupUtility.CallAll()"); + } + else + Log.Message("[ResearchWhatever] BetterLoading detected, workaround initiated"); + return LCallAll; + } + // + public static void Postfix() + { + List list = new List( + from x in DefDatabase.AllDefsListForReading + where x.thingClass == typeof(Building_ResearchBench) || x.thingClass != null && x.thingClass.IsSubclassOf(typeof(Building_ResearchBench)) + select x); + + if (list.NullOrEmpty()) + return; + else + foreach (var thing in list) + { + thing?.comps?.Add(new CompProperties(typeof(ResearchWhateverComp))); + } + } + } + } +} diff --git a/Source/ResearchWhatever15/Patches/WorkGiver_ResearcherPatch.cs b/Source/ResearchWhatever15/Patches/WorkGiver_ResearcherPatch.cs new file mode 100644 index 0000000..392ac64 --- /dev/null +++ b/Source/ResearchWhatever15/Patches/WorkGiver_ResearcherPatch.cs @@ -0,0 +1,86 @@ +using System.Linq; +using System.Collections.Generic; +using HarmonyLib; +using RimWorld; +using Verse; +using Verse.Sound; + +namespace ResearchWhatever.Patches +{ + [HarmonyPatch(typeof(WorkGiver_Researcher), "ShouldSkip")] + public static class WorkGiver_Researcher_ShouldSkip_ResearchWhateverPatch + { + public static bool Prefix(ref bool __result) + { + __result = false; + return false; + } + } + + [HarmonyPatch(typeof(WorkGiver_Researcher), "PotentialWorkThingRequest", MethodType.Getter)] + public static class WorkGiver_PotentialWorkThingRequest_ResearchWhateverPatch + { + public static bool Prefix(ref ThingRequest __result) + { + __result = ThingRequest.ForGroup(ThingRequestGroup.ResearchBench); + return false; + } + } + + [HarmonyPatch(typeof(WorkGiver_Researcher), "HasJobOnThing")] + public static class WorkGiver_Researcher_HasJobOnThing_ResearchWhateverPatch + { + private static bool HasFacilities(this Building_ResearchBench bench, List requiredFacilities) + { + if (requiredFacilities.NullOrEmpty()) return true; + CompAffectedByFacilities comp = bench.TryGetComp(); + if (comp == null) return false; + + foreach (var rf in requiredFacilities) + if (comp.LinkedFacilitiesListForReading.FirstOrDefault(x => x.def == rf && comp.IsFacilityActive(x)) == null) + return false; + + return true; + } + + private static bool CanBePicked(this ResearchProjectDef research, Building_ResearchBench bench) + { + return research.baseCost > 0f + && research.CanStartNow + && Find.Storyteller.difficulty.AllowedBy(research.hideWhen) + && (research.requiredResearchBuilding == null || research.requiredResearchBuilding == bench.def && bench.HasFacilities(research.requiredResearchFacilities)) + && research.GetModExtension()?.ignore != true; + } + + internal static void Prefix(Pawn pawn, Thing t, bool forced) + { + ResearchProjectDef currentProj = Find.ResearchManager.GetProject(); + if (currentProj != null) return; + if (!(t is Building_ResearchBench bench)) return; + + ResearchWhateverComp comp = bench.TryGetComp(); + + if (comp == null || !comp.Active) return; + + List projects = new List( + from x in DefDatabase.AllDefsListForReading + where x.CanBePicked(bench) + select x); + + if (projects.NullOrEmpty()) + { + comp.Active = false; + Messages.Message("ResearchWhateverNothingLeftToResearch".Translate(bench.Label).CapitalizeFirst(), new TargetInfo(bench.Position, bench.Map, false), MessageTypeDefOf.NeutralEvent); + return; + } + projects.SortBy(x => x.GetModExtension()?.lowPriority == true ? 100000000f + x.CostApparent : x.CostApparent); + + ResearchProjectDef def = projects.First(); + projects.TryRandomElementByWeight(x => x.CostApparent == def.CostApparent ? 1f : 0f, out def); + SoundDefOf.ResearchStart.PlayOneShotOnCamera(null); + Find.ResearchManager.SetCurrentProject(def); + TutorSystem.Notify_Event("StartResearchProject"); + Messages.Message( "ResearchWhateverNewResearch".Translate(pawn.Name.ToStringFull, def.label).CapitalizeFirst(), new TargetInfo(bench.Position, bench.Map, false), MessageTypeDefOf.SilentInput); + } + } +} diff --git a/Source/ResearchWhatever15/Properties/AssemblyInfo.cs b/Source/ResearchWhatever15/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0fe3664 --- /dev/null +++ b/Source/ResearchWhatever15/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ResearchWhatever")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ResearchWhatever")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b08c8baf-9849-4317-b2be-639354820a7d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/ResearchWhatever15/ResearchWhatever.cs b/Source/ResearchWhatever15/ResearchWhatever.cs new file mode 100644 index 0000000..19e1217 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhatever.cs @@ -0,0 +1,17 @@ +using HarmonyLib; +using System.Reflection; +using Verse; +using RimWorld; + +namespace ResearchWhatever +{ + [StaticConstructorOnStartup] + public class ResearchWhatever : Mod + { + public ResearchWhatever(ModContentPack content) : base(content) + { + var harmony = new Harmony("net.avilmask.rimworld.mod.ResearchWhatever"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + } + } +} diff --git a/Source/ResearchWhatever15/ResearchWhatever.csproj b/Source/ResearchWhatever15/ResearchWhatever.csproj new file mode 100644 index 0000000..53856a4 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhatever.csproj @@ -0,0 +1,74 @@ + + + + + Debug + AnyCPU + {B08C8BAF-9849-4317-B2BE-639354820A7D} + Library + Properties + ResearchWhatever + ResearchWhatever + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\1.5\Assemblies\ + TRACE + prompt + 4 + + + + packages\Lib.Harmony.2.2.2\lib\net472\0Harmony.dll + False + + + E:\Games\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + False + + + + + + + + + + + E:\Games\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll + False + + + E:\Games\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + False + + + E:\Games\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll + False + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/ResearchWhatever15/ResearchWhatever.sln b/Source/ResearchWhatever15/ResearchWhatever.sln new file mode 100644 index 0000000..e7f9a55 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhatever.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1062 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResearchWhatever", "ResearchWhatever.csproj", "{B08C8BAF-9849-4317-B2BE-639354820A7D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B08C8BAF-9849-4317-B2BE-639354820A7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B08C8BAF-9849-4317-B2BE-639354820A7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B08C8BAF-9849-4317-B2BE-639354820A7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B08C8BAF-9849-4317-B2BE-639354820A7D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0D207634-209F-4992-A31F-77B17C0ED417} + EndGlobalSection +EndGlobal diff --git a/Source/ResearchWhatever15/ResearchWhateverComp.cs b/Source/ResearchWhatever15/ResearchWhateverComp.cs new file mode 100644 index 0000000..edb9423 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhateverComp.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using Verse; +using RimWorld; +using UnityEngine; + +namespace ResearchWhatever +{ + public class ResearchWhateverComp : ThingComp + { + public bool Active + { + get { return parent?.Faction == Faction.OfPlayer && active; } + set { if (value == active) return; active = value; } + } + + public override void PostExposeData() + { + Scribe_Values.Look(ref active, "active", true, false); + } + + public override IEnumerable CompGetGizmosExtra() + { + if (parent?.Faction != Faction.OfPlayer) + yield break; + // + Command_Toggle command_Toggle = new Command_Toggle(); + command_Toggle.hotKey = KeyBindingDefOf.Command_TogglePower; + command_Toggle.defaultLabel = "CommandResearchWhateverToggleLabel".Translate(); + command_Toggle.icon = TexCommand.OpenLinkedQuestTex; + command_Toggle.isActive = (() => active); + command_Toggle.toggleAction = delegate () + { + if (Event.current.button == 0) + Active = !Active; + else if (Event.current.button == 1) + { + var comp = Current.Game.GetComponent(); + //var lable = Mute ? "CommandResearchWhateverToggleMute".Translate().CapitalizeFirst() : "CommandResearchWhateverToggleUnmute".Translate().CapitalizeFirst(); + List list = new List(); + list.Add(new FloatMenuOption("CommandResearchWhateverToggleDefault".Translate().CapitalizeFirst(), delegate () + { + comp.NotifyMode = ResearchWhateverNotifyMode.rwnDefault; + })); + list.Add(new FloatMenuOption("CommandResearchWhateverToggleLetter".Translate().CapitalizeFirst(), delegate () + { + comp.NotifyMode = ResearchWhateverNotifyMode.rwnLetter; + })); + list.Add(new FloatMenuOption("CommandResearchWhateverToggleNotice".Translate().CapitalizeFirst(), delegate () + { + comp.NotifyMode = ResearchWhateverNotifyMode.rwnNotice; + })); + list.Add(new FloatMenuOption("CommandResearchWhateverToggleMute".Translate().CapitalizeFirst(), delegate () + { + comp.NotifyMode = ResearchWhateverNotifyMode.rwnMute; + })); + FloatMenu floatMenu = new FloatMenu(list); + floatMenu.vanishIfMouseDistant = true; + Find.WindowStack.Add(floatMenu); + } + }; + if (Active) + { + command_Toggle.defaultDesc = "CommandResearchWhateverToggleDescActive".Translate(); + } + else + { + command_Toggle.defaultDesc = "CommandResearchWhateverToggleDescInactive".Translate(); + } + yield return command_Toggle; + yield break; + } + + private bool active = true; + } + +} diff --git a/Source/ResearchWhatever15/ResearchWhateverExtansion.cs b/Source/ResearchWhatever15/ResearchWhateverExtansion.cs new file mode 100644 index 0000000..5ee13c5 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhateverExtansion.cs @@ -0,0 +1,10 @@ +using Verse; + +namespace ResearchWhatever +{ + public class ResearchWhateverExtansion : DefModExtension + { + public bool ignore = false; + public bool lowPriority = false; + } +} diff --git a/Source/ResearchWhatever15/ResearchWhateverGameComp.cs b/Source/ResearchWhatever15/ResearchWhateverGameComp.cs new file mode 100644 index 0000000..dc6a447 --- /dev/null +++ b/Source/ResearchWhatever15/ResearchWhateverGameComp.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Verse; +using RimWorld; + +namespace ResearchWhatever +{ + public enum ResearchWhateverNotifyMode { rwnDefault, rwnLetter, rwnNotice, rwnMute } + public class ResearchWhateverGameComp : GameComponent + { + public ResearchWhateverGameComp() + { + } + public ResearchWhateverGameComp(Game game) + { + } + public override void ExposeData() + { + Scribe_Values.Look(ref notifyMode, "NotifyMode"); + } + private ResearchWhateverNotifyMode notifyMode = ResearchWhateverNotifyMode.rwnDefault; + public ResearchWhateverNotifyMode NotifyMode { get { return notifyMode; } set { notifyMode = value; } } + } +} diff --git a/Source/ResearchWhatever15/packages.config b/Source/ResearchWhatever15/packages.config new file mode 100644 index 0000000..c5bef78 --- /dev/null +++ b/Source/ResearchWhatever15/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/change.log b/change.log index f90b1c3..6e3b4dd 100644 --- a/change.log +++ b/change.log @@ -1,5 +1,8 @@ -1.0.7 -- made a minor change that probably should improve cases when mods add their own requirements for research. +1.1.0 +- 1.5 be like; + +1.0.7 +- made a minor change that probably should improve cases when mods add their own requirements for research (thanks @Taranchuk); other - little hint to put this mod before "research re-invenred" mod.