コード例 #1
0
ファイル: Plant.cs プロジェクト: LucaAnt/SCB18Core
        public override void TickLong()
        {
            this.CheckTemperatureMakeLeafless();
            if (!GenPlant.GrowthSeasonNow(this.Position, Find.VisibleMap))
            {
                return;
            }
            if (!this.HasEnoughLightToGrow)
            {
                this.unlitTicks += 2000;
            }
            else
            {
                this.unlitTicks = 0;
            }
            bool flag = this.LifeStage == PlantLifeStage.Mature;

            this.growth += this.GrowthPerTick * 2000f;
            if (!flag && this.LifeStage == PlantLifeStage.Mature)
            {
                this.NewlyMatured();
            }
            if (this.def.plant.LimitedLifespan)
            {
                this.age += 2000;
                if (this.get_Rotting())
                {
                    int num = Mathf.CeilToInt(10f);
                    this.TakeDamage(new DamageInfo(DamageDefOf.Rotting, num, (Thing)null, new BodyPartDamageInfo?(), (ThingDef)null));
                }
            }
            if (this.Destroyed || !this.def.plant.shootsSeeds || ((double)this.growth < 0.600000023841858 || !Rand.MTBEventOccurs(this.def.plant.seedEmitMTBDays, 30000f, 2000f)) || (!GenPlant.SnowAllowsPlanting(this.Position) || GridsUtility.Roofed(this.Position)))
            {
                return;
            }
            GenPlantReproduction.TrySpawnSeed(this.Position, this.def, SeedTargFindMode.MapGenCluster, (Thing)this);
        }