mirror of
https://gitgud.io/LonelyRain/rjw-quirks.git
synced 2024-08-15 00:03:31 +00:00
Initial upload
This commit is contained in:
parent
feb28b10a4
commit
7585da099c
106 changed files with 4860 additions and 0 deletions
71
RJW-Quirks/Modules/Interactions/QuirksPartKindUsageRule.cs
Normal file
71
RJW-Quirks/Modules/Interactions/QuirksPartKindUsageRule.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using rjw.Modules.Interactions.Contexts;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using rjw.Modules.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Interactions
|
||||
{
|
||||
public class QuirksPartKindUsageRule : IPartPreferenceRule
|
||||
{
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
|
||||
{
|
||||
return Enumerable.Concat(
|
||||
ModifierFromPawnQuirks(context.Internals.Dominant, context.Internals.Submissive),
|
||||
ModifierFromPartnerQuirks(context.Internals.Submissive, context.Internals.Dominant)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
|
||||
{
|
||||
return Enumerable.Concat(
|
||||
ModifierFromPawnQuirks(context.Internals.Submissive, context.Internals.Dominant),
|
||||
ModifierFromPartnerQuirks(context.Internals.Dominant, context.Internals.Submissive)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What pawn wants to use because of quirks
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> ModifierFromPawnQuirks(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
foreach (var comp in GetQuirkComps(quirkOwner.Pawn))
|
||||
{
|
||||
foreach (var rule in comp.GetModifiersForPawn(quirkOwner, partner))
|
||||
{
|
||||
yield return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What pawn want from partner because of pawn's quirks
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> ModifierFromPartnerQuirks(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
foreach (var comp in GetQuirkComps(quirkOwner.Pawn))
|
||||
{
|
||||
foreach (var rule in comp.GetModifiersForPartner(quirkOwner, partner))
|
||||
{
|
||||
yield return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Quirks.Comps.PartKindUsageRules> GetQuirkComps(Pawn pawn)
|
||||
{
|
||||
foreach (var comp in pawn.GetQuirks().AllQuirks.SelectMany(quirk => quirk.def.GetComps<Quirks.Comps.PartKindUsageRules>()))
|
||||
{
|
||||
yield return comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue