commit ce44b3692c9b7b916e53cece5de49dd2cad3c1de Author: Shabakur <109368764+Shabalox@users.noreply.github.com> Date: Fri Nov 18 09:27:01 2022 +0100 Add files via upload diff --git a/RJW-Genes-Addons/About/About.xml b/RJW-Genes-Addons/About/About.xml new file mode 100644 index 0000000..052183a --- /dev/null +++ b/RJW-Genes-Addons/About/About.xml @@ -0,0 +1,39 @@ + + RJW Genes Addons + Shaba + Shaba.rjw.genes.addons + +
  • 1.4
  • +
    + Adds additional contentfor RJW Genes + +
  • + ludeon.rimworld.biotech + Biotech +
  • +
  • + rim.job.world + RimJobWorld + https://www.loverslab.com/files/file/7257-rimjobworld/ +
  • +
  • + brrainz.harmony + Harmony + steam://url/CommunityFilePage/2009463077 + https://github.com/pardeike/HarmonyRimWorld/releases/latest +
  • + +
    + +
  • rim.job.world
  • +
  • brrainz.harmony
  • +
  • ludeon.rimworld.biotech
  • +
    +
    \ No newline at end of file diff --git a/RJW-Genes-Addons/Common/Assemblies/shabe_genesaddons.dll b/RJW-Genes-Addons/Common/Assemblies/shabe_genesaddons.dll new file mode 100644 index 0000000..c80c0ee Binary files /dev/null and b/RJW-Genes-Addons/Common/Assemblies/shabe_genesaddons.dll differ diff --git a/RJW-Genes-Addons/Common/Defs/GeneDefs/GeneDefs_RJW.xml b/RJW-Genes-Addons/Common/Defs/GeneDefs/GeneDefs_RJW.xml new file mode 100644 index 0000000..a13868a --- /dev/null +++ b/RJW-Genes-Addons/Common/Defs/GeneDefs/GeneDefs_RJW.xml @@ -0,0 +1,21 @@ + + + + + rjw_genes_mechbreeder + + Pawns with this gene are able to birth mechanoids unharmed. + World/WorldObjects/Expanding/Mechanoids + 51 + Reproduction + + + + rjw_genes_insectincubator + + Pawns with this gene are able to hold more insect eggs. + World/WorldObjects/Expanding/Mechanoids + 52 + Reproduction + + \ No newline at end of file diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/GeneDefOf.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/GeneDefOf.cs new file mode 100644 index 0000000..8e1160c --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/GeneDefOf.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; + +namespace shabe_genesaddons +{ + [DefOf] + public static class GeneDefOf + { + public static readonly GeneDef rjw_genes_mechbreeder; + public static readonly GeneDef rjw_genes_insectincubator; + } +} diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/GeneUtility.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/GeneUtility.cs new file mode 100644 index 0000000..5a13b5d --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/GeneUtility.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace shabe_genesaddons +{ + public class GeneUtility + { + public static bool IsMechbreeder(Pawn pawn) + { + return pawn.genes.HasGene(GeneDefOf.rjw_genes_mechbreeder); + } + + public static bool IsInsectIncubator(Pawn pawn) + { + return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator); + } + + public static float MaxEggSizeMul(Pawn pawn) + { + float MaxEggSize = 1; + if (IsInsectIncubator(pawn)) + { + MaxEggSize *= 2; + } + return MaxEggSize; + } + } +} diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/HarmonyInit.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/HarmonyInit.cs new file mode 100644 index 0000000..6838ef6 --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/HarmonyInit.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using HarmonyLib; + + +namespace shabe_genesaddons +{ + [StaticConstructorOnStartup] + internal static class HarmonyInit + { + static HarmonyInit() + { + Harmony harmony = new Harmony("shabe_genesaddons"); + harmony.PatchAll(); + } + } +} diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/PatchMechBirth.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/PatchMechBirth.cs new file mode 100644 index 0000000..4ad35d3 --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/PatchMechBirth.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Reflection.Emit; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using rjw; +namespace shabe_genesaddons +{ + [HarmonyPatch(typeof(Hediff_MechanoidPregnancy), "GiveBirth")] + public static class PatchMechBirth + { + [HarmonyTranspiler] + public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator il) + { + bool found_call = false; + bool found_skip = false; + Label skip_label = il.DefineLabel(); + MethodInfo ismechbreeder = AccessTools.Method(typeof(GeneUtility), "IsMechbreeder"); + foreach(CodeInstruction codeInstruction in instructions) + { + //Check if the first opcode after endfinally ldloc_0 is and in that case add the label to skip the code + if (found_skip && codeInstruction.opcode == OpCodes.Ldloc_0) + { + codeInstruction.labels.Add(skip_label); + } + found_skip = false; + if (codeInstruction.opcode == OpCodes.Endfinally) + { + found_skip = true; + } + + yield return codeInstruction; + + if (codeInstruction.opcode == OpCodes.Call) + { + //Log.Message(codeInstruction.operand.ToString()); + if (codeInstruction.operand.ToString() == "Boolean TryMakeFilth(Verse.IntVec3, Verse.Map, Verse.ThingDef, System.String, Int32, RimWorld.FilthSourceFlags)") + { + found_call = true; + } + } + //Triggers after the pop opcode (after generating filth in c#). + else if (found_call) + { + //Load pawn, call function to check if a mechbreeder, and skip past the part which does damage + yield return new CodeInstruction(OpCodes.Ldloc_0, null); + yield return new CodeInstruction(OpCodes.Call, ismechbreeder); + yield return new CodeInstruction(OpCodes.Brtrue_S, skip_label); + found_call = false; + } + } + yield break; + } + } +} diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/PatchPregnancyHelper.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/PatchPregnancyHelper.cs new file mode 100644 index 0000000..280e66c --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/PatchPregnancyHelper.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Reflection.Emit; +using System.Reflection; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using Verse; +using RimWorld; +using rjw; + +namespace shabe_genesaddons +{ + [HarmonyPatch(typeof(PregnancyHelper), "DoEgg")] + static class PatchPregnancyHelper + { + [HarmonyTranspiler] + public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator il) + { + //MethodInfo isinsectincubator = AccessTools.Method(typeof(GeneUtility), "IsInsectIncubator"); + MethodInfo maxeggsizemul = AccessTools.Method(typeof(GeneUtility), "MaxEggSizeMul"); + FieldInfo partner = AccessTools.Field(typeof(SexProps), "partner"); + + Label skiplabel = il.DefineLabel(); + bool finished = false; + foreach (CodeInstruction codeInstruction in instructions) + { + if (!finished) + { + if (codeInstruction.opcode == OpCodes.Ldc_R4 && codeInstruction.operand.ToString() == "0") + { + yield return new CodeInstruction(OpCodes.Ldarg_0, null); + yield return new CodeInstruction(OpCodes.Ldfld, partner); + //yield return new CodeInstruction(OpCodes.Call, isinsectincubator); + yield return new CodeInstruction(OpCodes.Callvirt, maxeggsizemul); + //yield return new CodeInstruction(OpCodes.Brfalse_S, skiplabel); + yield return new CodeInstruction(OpCodes.Ldloc_0, null); + //yield return new CodeInstruction(OpCodes.Ldc_R4, 2f); + yield return new CodeInstruction(OpCodes.Mul, null); + yield return new CodeInstruction(OpCodes.Stloc_0, null); + //codeInstruction.labels.Add(skiplabel); + finished = true; + } + } + yield return codeInstruction; + } + } + } +} diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/Properties/AssemblyInfo.cs b/RJW-Genes-Addons/Source/shabe_genesaddons/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..40ab984 --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/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("shabe_genesaddons")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("shabe_genesaddons")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2022")] +[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("3d62bdb2-ed7b-481b-b00b-0b634d99ec8d")] + +// 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/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..434c431 Binary files /dev/null and b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.AssemblyReference.cache b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.AssemblyReference.cache new file mode 100644 index 0000000..0215442 Binary files /dev/null and b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.AssemblyReference.cache differ diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.CoreCompileInputs.cache b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..06b7c3b --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +d59c68acf3ebb7bba9ec07e36b458fa423e5f1bb diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.FileListAbsolute.txt b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..652018f --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.csproj.FileListAbsolute.txt @@ -0,0 +1,4 @@ +C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW-Genes-Addons\Common\Assemblies\shabe_genesaddons.dll +C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW-Genes-Addons\Source\shabe_genesaddons\obj\Debug\shabe_genesaddons.csproj.AssemblyReference.cache +C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW-Genes-Addons\Source\shabe_genesaddons\obj\Debug\shabe_genesaddons.csproj.CoreCompileInputs.cache +C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW-Genes-Addons\Source\shabe_genesaddons\obj\Debug\shabe_genesaddons.dll diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.dll b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.dll new file mode 100644 index 0000000..c80c0ee Binary files /dev/null and b/RJW-Genes-Addons/Source/shabe_genesaddons/obj/Debug/shabe_genesaddons.dll differ diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.csproj b/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.csproj new file mode 100644 index 0000000..4a0fed3 --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {3D62BDB2-ED7B-481B-B00B-0B634D99EC8D} + Library + Properties + shabe_genesaddons + shabe_genesaddons + v4.7.2 + 512 + true + + + false + none + false + ..\..\Common\Assemblies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\Shaba_Addons\Assemblies\0Harmony.dll + False + + + ..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\RJW\1.4\Assemblies\RJW.dll + False + + + + + + + + + + + ..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + False + + + + + + + + + + + + \ No newline at end of file diff --git a/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.sln b/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.sln new file mode 100644 index 0000000..c3ff653 --- /dev/null +++ b/RJW-Genes-Addons/Source/shabe_genesaddons/shabe_genesaddons.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32519.379 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "shabe_genesaddons", "shabe_genesaddons.csproj", "{3D62BDB2-ED7B-481B-B00B-0B634D99EC8D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3D62BDB2-ED7B-481B-B00B-0B634D99EC8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D62BDB2-ED7B-481B-B00B-0B634D99EC8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D62BDB2-ED7B-481B-B00B-0B634D99EC8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D62BDB2-ED7B-481B-B00B-0B634D99EC8D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D21AF08D-662F-448D-AF7A-30E300663E53} + EndGlobalSection +EndGlobal