Merge pull request #13 from Shabakur/main

Racesupport compatibility, settings and aphrodisiac pheromones
This commit is contained in:
vegapnk 2023-01-15 16:44:01 +01:00 committed by GitHub
commit 0203cd92a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 197 additions and 25 deletions

Binary file not shown.

View File

@ -10,6 +10,7 @@
<iconPath>UI/Memes/FleshPurity</iconPath>
<displayOrderInCategory>1</displayOrderInCategory>
</GeneDef>
<GeneDef>
<defName>rjw_genes_youth_fountain</defName>
@ -33,4 +34,16 @@
<displayOrderInCategory>3</displayOrderInCategory>
</GeneDef>
<GeneDef>
<defName>rjw_genes_aphrodisiac_pheromones</defName>
<label>Aphrodisiac Pheromones</label>
<displayCategory>rjw_genes_special</displayCategory>
<geneClass>RJW_Genes.Gene_Aphrodisiac_Pheromones</geneClass>
<description>Pheremones of this pawn induce an incressed sexdrive to others nearby.</description>
<iconPath>UI/Memes/FleshPurity</iconPath>
<displayOrderInCategory>4</displayOrderInCategory>
<biostatCpx>1</biostatCpx>
<biostatMet>1</biostatMet>
</GeneDef>
</Defs>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--all pregnancies-->
<Defs>
<HediffDef>
<defName>Aphrodisiac_Pheromone</defName>
<hediffClass>HediffWithComps</hediffClass>
<label>induced libido</label>
<description>Aphrodisiac pheromone effects.</description>
<defaultLabelColor>(1,0,0.5)</defaultLabelColor>
<scenarioCanAdd>true</scenarioCanAdd>
<maxSeverity>1.0</maxSeverity>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-4.0</severityPerDay>
</li>
</comps>
<stages>
<li>
<becomeVisible>false</becomeVisible>
<statOffsets>
<SexFrequency>2</SexFrequency>
</statOffsets>
</li>
</stages>
</HediffDef>
</Defs>

View File

@ -2,7 +2,12 @@
<Defs>
<RJW_BGS.RaceGeneDef Name = "Canine">
<defName>Canine</defName>
<raceGroup>Canine_Group</raceGroup>
<raceGroups>
<li>Canine_Group</li>
<li>CanineAnimal</li>
<li>CanineSingleGenderAnimal</li>
<li>CanineSkinAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Ears_Floppy</defName>
@ -38,7 +43,11 @@
<RJW_BGS.RaceGeneDef>
<defName>Insect</defName>
<raceGroup>Insect_Group</raceGroup>
<raceGroups>
<li>Insect_Group</li>
<li>ArthropodOvipositorAnimal</li>
<li>ArthropodOvipositorHornyAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Beauty_Ugly</defName>
@ -73,7 +82,14 @@
<RJW_BGS.RaceGeneDef>
<defName>Feline</defName>
<raceGroup>Feline_Group</raceGroup>
<raceGroups>
<li>Feline_Group</li>
<li>FelineAnimal</li>
<li>FelineHornyAnimal</li>
<li>FelineSingleGenderAnimal</li>
<li>AA_SandProwlerAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Tail_Furry</defName>
@ -108,7 +124,10 @@
<RJW_BGS.RaceGeneDef>
<defName>Equine</defName>
<raceGroup>Equine_Group</raceGroup>
<raceGroups>
<li>Equine_Group</li>
<li>HorseAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>
@ -143,7 +162,12 @@
<RJW_BGS.RaceGeneDef>
<defName>Dragon</defName>
<raceGroup>Dragon_Group</raceGroup>
<raceGroups>
<li>Dragon_Group</li>
<li>ThrumboAnimal</li>
<li>DragonAnimal</li>
<li>DragonSingleGenderAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Unstoppable</defName>
@ -166,7 +190,7 @@
<chance>0.1</chance>
</li>
<li>
<defName>rjw_genes_draconic_genitalia</defName>
<defName>rjw_genes_dragon_genitalia</defName>
<chance>0.6</chance>
</li>
<li>
@ -190,7 +214,12 @@
<RJW_BGS.RaceGeneDef>
<defName>Rodent</defName>
<raceGroup>Rodent_Group</raceGroup>
<raceGroups>
<li>Rodent_Group</li>
<li>RodentAnimal</li>
<li>RodentSingleGenderAnimal</li>
<li>DragonSingleGenderAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>
@ -225,7 +254,10 @@
<RJW_BGS.RaceGeneDef>
<defName>Racoon</defName>
<raceGroup>Raccon_Group</raceGroup>
<raceGroups>
<li>Raccon_Group</li>
<li>RaccoonAnimal</li>
</raceGroups>
<genes>
<li>
<defName>Furskin</defName>

View File

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
<Defs>
<!-- this is to disable the xml, remove it for your own xml
<RJW_BGS.RaceGeneDef>
<defName>Canine</defName>
defName can be anything you want, as long as it is unique
<raceGroup>Canine_Group</raceGroup>
RJW.Racegroupdef, all animals in the raceGroup will be part of this group, RJW race support uses this so those can be used to quickly add a group
<raceGroups>
<li>Canine_Group</li>
<li>CanineAnimal</li> from racesupport
<li>CanineSingleGenderAnimal</li> from racesupport
<li>CanineSkinAnimal</li> from racesupport
</raceGroups>
RJW.Racegroupdef, all animals in the added raceGroups will be part of this group, RJW race support uses other defnames and overwrite vanilla ones, so add them to if you use it.
<raceNames>
<li> </li>
@ -38,10 +43,10 @@
For each gene you need to find the defname and give it a chance to appear. Each gene is rolled independently.
</RJW_BGS.RaceGeneDef>
-->
this is to disable the xml, remove it for your own xml -->
<!-- You can use parents to have animals get specific genes in addition to the group. So warg children will have a chance for Ears_Floppy, rjw_genes_slime_genitalia and StrongStomach
<!-- this is to disable the xml, remove it for your own xml
You can use parents to have animals get specific genes in addition to the group. So warg children will have a chance for Ears_Floppy, rjw_genes_slime_genitalia and StrongStomach
<RJW_BGS.RaceGeneDef ParentName = "Canine">
<defName>Warg</defName>
<raceNames>
@ -54,5 +59,7 @@
</li>
</genes>
</RJW_BGS.RaceGeneDef>
-->
this is to disable the xml, remove it for your own xml -->
</Defs>

View File

@ -48,7 +48,7 @@ namespace RJW_BGS
{
foreach (BestialityGeneInheritanceDef gene in raceGeneDef.genes)
{
if (gene.chance >= Rand.Range(0.01f,1f))
if (gene.chance * RJW_BGSSettings.global_gene_chance >= Rand.Range(0.01f,1f))
{
genelist.Add(DefDatabase<GeneDef>.GetNamed(gene.defName));
}
@ -65,8 +65,13 @@ namespace RJW_BGS
}
}
//For ParchRJWHediffInsect_egg
public static void NewGenes(Pawn mother, Pawn dad, Pawn baby)
{
if (!RJW_BGSSettings.enabled)
{
return;
}
if (baby.RaceProps.Humanlike)
{
if (baby.genes == null)

View File

@ -16,6 +16,10 @@ namespace RJW_BGS
[HarmonyPostfix]
public static void AddGenes(Pawn mother, Pawn dad, ref Hediff_BasePregnancy __instance)
{
if (!RJW_BGSSettings.enabled)
{
return;
}
foreach (Pawn baby in __instance.babies)
{
if (baby.RaceProps.Humanlike)

View File

@ -22,6 +22,10 @@ namespace RJW_BGS
[HarmonyPostfix]
public static void AnimalInheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
{
if (!RJW_BGSSettings.enabled)
{
return;
}
List<GeneDef> genes = InheritanceUtility.AnimalInheritedGenes(father, mother);
if (genes.Any())
{

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Verse;
using UnityEngine;
namespace RJW_Genes.Animal_Inheritance
namespace RJW_BGS
{
public class RJW_BGSSettings : ModSettings
{
@ -23,6 +23,10 @@ namespace RJW_Genes.Animal_Inheritance
listing_Standard.Gap(24f);
listing_Standard.CheckboxLabeled("enabled", ref enabled, "no function yet", 0f, 1f);
//listing_Standard.CheckboxLabeled("sexfrenzy", ref sexfrenzy, "disable the effects", 0f, 1f);
listing_Standard.Gap(5f);
listing_Standard.Label("gene inheritance chance"+ ": " +
Math.Round((double)(RJW_BGSSettings.global_gene_chance * 100f), 0).ToString() + "%", -1f, "modify chance for a gene to be inherited.");
RJW_BGSSettings.global_gene_chance = listing_Standard.Slider(RJW_BGSSettings.global_gene_chance, 0f, 5f);
listing_Standard.End();
}
@ -30,8 +34,10 @@ namespace RJW_Genes.Animal_Inheritance
{
base.ExposeData();
Scribe_Values.Look<bool>(ref RJW_BGSSettings.enabled, "enabled", RJW_BGSSettings.enabled, true);
Scribe_Values.Look<float>(ref RJW_BGSSettings.global_gene_chance, "global_gene_chance", RJW_BGSSettings.global_gene_chance, true);
}
public static bool enabled;
public static float global_gene_chance = 1f;
public static bool enabled = true;
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Verse;
using UnityEngine;
namespace RJW_Genes.Animal_Inheritance
namespace RJW_BGS
{
public class RJW_BGSSettingsController : Mod
{

View File

@ -11,11 +11,11 @@ namespace RJW_BGS
public class RaceGeneDef : Def
{
public int priority;
public String raceGroup;
public string raceGroup; //keeping this for backwards compatibility
public List<string> raceGroups; //racegroup, but in list form so multiple can be entered, preference to use this over racegroup
public List<string> raceNames;
public List<string> pawnKindNames;
public List<BestialityGeneInheritanceDef> genes;
//public List<float> genechances;
public String hybridName;
}
}

View File

@ -55,8 +55,10 @@ namespace RJW_BGS
{
raceGroupDefs = allDefs.Where(delegate (RaceGeneDef group)
{
String raceGroupDefName = group.raceGroup;
return raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName;
string raceGroupDefName = group.raceGroup;
List<string> list_raceGroupDefName = group.raceGroups;
return (raceGroupDefName != null && raceGroupDefName == raceGroupDef.defName)
|| (list_raceGroupDefName != null && list_raceGroupDefName.Contains(raceGroupDef.defName));
}).ToList<RaceGeneDef>();
}

View File

@ -75,8 +75,9 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_orgasm_rush;
public static readonly GeneDef rjw_genes_youth_fountain;
public static readonly GeneDef rjw_genes_sex_age_drain;
public static readonly GeneDef rjw_genes_aphrodisiac_pheromones;
// Others & Non-Genes
public static readonly HediffDef rjw_genes_orgasm_rush_hediff;
}
}

View File

@ -0,0 +1,53 @@
using HarmonyLib;
using rjw;
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 Gene_Aphrodisiac_Pheromones : Gene
{
public override void Tick()
{
base.Tick();
if (this.pawn.IsHashIntervalTick(2500))
{
foreach (Pawn pawn in this.AffectedPawns(this.pawn.Position, this.pawn.Map))
{
this.InduceAphrodisiac(pawn);
}
}
}
private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map)
{
foreach (Pawn pawn in map.mapPawns.AllPawns)
{
if (pos.DistanceTo(pawn.Position) < 5)
{
yield return pawn;
}
}
//IEnumerator<Pawn> enumerator = null;
yield break;
}
private void InduceAphrodisiac(Pawn pawn)
{
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone);
if (hediff != null)
{
hediff.Severity = 1f;
}
else
{
pawn.health.AddHediff(HediffDefOf.Aphrodisiac_Pheromone);
}
}
}
}

16
Source/HediffDefOf.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJW_Genes
{
[DefOf]
public static class HediffDefOf
{
public static readonly HediffDef Aphrodisiac_Pheromone;
}
}

View File

@ -116,8 +116,10 @@
<Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
<Compile Include="Genes\RJW_Gene.cs" />
<Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
<Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" />
<Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
<Compile Include="HarmonyInit.cs" />
<Compile Include="HediffDefOf.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RJW_Genes.cs" />
</ItemGroup>