public IEnumerable <Building> GetBuildingsOf(CarnBuildingType type) { foreach (var building in carnivalBuildings) { if (building.Is(type)) { yield return(building); } } }
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)); }
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); }
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); }
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); }
public static bool Is(this CarnBuildingType type, CarnBuildingType other) { return((type & other) == other); }
public static bool Is(this Building building, CarnBuildingType type) { return(building.def.Is(type)); }