mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added a simple social worker for aphrodisiac genes, closes #50
This commit is contained in:
parent
996831269d
commit
65f74e7369
6 changed files with 86 additions and 2 deletions
|
@ -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:**
|
||||
|
||||
|
|
18
Common/Defs/ThoughtDefs/Thoughts_Special.xml
Normal file
18
Common/Defs/ThoughtDefs/Thoughts_Special.xml
Normal 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>
|
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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" />
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue