mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	First Draft naked prowess and racegenedef bugfix
This commit is contained in:
		
							parent
							
								
									43705b9676
								
							
						
					
					
						commit
						f1e14befbb
					
				
					 11 changed files with 192 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -28,13 +28,16 @@ namespace RJW_BGS
 | 
			
		|||
				ModLog.Warning($"Error looking up PawnKindDef for {pawn.Name} - Could not lookup Animal Inheritance Genes");
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			string raceName = kindDef.race.defName;
 | 
			
		||||
			string pawnKindName = kindDef.defName;
 | 
			
		||||
			//Wild animals have no name, so we will use pawnkindname instead
 | 
			
		||||
			string pawnName = pawn.Name != null ? pawn.Name.ToStringFull : pawnKindName; 
 | 
			
		||||
			PawnData pawnData = SaveStorage.DataStore.GetPawnData(pawn);
 | 
			
		||||
			RaceGroupDef raceGroupDef = pawnData.RaceSupportDef;
 | 
			
		||||
 | 
			
		||||
			if (RJW_BGSSettings.rjw_bgs_detailed_debug)
 | 
			
		||||
				ModLog.Message($"Looking up Animal-Inheritable Genes for {pawn.Name} with KindDef {kindDef.defName},RaceName {raceName}, PawnKind {pawnKindName} and RaceGroup {raceGroupDef.defName}");
 | 
			
		||||
				ModLog.Message($"Looking up Animal-Inheritable Genes for {pawnName} with KindDef {kindDef.defName},RaceName {raceName}, PawnKind {pawnKindName} and RaceGroup {raceGroupDef.defName}");
 | 
			
		||||
 | 
			
		||||
			IEnumerable<RaceGeneDef> allDefs = DefDatabase<RaceGeneDef>.AllDefs;
 | 
			
		||||
			List<RaceGeneDef> pawnKindDefs = allDefs.Where(delegate (RaceGeneDef group)
 | 
			
		||||
| 
						 | 
				
			
			@ -44,11 +47,11 @@ namespace RJW_BGS
 | 
			
		|||
			}).ToList<RaceGeneDef>();
 | 
			
		||||
			if (pawnKindDefs.Count() > 0)
 | 
			
		||||
            {
 | 
			
		||||
				DebugPrintRaceGeneDefs("PawnKindDefs",pawn.Name.ToStringFull,pawnKindDefs);
 | 
			
		||||
				DebugPrintRaceGeneDefs("PawnKindDefs", pawnName,pawnKindDefs);
 | 
			
		||||
				return pawnKindDefs;
 | 
			
		||||
			}
 | 
			
		||||
			else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
 | 
			
		||||
				ModLog.Message($"Did not find PawnKindDefs for {pawn.Name.ToStringFull}");
 | 
			
		||||
				ModLog.Message($"Did not find PawnKindDefs for {pawnName}");
 | 
			
		||||
 | 
			
		||||
			List<RaceGeneDef> raceKindDefs = allDefs.Where(delegate (RaceGeneDef group)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -57,11 +60,11 @@ namespace RJW_BGS
 | 
			
		|||
			}).ToList<RaceGeneDef>();
 | 
			
		||||
			if (raceKindDefs.Count() > 0)
 | 
			
		||||
			{
 | 
			
		||||
				DebugPrintRaceGeneDefs("PawnKindDefs", pawn.Name.ToStringFull, raceKindDefs);
 | 
			
		||||
				DebugPrintRaceGeneDefs("PawnKindDefs", pawnName, raceKindDefs);
 | 
			
		||||
				return raceKindDefs;
 | 
			
		||||
			}
 | 
			
		||||
			else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
 | 
			
		||||
				ModLog.Message($"Did not find RaceKindDefs for {pawn.Name.ToStringFull}");
 | 
			
		||||
				ModLog.Message($"Did not find RaceKindDefs for {pawnName}");
 | 
			
		||||
 | 
			
		||||
			List<RaceGeneDef> raceGroupDefs = new List<RaceGeneDef>();
 | 
			
		||||
			if (raceGroupDef != null)
 | 
			
		||||
| 
						 | 
				
			
			@ -77,13 +80,13 @@ namespace RJW_BGS
 | 
			
		|||
			
 | 
			
		||||
			if (raceGroupDefs.Count() > 0)
 | 
			
		||||
            {
 | 
			
		||||
				DebugPrintRaceGeneDefs("RaceKindDefs", pawn.Name.ToStringFull, raceGroupDefs);
 | 
			
		||||
				DebugPrintRaceGeneDefs("RaceKindDefs", pawnName, raceGroupDefs);
 | 
			
		||||
				return raceGroupDefs;
 | 
			
		||||
			}
 | 
			
		||||
			else if (RJW_BGSSettings.rjw_bgs_detailed_debug)
 | 
			
		||||
				ModLog.Message($"Did not find RaceGroupDefs for {pawn.Name.ToStringFull}");
 | 
			
		||||
				ModLog.Message($"Did not find RaceGroupDefs for {pawnName}");
 | 
			
		||||
 | 
			
		||||
			ModLog.Message($"Did not find any Genes inheritable for {pawn.Name.ToStringFull}");
 | 
			
		||||
			ModLog.Message($"Did not find any Genes inheritable for {pawnName}");
 | 
			
		||||
			return new List<RaceGeneDef>();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
using rjw;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	//Summary//
 | 
			
		||||
	//Returns invalid if a pawn is not naked
 | 
			
		||||
	//Summary//
 | 
			
		||||
	public class CompAbilityEffect_CasterIsNaked : CompAbilityEffect_WithDest
 | 
			
		||||
	{
 | 
			
		||||
		private new CompProperties_CasterIsNaked Props
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return (CompProperties_CasterIsNaked)this.props;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override bool GizmoDisabled(out string reason)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn pawn = this.CasterPawn;
 | 
			
		||||
			if (pawn != null)
 | 
			
		||||
			{
 | 
			
		||||
				//Copied from ThoughtWorker_NudistNude.CurrentStateInternal
 | 
			
		||||
				List<Apparel> wornApparel = pawn.apparel.WornApparel;
 | 
			
		||||
				for (int i = 0; i < wornApparel.Count; i++)
 | 
			
		||||
				{
 | 
			
		||||
					Apparel apparel = wornApparel[i];
 | 
			
		||||
					if (apparel.def.apparel.countsAsClothingForNudity)
 | 
			
		||||
					{
 | 
			
		||||
						for (int j = 0; j < apparel.def.apparel.bodyPartGroups.Count; j++)
 | 
			
		||||
						{
 | 
			
		||||
							if (apparel.def.apparel.bodyPartGroups[j] == BodyPartGroupDefOf.Torso)
 | 
			
		||||
							{
 | 
			
		||||
								reason = pawn.Name + " is not naked";
 | 
			
		||||
								return true;
 | 
			
		||||
							}
 | 
			
		||||
							if (apparel.def.apparel.bodyPartGroups[j] == BodyPartGroupDefOf.Legs)
 | 
			
		||||
							{
 | 
			
		||||
								reason = pawn.Name + " is not naked";
 | 
			
		||||
								return true;
 | 
			
		||||
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			reason = null;
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	public class CompProperties_CasterIsNaked : CompProperties_EffectWithDest
 | 
			
		||||
	{
 | 
			
		||||
		public CompProperties_CasterIsNaked()
 | 
			
		||||
		{
 | 
			
		||||
			this.compClass = typeof(CompAbilityEffect_CasterIsNaked);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -61,10 +61,8 @@ namespace RJW_Genes
 | 
			
		|||
			return AlertReport.CulpritsAre(this.Targets);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Token: 0x04004B5C RID: 19292
 | 
			
		||||
		private List<GlobalTargetInfo> targets = new List<GlobalTargetInfo>();
 | 
			
		||||
 | 
			
		||||
		// Token: 0x04004B5D RID: 19293
 | 
			
		||||
		private List<string> targetLabels = new List<string>();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,7 @@ namespace RJW_Genes
 | 
			
		|||
				if (this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_cum_eater)
 | 
			
		||||
				|| this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_vaginal_absorber) || this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_anal_absorber) || this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_drainer))
 | 
			
		||||
				{
 | 
			
		||||
					//TODO: use mentalstatedef instead of mentalbreakdef
 | 
			
		||||
					MentalBreakDef randomrape = GeneDefOf.rjw_genes_lifeforce_randomrape;
 | 
			
		||||
					if (ModsConfig.BiotechActive &&
 | 
			
		||||
						this.Pawn.Spawned && !this.Pawn.InMentalState && !this.Pawn.Downed &&
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@ namespace RJW_Genes
 | 
			
		|||
                        // Gene: Generous Donor [Postfix Patch]
 | 
			
		||||
                        harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)),
 | 
			
		||||
                            postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix)));
 | 
			
		||||
                        //Eat cumflation 
 | 
			
		||||
                        harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)),
 | 
			
		||||
                            postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix)));
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,6 +125,8 @@
 | 
			
		|||
    <Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CasterIsNaked.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompProperties_CasterIsNaked.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Alert_LowFertilin.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_Seduce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_LifeForceCost.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue