Пример #1
0
 public static bool SkyfallerCanLandAt(IntVec3 c, Map map, IntVec2 size, Faction faction = null)
 {
     if (!IsSafeDropSpot(c, map, faction, size, 5))
     {
         return(false);
     }
     foreach (IntVec3 item in GenAdj.OccupiedRect(c, Rot4.North, size))
     {
         List <Thing> thingList = item.GetThingList(map);
         for (int i = 0; i < thingList.Count; i++)
         {
             Thing thing = thingList[i];
             if (thing is IActiveDropPod || thing is Skyfaller)
             {
                 return(false);
             }
             PlantProperties plant = thing.def.plant;
             if (plant != null && plant.IsTree)
             {
                 return(false);
             }
             if (thing.def.preventSkyfallersLandingOn)
             {
                 return(false);
             }
             if (thing.def.category == ThingCategory.Item || thing.def.category == ThingCategory.Building)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
        private static string GetReportFromCell(IntVec3 cell, Map map)
        {
            if (!cell.InBounds(map))
            {
                return("OutOfBounds".Translate().CapitalizeFirst());
            }
            if (cell.Fogged(map))
            {
                return("ShuttleCannotLand_Fogged".Translate().CapitalizeFirst());
            }
            if (!cell.Walkable(map))
            {
                return("ShuttleCannotLand_Unwalkable".Translate().CapitalizeFirst());
            }
            RoofDef roof = cell.GetRoof(map);

            if (roof != null && (roof.isNatural || roof.isThickRoof))
            {
                return("MessageTransportPodsDestinationIsInvalid".Translate().CapitalizeFirst());
            }
            List <Thing> thingList = cell.GetThingList(map);

            for (int i = 0; i < thingList.Count; i++)
            {
                Thing thing = thingList[i];
                if (thing is IActiveDropPod || thing is Skyfaller || thing.def.category == ThingCategory.Item || thing.def.category == ThingCategory.Building)
                {
                    return("BlockedBy".Translate(thing).CapitalizeFirst());
                }
                PlantProperties plant = thing.def.plant;
                if (plant != null && plant.IsTree)
                {
                    return("BlockedBy".Translate(thing).CapitalizeFirst());
                }
            }
            return(null);
        }