mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
09157e923d
Fertilin and all subgenes are only active if pawn is old enough to have sex, 13 if rjw teensex is enabled else 18. Added a fertilindraingene which greatly increases fertilin burn, but gives a lot of metabolic efficiency Also moved a few files into subfolders.
79 lines
1.4 KiB
C#
79 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Verse;
|
|
using RimWorld;
|
|
|
|
namespace RJW_Genes
|
|
{
|
|
public class Gene_LifeForceDrain : Gene, IGeneResourceDrain
|
|
{
|
|
public Gene_Resource Resource
|
|
{
|
|
get
|
|
{
|
|
if (this.cachedLifeForceGene == null || !this.cachedLifeForceGene.Active)
|
|
{
|
|
this.cachedLifeForceGene = this.pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
|
|
}
|
|
return this.cachedLifeForceGene;
|
|
}
|
|
}
|
|
|
|
public bool CanOffset
|
|
{
|
|
get
|
|
{
|
|
return this.Active && this.Resource != null && this.Resource.Active;
|
|
}
|
|
}
|
|
|
|
public float ResourceLossPerDay
|
|
{
|
|
get
|
|
{
|
|
return this.def.resourceLossPerDay;
|
|
}
|
|
}
|
|
|
|
public Pawn Pawn
|
|
{
|
|
get
|
|
{
|
|
return this.pawn;
|
|
}
|
|
}
|
|
|
|
public string DisplayLabel
|
|
{
|
|
get
|
|
{
|
|
return this.Label + " (" + "Gene".Translate() + ")";
|
|
}
|
|
}
|
|
|
|
public override void Tick()
|
|
{
|
|
base.Tick();
|
|
if (this.CanOffset && this.Resource != null)
|
|
{
|
|
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000);
|
|
}
|
|
}
|
|
|
|
public override IEnumerable<Gizmo> GetGizmos()
|
|
{
|
|
foreach (Gizmo gizmo in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
|
|
{
|
|
yield return gizmo;
|
|
}
|
|
IEnumerator<Gizmo> enumerator = null;
|
|
yield break;
|
|
yield break;
|
|
}
|
|
|
|
[Unsaved(false)]
|
|
private Gene_LifeForce cachedLifeForceGene;
|
|
|
|
private const float MinAgeForDrain = 3f;
|
|
}
|
|
}
|