// ===================== 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; }
// ===================== 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() { /*Log.Message("TickLong"); * Log.Message("isGrowingNow = " + this.isGrowingNow); * Log.Message("isInCryostasis = " + this.isInCryostasis);*/ if (this.isGrowingNow) { bool plantWasAlreadyMature = (this.LifeStage == PlantLifeStage.Mature); /*Log.Message("plantWasAlreadyMature = " + plantWasAlreadyMature); * Log.Message("growthInt before = " + this.growthInt); * Log.Message("GrowthPerTick = " + this.GrowthPerTick);*/ this.growthInt += this.GrowthPerTick * GenTicks.TickLongInterval; if (DebugSettings.fastEcology) { // TODO: fastEcology debug. this.growthInt += 0.1f; } if (!plantWasAlreadyMature && (this.LifeStage == PlantLifeStage.Mature)) { // Plant just became mature. Find.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, null, null, null)); } if (!base.Destroyed && (this.growthInt > minGrowthToReproduce) && Rand.MTBEventOccurs(this.def.plant.seedEmitMTBDays, GenDate.TicksPerDay, GenTicks.TickLongInterval)) { GenClusterPlantReproduction.TryToReproduce(this); } if (DebugSettings.fastEcology && !base.Destroyed && (this.growthInt > minGrowthToReproduce)) { // TODO: fastEcology debug. GenClusterPlantReproduction.TryToReproduce(this); } } // Update glower. if (!base.Destroyed) { UpdateGlowerAccordingToGrowth(); } this.cachedLabelMouseover = null; }