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
25
RJW-Quirks/Modules/Quirks/SexSelectors/BySextype.cs
Normal file
25
RJW-Quirks/Modules/Quirks/SexSelectors/BySextype.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class BySextype : SexSelector
|
||||
{
|
||||
public xxx.rjwSextype sextype = xxx.rjwSextype.None;
|
||||
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && sexProps.sexType == sextype;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (sextype == xxx.rjwSextype.None)
|
||||
{
|
||||
yield return "<sextype> is not filled or has value \"None\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class CanBeImpregnated : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && PregnancyHelper.CanImpregnate(sexProps.partner, sexProps.pawn, sexProps.sexType);
|
||||
}
|
||||
}
|
||||
9
RJW-Quirks/Modules/Quirks/SexSelectors/CanImpregnate.cs
Normal file
9
RJW-Quirks/Modules/Quirks/SexSelectors/CanImpregnate.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class CanImpregnate : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && PregnancyHelper.CanImpregnate(sexProps.pawn, sexProps.partner, sexProps.sexType);
|
||||
}
|
||||
}
|
||||
9
RJW-Quirks/Modules/Quirks/SexSelectors/Clothed.cs
Normal file
9
RJW-Quirks/Modules/Quirks/SexSelectors/Clothed.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class Clothed : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => !sexProps.pawn.apparel.PsychologicallyNude;
|
||||
}
|
||||
}
|
||||
10
RJW-Quirks/Modules/Quirks/SexSelectors/ISexSelector.cs
Normal file
10
RJW-Quirks/Modules/Quirks/SexSelectors/ISexSelector.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public interface ISexSelector : Shared.IDefPart
|
||||
{
|
||||
void SetParent(QuirkDef quirkDef);
|
||||
bool SexSatisfies(SexProps sexProps);
|
||||
}
|
||||
}
|
||||
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalAnd.cs
Normal file
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalAnd.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalAnd : LogicalMultipart
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (!parts[i].SexSatisfies(sexProps))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalMultipart.cs
Normal file
36
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalMultipart.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public abstract class LogicalMultipart : SexSelector
|
||||
{
|
||||
public List<ISexSelector> parts = new List<ISexSelector>();
|
||||
|
||||
public override void SetParent(QuirkDef quirkDef)
|
||||
{
|
||||
base.SetParent(quirkDef);
|
||||
parts.ForEach(selector => selector.SetParent(quirkDef));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (parts.Count < 2)
|
||||
{
|
||||
yield return "<parts> should have at least 2 elements";
|
||||
}
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
foreach (string error in part.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalNot.cs
Normal file
39
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalNot.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalNot : SexSelector
|
||||
{
|
||||
public ISexSelector negated;
|
||||
|
||||
public override bool SexSatisfies(SexProps sexProps) => !negated.SexSatisfies(sexProps);
|
||||
|
||||
public override void SetParent(QuirkDef quirkDef)
|
||||
{
|
||||
base.SetParent(quirkDef);
|
||||
negated.SetParent(quirkDef);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (negated == null)
|
||||
{
|
||||
yield return "<negated> is empty";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string error in negated.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalOr.cs
Normal file
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalOr.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalOr : LogicalMultipart
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (parts[i].SexSatisfies(sexProps))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
RJW-Quirks/Modules/Quirks/SexSelectors/Seen.cs
Normal file
23
RJW-Quirks/Modules/Quirks/SexSelectors/Seen.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class Seen : SexSelector
|
||||
{
|
||||
// Current implementation works only if somebody sees pawn exactly at the moment quirks are evaluated
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && SexSeen(sexProps);
|
||||
|
||||
public static bool SexSeen(SexProps sexProps)
|
||||
{
|
||||
bool isZoophile = xxx.is_zoophile(sexProps.pawn);
|
||||
return sexProps.pawn.Map.mapPawns.AllPawnsSpawned.Any(x =>
|
||||
x != sexProps.pawn
|
||||
&& x != sexProps.partner
|
||||
&& !x.Dead
|
||||
&& (isZoophile || !xxx.is_animal(x))
|
||||
&& x.CanSee(sexProps.pawn));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
RJW-Quirks/Modules/Quirks/SexSelectors/SexSelector.cs
Normal file
19
RJW-Quirks/Modules/Quirks/SexSelectors/SexSelector.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public abstract class SexSelector : ISexSelector
|
||||
{
|
||||
protected QuirkDef parentDef;
|
||||
|
||||
public abstract bool SexSatisfies(SexProps sexProps);
|
||||
|
||||
public virtual void SetParent(QuirkDef quirkDef) => parentDef = quirkDef;
|
||||
|
||||
public virtual IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class WithPreferedPartner : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && parentDef.partnerPreference?.PartnerSatisfies(sexProps.pawn, sexProps.partner) == true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue