Added a simple social worker for aphrodisiac genes, closes #50

This commit is contained in:
Vegapnk 2023-10-22 16:25:52 +02:00
parent 996831269d
commit 65f74e7369
6 changed files with 86 additions and 2 deletions

View File

@ -3,13 +3,14 @@
**Changes**
- Added patches for Alpha-Genes Animusen, Drakonori and Malachai (Closes #65, thanks @Stars22223)
- Little Social Boost for Pawns affected by pheromones (Closes #50)
**Fixes:**
- XML Missmatch for Succubus Letter (Fixed in #64, thanks @mwcrow)
- Made constructor for Empathetic Lifeforce explicitly `public` to not hang up in character creation (Fixes #66)
# 1.3.0
# 1.3.0 (19-09-2023)
**Changes:**

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThoughtDef>
<defName>rjw_genes_pheromone_carrier_nearby</defName>
<thoughtClass>Thought_SituationalSocial</thoughtClass>
<workerClass>RJW_Genes.ThoughtWorker_Aphrodisiac_Pheromones_Social</workerClass>
<stages>
<li>
<label>Pheromones</label>
<description>{0} has a special vibe, we should hang out more often.</description>
<baseOpinionOffset>+3</baseOpinionOffset>
</li>
</stages>
</ThoughtDef>
</Defs>

View File

@ -11,7 +11,7 @@ namespace RJW_Genes
// This means that adding +.25 equals 1.5h of Libido.
// Tick Speed is hence set to 0.5h
const int APHRODISIAC_DISTANCE_FALLBACK = 25;
public const int APHRODISIAC_DISTANCE_FALLBACK = 25;
const int TICK_INTERVAL_FALLBACK = 60000 / 48 ; // 60k = 1 day, we want 0.5h which is 1/48th of 1 day.
const float SEXFREQ_THRESHOLD = 0.5f;
@ -83,6 +83,8 @@ namespace RJW_Genes
aphrodisiac = HediffMaker.MakeHediff(HediffDefOf.rjw_genes_aphrodisiac_pheromone, pawn);
aphrodisiac.Severity = 0.5f;
pawn.health.AddHediff(aphrodisiac);
}
}

View File

@ -0,0 +1,60 @@
using RimWorld;
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_Aphrodisiac_Pheromones_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;
if (!RelationsUtility.PawnsKnowEachOther(pawn, other))
return (ThoughtState)false;
// If the pawn is not on Map (e.g. caravan), no mali
if (!HiveUtility.PawnIsOnHomeMap(pawn))
return (ThoughtState)false;
// Do nothing for pawns that also have pheromones
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
return (ThoughtState)false;
// Actual Logic:
// Pawn qualifies in right distance and needs line of sight.
var pos = other.Position;
int effectDistance = ModExtensionHelper.GetDistanceFromModExtension(GeneDefOf.rjw_genes_aphrodisiac_pheromones, Gene_Aphrodisiac_Pheromones.APHRODISIAC_DISTANCE_FALLBACK);
if (pos.DistanceTo(pawn.Position) < effectDistance && GenSight.LineOfSight(pos, pawn.Position, pawn.Map))
{
return (ThoughtState)true;
}
return (ThoughtState)false;
}
}
}

View File

@ -153,6 +153,7 @@
<Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" />
<Compile Include="Genes\Special\Patches\Patch_HormonalSaliva.cs" />
<Compile Include="Genes\Special\Patches\Patch_OrgasmMytosis.cs" />
<Compile Include="Genes\Special\Thoughts\ThoughtWorker_Aphrodisiac_Pheromones_Social.cs" />
<Compile Include="Interactions\SuccubusTailjob\CompAbility_SexInteractionRequirements.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_PussyHeal.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityLifeForceCost.cs" />

View File

@ -13,6 +13,8 @@ namespace RJW_Genes
public static readonly ThoughtDef rjw_genes_cock_eaten;
public static readonly ThoughtDef rjw_genes_seduced;
public static readonly ThoughtDef rjw_genes_pheromone_carrier_nearby;
//Others with same names but other defs than in genedefof
public static readonly InteractionDef rjw_genes_flirt;
}