mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Restructuring, some sorting into folders
This commit is contained in:
parent
ac1fdc99be
commit
31e96bd5e3
36 changed files with 80 additions and 65 deletions
|
@ -0,0 +1,23 @@
|
|||
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 CompAbility_SexInteractionRequirements : AbilityComp
|
||||
{
|
||||
public CompProperties_SexInteractionRequirements Props
|
||||
{
|
||||
get
|
||||
{
|
||||
return (CompProperties_SexInteractionRequirements)this.props;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Defs.DefFragment;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
public class CompProperties_SexInteractionRequirements : AbilityCompProperties
|
||||
{
|
||||
public CompProperties_SexInteractionRequirements()
|
||||
{
|
||||
this.compClass = typeof(CompAbility_SexInteractionRequirements);
|
||||
}
|
||||
|
||||
public List<InteractionTag> tags = new List<InteractionTag>();
|
||||
public InteractionRequirement dominantRequirement;
|
||||
public InteractionRequirement submissiveRequirement;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Interactions.Helpers;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Implementation;
|
||||
using rjw.Modules.Interactions.Defs.DefFragment;
|
||||
namespace RJW_Genes
|
||||
{
|
||||
public class CustomSexInteraction_Helper
|
||||
{
|
||||
public static List<InteractionDef> GenerateInteractionDefList(Pawn pawn, Pawn pawn2, CompProperties_SexInteractionRequirements sexpropsreq)
|
||||
{
|
||||
List<InteractionTag> tags = new List<InteractionTag>();
|
||||
if (pawn2.IsAnimal())
|
||||
{
|
||||
tags.Add(InteractionTag.Animal);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
tags = sexpropsreq.tags;
|
||||
}
|
||||
|
||||
InteractionRequirement dominantRequirement = sexpropsreq.dominantRequirement;
|
||||
InteractionRequirement submissiveRequirement = sexpropsreq.submissiveRequirement;
|
||||
List<InteractionDef> list = new List<InteractionDef>();
|
||||
//List<InteractionDef> a = from interaction in sexinteractions
|
||||
//where InteractionHelper.GetWithExtension(interaction).DominantHasFamily(dominantRequirement.families.)
|
||||
// select interaction;
|
||||
|
||||
//should use where select but dont fully understand that, so I am using this.
|
||||
foreach (InteractionDef interactionDef in SexUtility.SexInterractions)
|
||||
{
|
||||
//Use rjw function to check if the interaction would be valid
|
||||
if (!LewdInteractionValidatorService.Instance.IsValid(interactionDef, pawn, pawn2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
InteractionWithExtension withExtension = InteractionHelper.GetWithExtension(interactionDef);
|
||||
bool add_interaction = false;
|
||||
//only add interactions which have a correct tag
|
||||
foreach (InteractionTag tag in tags)
|
||||
{
|
||||
if (withExtension.HasInteractionTag(tag))
|
||||
{
|
||||
add_interaction = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//In case of failure go to next interaction
|
||||
if (!add_interaction)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//goes to next interaction if it doesn't have the required genitals
|
||||
if (dominantRequirement != null)
|
||||
{
|
||||
foreach (GenitalFamily genitalFamily in dominantRequirement.families)
|
||||
{
|
||||
if (!withExtension.DominantHasFamily(genitalFamily))
|
||||
{
|
||||
add_interaction = false;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if (!add_interaction)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach (GenitalTag tag in dominantRequirement.tags)
|
||||
{
|
||||
if (!withExtension.DominantHasTag(tag))
|
||||
{
|
||||
add_interaction = false;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//goes to next interaction if it doesn't have the required genitals
|
||||
if (submissiveRequirement != null)
|
||||
{
|
||||
foreach (GenitalFamily genitalFamily in submissiveRequirement.families)
|
||||
{
|
||||
if (!withExtension.SubmissiveHasFamily(genitalFamily))
|
||||
{
|
||||
add_interaction = false;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if (!add_interaction)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach (GenitalTag tag in submissiveRequirement.tags)
|
||||
{
|
||||
if (!withExtension.SubmissiveHasTag(tag))
|
||||
{
|
||||
add_interaction = false;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (add_interaction)
|
||||
{
|
||||
list.Add(interactionDef);
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//Generates a valid interaction for the requirements and assigns sexprops based on that
|
||||
public static SexProps GenerateSexProps(Pawn pawn, Pawn pawn2, CompProperties_SexInteractionRequirements sexpropsreq)
|
||||
{
|
||||
List<InteractionDef> interactionlist = GenerateInteractionDefList(pawn, pawn2, sexpropsreq);
|
||||
if (!interactionlist.Any())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
InteractionDef dictionaryKey = interactionlist.RandomElement();
|
||||
bool rape = InteractionHelper.GetWithExtension(dictionaryKey).HasInteractionTag(InteractionTag.Rape);
|
||||
SexProps sexProps = new SexProps();
|
||||
sexProps.pawn = pawn;
|
||||
sexProps.partner = pawn2;
|
||||
sexProps.sexType = SexUtility.rjwSextypeGet(dictionaryKey);
|
||||
sexProps.isRape = rape;
|
||||
sexProps.isRapist = rape;
|
||||
sexProps.canBeGuilty = false;
|
||||
sexProps.dictionaryKey = dictionaryKey;
|
||||
sexProps.rulePack = SexUtility.SexRulePackGet(dictionaryKey);
|
||||
return sexProps;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw.Modules.Interactions;
|
||||
using rjw.Modules.Interactions.Internals.Implementation;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
|
||||
//Modefied code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/
|
||||
namespace RJW_Genes
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public class DomSuccubusTailCustomRequirementHandler : ICustomRequirementHandler
|
||||
{
|
||||
public string HandlerKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return "DomSuccubusTailCustomRequirementHandler";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static DomSuccubusTailCustomRequirementHandler()
|
||||
{
|
||||
Register();
|
||||
}
|
||||
public static void Register()
|
||||
{
|
||||
InteractionRequirementService.CustomRequirementHandlers.Add(new DomSuccubusTailCustomRequirementHandler());
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message("DomSuccubusTailCustomRequirementHandler registered: ");
|
||||
}
|
||||
}
|
||||
|
||||
public bool FufillRequirements(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive)
|
||||
{
|
||||
if (GeneUtility.HasGeneNullCheck(dominant.Pawn, GeneDefOf.rjw_genes_succubus_tail))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("DomSuccubusTailFilter");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Contexts;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using rjw.Modules.Shared;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes.Interactions
|
||||
{
|
||||
//Summary//
|
||||
//Set custom preferences for pawn. Gets integrated into rjw by AddtoIPartPreferenceRule in First
|
||||
//Depending on the level of lifeforce increase the chance for using the mouth.
|
||||
public class GenesPartKindUsageRule : IPartPreferenceRule
|
||||
{
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
|
||||
{
|
||||
Pawn pawn = context.Internals.Dominant.Pawn;
|
||||
Gene_LifeForce gene = pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
|
||||
if (gene != null)
|
||||
{
|
||||
float weight = 2f;
|
||||
if (gene.Value < gene.MinLevelForAlert)
|
||||
{
|
||||
weight *= 10;
|
||||
}
|
||||
else if (gene.Value < gene.targetValue)
|
||||
{
|
||||
weight *= 2.5f;
|
||||
}
|
||||
if (pawn.genes.HasGene(GeneDefOf.rjw_genes_cum_eater))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Mouth);
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Beak);
|
||||
}
|
||||
|
||||
if (pawn.genes.HasGene(GeneDefOf.rjw_genes_vaginal_absorber))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Vagina);
|
||||
}
|
||||
if (pawn.genes.HasGene(GeneDefOf.rjw_genes_anal_absorber))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Anus);
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
|
||||
{
|
||||
Pawn pawn = context.Internals.Dominant.Pawn;
|
||||
Gene_LifeForce gene = pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
|
||||
if (gene != null)
|
||||
{
|
||||
float weight = 2f;
|
||||
if (gene.Value < gene.MinLevelForAlert)
|
||||
{
|
||||
weight *= 10;
|
||||
}
|
||||
else if (gene.Value < gene.targetValue)
|
||||
{
|
||||
weight *= 2.5f;
|
||||
}
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Mouth);
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Beak);
|
||||
if (pawn.genes.HasGene(GeneDefOf.rjw_genes_vaginal_absorber))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Vagina);
|
||||
}
|
||||
if (pawn.genes.HasGene(GeneDefOf.rjw_genes_anal_absorber))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Anus);
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
using Verse;
|
||||
using rjw.Modules.Interactions;
|
||||
using rjw.Modules.Interactions.Internals.Implementation;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
|
||||
//Modified code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/
|
||||
namespace RJW_Genes
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public class SubSuccubusTailCustomRequirementHandler : ICustomRequirementHandler
|
||||
{
|
||||
public string HandlerKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return "SubSuccubusTailCustomRequirementHandler";
|
||||
}
|
||||
}
|
||||
|
||||
static SubSuccubusTailCustomRequirementHandler()
|
||||
{
|
||||
Register();
|
||||
}
|
||||
public static void Register()
|
||||
{
|
||||
InteractionRequirementService.CustomRequirementHandlers.Add(new SubSuccubusTailCustomRequirementHandler());
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
Log.Message("SubSuccubusTailCustomRequirementHandler registered: ");
|
||||
}
|
||||
}
|
||||
|
||||
public bool FufillRequirements(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive)
|
||||
{
|
||||
if (GeneUtility.HasGeneNullCheck(submissive.Pawn, GeneDefOf.rjw_genes_succubus_tail))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("SubSuccubusTailFilter");
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue