mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Using new ModExtensions for AphrodisiacPheromone
This commit is contained in:
parent
132344b294
commit
7c22dcd348
3 changed files with 19 additions and 5 deletions
|
@ -274,7 +274,6 @@
|
|||
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
|
||||
</li>
|
||||
<li Class="RJW_Genes.LifeForceEmpathExtension">
|
||||
<empathDistance>25</empathDistance>
|
||||
<aheagoIncrement>0.02</aheagoIncrement>
|
||||
<satisfactionIncrement>0.01</satisfactionIncrement>
|
||||
<frustratedDecrement>-0.01</frustratedDecrement>
|
||||
|
|
|
@ -65,6 +65,17 @@
|
|||
<displayOrderInCategory>4</displayOrderInCategory>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<biostatMet>1</biostatMet>
|
||||
|
||||
<modExtensions>
|
||||
<li Class="RJW_Genes.TickIntervalExtension">
|
||||
<!-- One day has 60k ticks, so we check every hour with 60000/48 = 1250-->
|
||||
<tickInterval>1250</tickInterval>
|
||||
</li>
|
||||
<li Class="RJW_Genes.DistanceExtension">
|
||||
<!-- distance 25 means 25 tiles in every direction from the pheromone-pawn.-->
|
||||
<distance>25</distance>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef ParentName="SpecialBase">
|
||||
|
|
|
@ -11,8 +11,8 @@ 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 = 25;
|
||||
const int TICK_INTERVAL = 60000 / 48 ; // 60k = 1 day, we want 0.5h which is 1/48th of 1 day.
|
||||
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;
|
||||
|
||||
|
@ -20,7 +20,10 @@ namespace RJW_Genes
|
|||
public override void Tick()
|
||||
{
|
||||
base.Tick();
|
||||
if (this.pawn.IsHashIntervalTick(TICK_INTERVAL) && this.pawn.Map != null)
|
||||
|
||||
int tickInterval = ModExtensionHelper.GetTickIntervalFromModExtension(GeneDefOf.rjw_genes_aphrodisiac_pheromones, TICK_INTERVAL_FALLBACK);
|
||||
|
||||
if (this.pawn.IsHashIntervalTick(tickInterval) && this.pawn.Map != null)
|
||||
{
|
||||
// Only spread pheromones if sexdrive above 1
|
||||
float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency"));
|
||||
|
@ -57,7 +60,8 @@ namespace RJW_Genes
|
|||
|
||||
// Actual Logic:
|
||||
// Pawn qualifies in right distance and needs line of sight.
|
||||
if (pos.DistanceTo(pawn.Position) < APHRODISIAC_DISTANCE && GenSight.LineOfSight(pos, pawn.Position, pawn.Map))
|
||||
int effectDistance = ModExtensionHelper.GetDistanceFromModExtension(GeneDefOf.rjw_genes_aphrodisiac_pheromones, APHRODISIAC_DISTANCE_FALLBACK);
|
||||
if (pos.DistanceTo(pawn.Position) < effectDistance && GenSight.LineOfSight(pos, pawn.Position, pawn.Map))
|
||||
{
|
||||
yield return pawn;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue