Ejemplo n.º 1
0
 public IEnumerable <Building> GetBuildingsOf(CarnBuildingType type)
 {
     foreach (var building in carnivalBuildings)
     {
         if (building.Is(type))
         {
             yield return(building);
         }
     }
 }
Ejemplo n.º 2
0
        public static bool Is(this ThingDef def, CarnBuildingType type)
        {
            CompProperties_CarnBuilding props = def.GetCompProperties <CompProperties_CarnBuilding>();

            if (props == null)
            {
                return(false);
            }

            return(props.type.Is(type));
        }
Ejemplo n.º 3
0
        public LocalTargetInfo GetRandomTentDoor(bool suppressWarnings = false, CarnBuildingType secondaryType = CarnBuildingType.Bedroom)
        {
            var tent = GetRandomBuildingOf(CarnBuildingType.Tent | secondaryType, suppressWarnings) as Building_Tent;

            if (tent != null)
            {
                return(tent.GetTentFlap());
            }

            return(IntVec3.Invalid);
        }
Ejemplo n.º 4
0
        public Building_Carn GetRandomBuildingOf(CarnBuildingType type, bool suppressWarnings = false)
        {
            if (!Active)
            {
                Log.Error("Cannot get carnival building: carnival is not in town.");
                return(null);
            }

            Building building;

            if (carnivalBuildings.Where(b => b.Is(type)).TryRandomElement(out building))
            {
                return(building as Building_Carn);
            }

            if (Prefs.DevMode && !suppressWarnings)
            {
                Log.Warning("[Carnivale] Tried to find any building of type " + type + " in CarnivalInfo, but none exists.");
            }
            return(null);
        }
Ejemplo n.º 5
0
        public Building GetFirstBuildingOf(CarnBuildingType type)
        {
            if (!Active)
            {
                Log.Error("Cannot get carnival building: carnival is not in town.");
                return(null);
            }

            foreach (var building in this.carnivalBuildings)
            {
                if (building.Is(type))
                {
                    return(building);
                }
            }

            if (Prefs.DevMode)
            {
                Log.Warning("[Carnivale] Tried to find any building of type " + type + " in CarnivalInfo, but none exists.");
            }
            return(null);
        }
Ejemplo n.º 6
0
 public static bool Is(this CarnBuildingType type, CarnBuildingType other)
 {
     return((type & other) == other);
 }
Ejemplo n.º 7
0
 public static bool Is(this Building building, CarnBuildingType type)
 {
     return(building.def.Is(type));
 }