2022-12-27 12:48:38 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Verse;
|
|
|
|
|
using RimWorld;
|
2023-01-09 13:14:51 +00:00
|
|
|
|
using rjw;
|
2022-12-27 12:48:38 +00:00
|
|
|
|
|
|
|
|
|
namespace RJW_Genes
|
|
|
|
|
{
|
|
|
|
|
public class Gene_LifeForce : Gene_Resource, IGeneResourceDrain
|
|
|
|
|
{
|
2023-01-09 13:14:51 +00:00
|
|
|
|
//Gene should only be active if sex is allowed for this pawn
|
|
|
|
|
public override bool Active
|
2022-12-27 12:48:38 +00:00
|
|
|
|
{
|
2023-01-09 13:14:51 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (this.Overridden)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Pawn pawn = this.pawn;
|
|
|
|
|
|
|
|
|
|
return ((pawn != null) ? pawn.ageTracker : null) == null ||
|
2023-01-15 20:14:26 +00:00
|
|
|
|
((float)this.pawn.ageTracker.AgeBiologicalYears >= this.def.minAgeActive);
|
2023-01-09 13:14:51 +00:00
|
|
|
|
}
|
2022-12-27 12:48:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-09 13:14:51 +00:00
|
|
|
|
public override void ExposeData()
|
|
|
|
|
{
|
|
|
|
|
base.ExposeData();
|
|
|
|
|
Scribe_Values.Look<bool>(ref this.StoredCumAllowed, "StoredCumAllowed", true, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ShouldConsumeLifeForceNow()
|
2022-12-27 12:48:38 +00:00
|
|
|
|
{
|
|
|
|
|
return this.Value < this.targetValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Same as Gene_Hemogen
|
|
|
|
|
public override IEnumerable<Gizmo> GetGizmos()
|
|
|
|
|
{
|
|
|
|
|
foreach (Gizmo gizmo in base.GetGizmos())
|
|
|
|
|
{
|
|
|
|
|
yield return gizmo;
|
|
|
|
|
}
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 15:44:08 +00:00
|
|
|
|
//every tick it decreases fertilin value and everyday if fertilin is below alert minimum there a ~50 chance for mental break
|
2022-12-27 12:48:38 +00:00
|
|
|
|
public override void Tick()
|
|
|
|
|
{
|
2023-01-17 15:44:08 +00:00
|
|
|
|
base.Tick();
|
2022-12-27 12:48:38 +00:00
|
|
|
|
if (this.CanOffset && this.Resource != null)
|
|
|
|
|
{
|
2023-01-09 13:14:51 +00:00
|
|
|
|
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
|
2023-01-17 15:44:08 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 12:48:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-31 15:40:37 +00:00
|
|
|
|
public bool StoredCumAllowed = true;
|
2022-12-27 12:48:38 +00:00
|
|
|
|
public Gene_Resource Resource
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Pawn Pawn
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.pawn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool CanOffset
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.pawn.Spawned && this.Active;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float ResourceLossPerDay
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.def.resourceLossPerDay;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string DisplayLabel
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.def.resourceLabel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override float InitialResourceMax
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return 1f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override float MinLevelForAlert
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2023-01-09 13:14:51 +00:00
|
|
|
|
return 0.2f;
|
2022-12-27 12:48:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override float MaxLevelOffset
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return base.MaxLevelOffset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected override Color BarColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Color.grey;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected override Color BarHighlightColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Color.white;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|