コード例 #1
0
ファイル: Pawn.cs プロジェクト: tkkntkkn/natures-pretty-sweet
        public static void MakeBreath(Pawn pawn)
        {
            if (Find.TickManager.TicksGame % 150 == 0)
            {
                Map     map     = pawn.Map;
                Watcher watcher = map.GetComponent <Watcher>();

                bool isCold = watcher.checkIfCold(pawn.Position);
                if (isCold)
                {
                    IntVec3 head = pawn.Position;
                    head.z += 1;
                    if (!head.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority)
                    {
                        return;
                    }
                    MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("TKKN_Mote_ColdBreath"), null);
                    moteThrown.airTimeLeft   = 99999f;
                    moteThrown.Scale         = Rand.Range(.5f, 1.5f);
                    moteThrown.rotationRate  = Rand.Range(-30f, 30f);
                    moteThrown.exactPosition = head.ToVector3();
                    moteThrown.SetVelocity((float)Rand.Range(20, 30), Rand.Range(0.5f, 0.7f));
                    GenSpawn.Spawn(moteThrown, head, map);
                }
            }
        }
コード例 #2
0
ファイル: Pawn.cs プロジェクト: tkkntkkn/natures-pretty-sweet
        public static void MakePaths(Pawn pawn)
        {
            Map     map     = pawn.Map;
            Watcher watcher = map.GetComponent <Watcher>();

            if (watcher == null)
            {
                return;
            }
            #region paths
            if (pawn.Position.InBounds(map) && pawn.RaceProps.Humanlike)
            {
                //damage plants and remove snow/frost where they are. This will hopefully generate paths as pawns walk :)
                if (watcher.checkIfCold(pawn.Position))
                {
                    map.GetComponent <FrostGrid>().AddDepth(pawn.Position, (float)-.05);
                    map.snowGrid.AddDepth(pawn.Position, (float)-.05);
                }

                //pack down the soil only if the pawn is moving AND is in our colony
                if (pawn.pather.MovingNow && pawn.IsColonist)
                {
                    cellData cell = watcher.cellWeatherAffects[pawn.Position];
                    cell.doPack();
                }
                if (Settings.allowPlantEffects)
                {
                    //this will be handled by the terrain changing in doPack
                    //		watcher.hurtPlants(pawn.Position, true, true);
                }
            }
            #endregion
        }