forked from RimWorld-CCL-Reborn/JecsTools
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from jecrell/dev
Version change
- Loading branch information
Showing
19 changed files
with
76 additions
and
67 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.0.0 | ||
1.4.1.1 |
36 changes: 36 additions & 0 deletions
36
Source/AllModdingComponents/JecsTools/PawnKindGeneExtension/HarmonyPatches_StartWithGenes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using HarmonyLib; | ||
using RimWorld; | ||
using UnityEngine; | ||
using Verse; | ||
|
||
namespace JecsTools; | ||
|
||
public static partial class HarmonyPatches | ||
{ | ||
public static void HarmonyPatches_StartWithGenes(Harmony harmony, Type type) | ||
{ | ||
//Allows for adding additional genes when characters spawn with the PawnKindGeneExtension modExtension | ||
harmony.Patch(AccessTools.Method(typeof(PawnGenerator), nameof(PawnGenerator.GeneratePawn), | ||
new[] { typeof(PawnGenerationRequest) }), | ||
postfix: new HarmonyMethod(type, nameof(Post_GeneratePawn_Genes))); | ||
} | ||
|
||
public static void Post_GeneratePawn_Genes(Pawn __result) | ||
{ | ||
if (!ModsConfig.BiotechActive) | ||
return; | ||
|
||
var pawnKindGeneExtension = __result?.kindDef.GetPawnKindGeneExtension(); | ||
if (pawnKindGeneExtension == null) | ||
return; | ||
|
||
foreach (var gene in pawnKindGeneExtension.Genes.Where(gene => Rand.Range(min: 0, max: 100) < gene.chance)) | ||
{ | ||
__result.genes.AddGene(DefDatabase<GeneDef>.GetNamed(gene.defName), gene.xenogene); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
Source/AllModdingComponents/JecsTools/StartWithGenes/HarmonyPatches_StartWithGenes.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters