diff --git a/Common/Defs/ThoughtDefs/Thoughts_Disease.xml b/Common/Defs/ThoughtDefs/Thoughts_Disease.xml new file mode 100644 index 0000000..d0721ee --- /dev/null +++ b/Common/Defs/ThoughtDefs/Thoughts_Disease.xml @@ -0,0 +1,27 @@ + + + + + + rjw_genes_appealing_cock + Thought_SituationalSocial + RJW_Genes.ThoughtWorker_SizeBlinded_Social + true + + +
  • + + -10 +
  • +
  • + + 10 +
  • +
  • + + 20 +
  • +
    +
    + +
    diff --git a/Source/Genes/Diseases/Thoughts/ThoughtWorker_SizeBlinded_Social.cs b/Source/Genes/Diseases/Thoughts/ThoughtWorker_SizeBlinded_Social.cs new file mode 100644 index 0000000..4019b0d --- /dev/null +++ b/Source/Genes/Diseases/Thoughts/ThoughtWorker_SizeBlinded_Social.cs @@ -0,0 +1,68 @@ +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Verse; + +namespace RJW_Genes +{ + public class ThoughtWorker_SizeBlinded_Social : ThoughtWorker + { + protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other) + { + // Return for trivial errors + if (pawn == null || other == null || pawn == other) + return (ThoughtState)false; + // Check for position-existance + if (pawn.Position == null || other.Position == null || pawn.Map == null || other.Map == null) + return (ThoughtState)false; + // Do nothing if pawn is carried + if (pawn.CarriedBy != null) + return (ThoughtState)false; + // Do nothing if Pawn is Baby or Child (#25) + if (!pawn.ageTracker.Adult) + return (ThoughtState)false; + // Only check if they are spawned humans + if (!pawn.Spawned || !other.Spawned) + return (ThoughtState)false; + if (!pawn.RaceProps.Humanlike) + return (ThoughtState)false; + if (!other.RaceProps.Humanlike) + return (ThoughtState)false; + + // Pawns that have not "met" wont give each other Mali + // Known-Each-Other is a key-word for Rimworld that shows they have had any interaction and stored each other in relations. + if (!RelationsUtility.PawnsKnowEachOther(pawn, other)) + return (ThoughtState)false; + // If the pawn is not on Map (e.g. caravan), no mali + if (!MapUtility.PawnIsOnHomeMap(pawn)) + return (ThoughtState)false; + + //ModLog.Debug($"ThoughtWorker Checks Size Blinded {pawn} -> {other}"); + + // Do nothing if there is no size-blinded involved + if (!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_size_blinded)) + return (ThoughtState)false; + else + ModLog.Debug($"{pawn} has the size blinded gene"); + + // Iff the pawn has a penis, retrieve it's size. + var penis = GenitaliaUtility.GetBiggestPenis(other); + // Do Nothing if the other pawn has no penis + if (penis == null) return (ThoughtState)false; + var bodysize = GenitaliaUtility.GetBodySizeOfSexPart(penis); + + if (penis.Severity + (bodysize) - 1.0 > 1.0) + return ThoughtState.ActiveAtStage(2); + else if (penis.Severity >= 0.8f) + return ThoughtState.ActiveAtStage(1); + else + return ThoughtState.ActiveAtStage(0); + + } + } +} diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index e467c9a..51b80a1 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -79,6 +79,7 @@ + diff --git a/Source/ThoughtDefOf.cs b/Source/ThoughtDefOf.cs index f884d4a..50f2a00 100644 --- a/Source/ThoughtDefOf.cs +++ b/Source/ThoughtDefOf.cs @@ -15,6 +15,8 @@ namespace RJW_Genes public static readonly ThoughtDef rjw_genes_pheromone_carrier_nearby; + public static readonly ThoughtDef rjw_genes_appealing_cock; + //Others with same names but other defs than in genedefof public static readonly InteractionDef rjw_genes_flirt; }