mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Unified Cum-Genes and made them configurable
This commit is contained in:
		
							parent
							
								
									7339bd41a1
								
							
						
					
					
						commit
						832c3aa0b8
					
				
					 8 changed files with 66 additions and 90 deletions
				
			
		| 
						 | 
					@ -84,6 +84,10 @@ but they are meant mostly to have infectors immune against their own diseases.
 | 
				
			||||||
- Faction Penalties for spreading diseases, stealing genes and aging pawns with age transfer
 | 
					- Faction Penalties for spreading diseases, stealing genes and aging pawns with age transfer
 | 
				
			||||||
- Patch  for [Imphilee Xeno](https://steamcommunity.com/sharedfiles/filedetails/?id=2990674516) by @Bunuffin
 | 
					- Patch  for [Imphilee Xeno](https://steamcommunity.com/sharedfiles/filedetails/?id=2990674516) by @Bunuffin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Changes**::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Cum-Amount-Changing genes now are XML Adjustable and share a single `.cs`-class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Fixes:**
 | 
					**Fixes:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed an Issue where pawns would always get the Pheromone social boost, unless they had the pheromone (#113)
 | 
					- Fixed an Issue where pawns would always get the Pheromone social boost, unless they had the pheromone (#113)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,10 +21,15 @@
 | 
				
			||||||
    <label>no cum</label>
 | 
					    <label>no cum</label>
 | 
				
			||||||
    <description>Males of these species have no fluid.</description>
 | 
					    <description>Males of these species have no fluid.</description>
 | 
				
			||||||
    <iconPath>Genes/Icons/No_Cum</iconPath>
 | 
					    <iconPath>Genes/Icons/No_Cum</iconPath>
 | 
				
			||||||
    <geneClass>RJW_Genes.Gene_NoCum</geneClass>
 | 
					    <geneClass>RJW_Genes.Gene_ChangeCumAmount</geneClass>
 | 
				
			||||||
    <displayOrderInCategory>533</displayOrderInCategory>
 | 
					    <displayOrderInCategory>533</displayOrderInCategory>
 | 
				
			||||||
    <biostatCpx>0</biostatCpx>
 | 
					    <biostatCpx>0</biostatCpx>
 | 
				
			||||||
    <biostatMet>1</biostatMet>
 | 
					    <biostatMet>1</biostatMet>
 | 
				
			||||||
 | 
					    <modExtensions>
 | 
				
			||||||
 | 
					      <li Class="RJW_Genes.MultiplierExtension">
 | 
				
			||||||
 | 
					        <multiplier>0.0</multiplier>
 | 
				
			||||||
 | 
					      </li>
 | 
				
			||||||
 | 
					    </modExtensions>
 | 
				
			||||||
  </GeneDef>
 | 
					  </GeneDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <GeneDef ParentName="GeneCumAmount">
 | 
					  <GeneDef ParentName="GeneCumAmount">
 | 
				
			||||||
| 
						 | 
					@ -32,10 +37,15 @@
 | 
				
			||||||
    <label>much cum</label>
 | 
					    <label>much cum</label>
 | 
				
			||||||
    <description>Males of this species produce a lot of fluid.</description>
 | 
					    <description>Males of this species produce a lot of fluid.</description>
 | 
				
			||||||
    <iconPath>Genes/Icons/Much_Cum</iconPath>
 | 
					    <iconPath>Genes/Icons/Much_Cum</iconPath>
 | 
				
			||||||
    <geneClass>RJW_Genes.Gene_MuchCum</geneClass>
 | 
					    <geneClass>RJW_Genes.Gene_ChangeCumAmount</geneClass>
 | 
				
			||||||
    <displayOrderInCategory>534</displayOrderInCategory>
 | 
					    <displayOrderInCategory>534</displayOrderInCategory>
 | 
				
			||||||
    <biostatCpx>1</biostatCpx>
 | 
					    <biostatCpx>1</biostatCpx>
 | 
				
			||||||
    <biostatMet>-1</biostatMet>
 | 
					    <biostatMet>0</biostatMet>
 | 
				
			||||||
 | 
					    <modExtensions>
 | 
				
			||||||
 | 
					      <li Class="RJW_Genes.MultiplierExtension">
 | 
				
			||||||
 | 
					        <multiplier>3.0</multiplier>
 | 
				
			||||||
 | 
					      </li>
 | 
				
			||||||
 | 
					    </modExtensions>
 | 
				
			||||||
  </GeneDef>
 | 
					  </GeneDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <GeneDef ParentName="GeneCumAmount">
 | 
					  <GeneDef ParentName="GeneCumAmount">
 | 
				
			||||||
| 
						 | 
					@ -44,10 +54,15 @@
 | 
				
			||||||
    <description>Males of this species produce a whole lot of fluid. They are like fountains
 | 
					    <description>Males of this species produce a whole lot of fluid. They are like fountains
 | 
				
			||||||
      basically.</description>
 | 
					      basically.</description>
 | 
				
			||||||
    <iconPath>Genes/Icons/Very_Much_Cum</iconPath>
 | 
					    <iconPath>Genes/Icons/Very_Much_Cum</iconPath>
 | 
				
			||||||
    <geneClass>RJW_Genes.Gene_VeryMuchCum</geneClass>
 | 
					    <geneClass>RJW_Genes.Gene_ChangeCumAmount</geneClass>
 | 
				
			||||||
    <displayOrderInCategory>535</displayOrderInCategory>
 | 
					    <displayOrderInCategory>535</displayOrderInCategory>
 | 
				
			||||||
    <biostatCpx>1</biostatCpx>
 | 
					    <biostatCpx>1</biostatCpx>
 | 
				
			||||||
    <biostatMet>-2</biostatMet>
 | 
					    <biostatMet>-1</biostatMet>
 | 
				
			||||||
 | 
					    <modExtensions>
 | 
				
			||||||
 | 
					      <li Class="RJW_Genes.MultiplierExtension">
 | 
				
			||||||
 | 
					        <multiplier>20.0</multiplier>
 | 
				
			||||||
 | 
					      </li>
 | 
				
			||||||
 | 
					    </modExtensions>
 | 
				
			||||||
  </GeneDef>
 | 
					  </GeneDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</Defs>
 | 
					</Defs>
 | 
				
			||||||
							
								
								
									
										14
									
								
								Source/Common/Defs/MultiplierExtension.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Source/Common/Defs/MultiplierExtension.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJW_Genes
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class MultiplierExtension : DefModExtension
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public float multiplier;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,21 @@ namespace RJW_Genes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/// <summary>
 | 
				
			||||||
 | 
							/// Looks up the "MultiplierExtensions" Value for a given Gene, with a fall back. 
 | 
				
			||||||
 | 
							/// Returns the fallback if there is no Extension, or if the Multiplier is smaller than 0. 
 | 
				
			||||||
 | 
							/// </summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static float LookupCumMultiplier(Gene gene, float FALLBACK = 3.0f) => LookupCumMultiplier(gene.def,FALLBACK);
 | 
				
			||||||
 | 
					        public static float LookupCumMultiplier(GeneDef def, float FALLBACK = 3.0f)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            MultiplierExtension multiplier = def.GetModExtension<MultiplierExtension>();
 | 
				
			||||||
 | 
					            if (multiplier == null || multiplier.multiplier < 0)
 | 
				
			||||||
 | 
					                return FALLBACK;
 | 
				
			||||||
 | 
					            else return multiplier.multiplier;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Get total fluidamount a person has.
 | 
					        //Get total fluidamount a person has.
 | 
				
			||||||
        public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
 | 
					        public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,36 +1,38 @@
 | 
				
			||||||
namespace RJW_Genes
 | 
					namespace RJW_Genes
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class Gene_MuchCum : RJW_Gene
 | 
					    public class Gene_ChangeCumAmount : RJW_Gene
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        bool has_been_fired = false;
 | 
					        bool has_been_fired = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        float multiplier_much_cum = 3f;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void PostMake()
 | 
					        public override void PostMake()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostMake();
 | 
					            base.PostMake();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
 | 
					            float multipier = CumUtility.LookupCumMultiplier(this);
 | 
				
			||||||
 | 
					            CumUtility.MultiplyFluidAmountBy(pawn, multipier);
 | 
				
			||||||
            has_been_fired = true;
 | 
					            has_been_fired = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void PostAdd()
 | 
					        public override void PostAdd()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
            if (!has_been_fired) { 
 | 
					            if (!has_been_fired)
 | 
				
			||||||
                CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); 
 | 
					            {
 | 
				
			||||||
 | 
					                float multipier = CumUtility.LookupCumMultiplier(this);
 | 
				
			||||||
 | 
					                CumUtility.MultiplyFluidAmountBy(pawn, multipier);
 | 
				
			||||||
                has_been_fired = true;
 | 
					                has_been_fired = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostRemove()
 | 
					        public override void PostRemove()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            base.PostAdd();
 | 
					            base.PostAdd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (has_been_fired)
 | 
					            if (has_been_fired)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum);
 | 
					                float multipier = CumUtility.LookupCumMultiplier(this);
 | 
				
			||||||
 | 
					                CumUtility.MultiplyFluidAmountBy(pawn, 1/ multipier);
 | 
				
			||||||
                has_been_fired = false;
 | 
					                has_been_fired = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1,34 +0,0 @@
 | 
				
			||||||
namespace RJW_Genes
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public class Gene_NoCum : RJW_Gene
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        bool has_been_fired = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostMake()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            base.PostMake();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            CumUtility.MultiplyFluidAmountBy(pawn, 0f);
 | 
					 | 
				
			||||||
            has_been_fired = true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostAdd()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            base.PostAdd();
 | 
					 | 
				
			||||||
            if (!has_been_fired) { 
 | 
					 | 
				
			||||||
                CumUtility.MultiplyFluidAmountBy(pawn, 0f); 
 | 
					 | 
				
			||||||
                has_been_fired = true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostRemove()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // Cum Removal does not do at the moment :/ I would need to safe the old cum amount but I don't want to at the moment
 | 
					 | 
				
			||||||
            base.PostAdd();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,39 +0,0 @@
 | 
				
			||||||
namespace RJW_Genes
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public class Gene_VeryMuchCum : RJW_Gene
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        bool has_been_fired = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        float multiplier_much_cum = 10f;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostMake()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            base.PostMake();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum);
 | 
					 | 
				
			||||||
            has_been_fired = true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostAdd()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            base.PostAdd();
 | 
					 | 
				
			||||||
            if (!has_been_fired) { 
 | 
					 | 
				
			||||||
                CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); 
 | 
					 | 
				
			||||||
                has_been_fired = true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public override void PostRemove()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            base.PostAdd();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (has_been_fired)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum);
 | 
					 | 
				
			||||||
                has_been_fired = false;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -59,6 +59,7 @@
 | 
				
			||||||
    <Compile Include="Common\Defs\ChanceExtension.cs" />
 | 
					    <Compile Include="Common\Defs\ChanceExtension.cs" />
 | 
				
			||||||
    <Compile Include="Common\Defs\DistanceExtension.cs" />
 | 
					    <Compile Include="Common\Defs\DistanceExtension.cs" />
 | 
				
			||||||
    <Compile Include="Common\Defs\ModExtensionHelper.cs" />
 | 
					    <Compile Include="Common\Defs\ModExtensionHelper.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Common\Defs\MultiplierExtension.cs" />
 | 
				
			||||||
    <Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
 | 
					    <Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
 | 
				
			||||||
    <Compile Include="Common\Either.cs" />
 | 
					    <Compile Include="Common\Either.cs" />
 | 
				
			||||||
    <Compile Include="Common\Helpers\FactionUtility.cs" />
 | 
					    <Compile Include="Common\Helpers\FactionUtility.cs" />
 | 
				
			||||||
| 
						 | 
					@ -105,9 +106,7 @@
 | 
				
			||||||
    <Compile Include="Genes\Gender\Genes\Gene_GenderFluid.cs" />
 | 
					    <Compile Include="Genes\Gender\Genes\Gene_GenderFluid.cs" />
 | 
				
			||||||
    <Compile Include="Genes\GenitaliaSize\Gene_EvergrowingGenitalia.cs" />
 | 
					    <Compile Include="Genes\GenitaliaSize\Gene_EvergrowingGenitalia.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Cum\CumUtility.cs" />
 | 
					    <Compile Include="Genes\Cum\CumUtility.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Cum\Gene_VeryMuchCum.cs" />
 | 
					    <Compile Include="Genes\Cum\Gene_ChangeCumAmount.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Cum\Gene_MuchCum.cs" />
 | 
					 | 
				
			||||||
    <Compile Include="Genes\Cum\Gene_NoCum.cs" />
 | 
					 | 
				
			||||||
    <Compile Include="Genes\Cum\Patch_TransferNutrition.cs" />
 | 
					    <Compile Include="Genes\Cum\Patch_TransferNutrition.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Damage\Gene_Unbreakable.cs" />
 | 
					    <Compile Include="Genes\Damage\Gene_Unbreakable.cs" />
 | 
				
			||||||
    <Compile Include="Genes\Cum\Patch_CumflationImmunity.cs" />
 | 
					    <Compile Include="Genes\Cum\Patch_CumflationImmunity.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue