示例#1
0
        protected bool CanSpawnAt(IntVec3 c, Map map)
        {
            //Log.Message("NoticeMineral: CanSpawnAt: c: " + c);
            //Log.Message("NoticeMineral: CanSpawnAt: map: " + map);
            //Log.Message("NoticeMineral: CanSpawnAt: c.Fogged(map): " + c.Fogged(map));
            //Log.Message("NoticeMineral: CanSpawnAt:  c.GetSnowDepth(map): " + c.GetSnowDepth(map));
            if (c.Fogged(map) || c.GetSnowDepth(map) > 0)
            {
                return(false);
            }

            bool noticed = false;

            foreach (Pawn pawn in map.mapPawns.AllPawns.InRandomOrder())
            {
                if (pawn.IsColonist)
                {
                    int mineSkill = pawn.skills.GetSkill(SkillDefOf.Mining).Level;
                    if (mineSkill < 5 || (mineSkill < 10 && Rand.Bool) || pawn.Position.DistanceTo(c) > mineSkill)
                    {
                        continue;
                    }
                    noticed = true;
                    finder  = pawn;
                }
            }
            if (noticed == false)
            {
                return(false);
            }
            // Log.Message("NoticeMineral: CanSpawnAt: pawn: " + finder);

            foreach (ThingDef_StaticMineral mineralType in DefDatabase <ThingDef_StaticMineral> .AllDefs.InRandomOrder())
            {
                if (!mineralType.tags.NullOrEmpty() && mineralType.tags.Contains("NoticeMineral_Event") && mineralType.CanSpawnAt(map, c))
                {
                    typeToSpawn = mineralType;
                    return(true);
                }
            }


            return(false);
        }
示例#2
0
 public static bool SnowAllowsPlanting(IntVec3 c, Map map)
 {
     return(c.GetSnowDepth(map) < 0.2f);
 }