// ===================== Main Work Function =====================
/// <summary>
/// Main function:
/// - update the glower if necessary.
/// - verify the cave plant is in good conditions to growth.
/// - when the cave plant is too old, damage it over time.
/// - when the cave plant is mature, try to reproduce.
/// </summary>
public override void TickLong()
{
if (this.isGrowingNow)
{
bool plantWasAlreadyMature = (this.LifeStage == PlantLifeStage.Mature);
this.growthInt += this.GrowthPerTick * GenTicks.TickLongInterval;
if (!plantWasAlreadyMature &&
(this.LifeStage == PlantLifeStage.Mature))
{
// Plant just became mature.
this.Map.mapDrawer.MapMeshDirty(this.Position, MapMeshFlag.Things);
}
}
// Verify the plant is not in cryostasis.
if (this.isInCryostasis == false)
{
if (this.LifeStage == PlantLifeStage.Mature)
{
this.ageInt += GenTicks.TickLongInterval;
}
if (this.Dying)
{
int amount = Mathf.CeilToInt(1.25f);
base.TakeDamage(new DamageInfo(DamageDefOf.Rotting, amount, -1, null, null, null));
}
if (!base.Destroyed &&
(this.growthInt > minGrowthToReproduce) &&
!this.Dying &&
Rand.MTBEventOccurs(this.def.plant.reproduceMtbDays, GenDate.TicksPerDay, GenTicks.TickLongInterval))
{
GenClusterPlantReproduction.TryToReproduce(this);
}
}
// Update glower.
if (!base.Destroyed)
{
UpdateGlowerAccordingToGrowth();
}
this.cachedLabelMouseover = null;
}