public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { foreach (var th in StockGeneratorUtility.TryMakeForStock(thingDef, RandomCountOf(thingDef))) { yield return(th); } }
public override IEnumerable <Thing> GenerateThings(Map forMap) { ThingDef def = DefDatabase <ThingDef> .AllDefsListForReading.FindAll(x => this.HandlesThingDef(x)).RandomElement(); IEnumerator <Thing> enumerator = StockGeneratorUtility.TryMakeForStock(def, base.RandomCountOf(def)).GetEnumerator(); while (enumerator.MoveNext()) { Thing current = enumerator.Current; yield return(current); } yield break; }
public override IEnumerable <Thing> GenerateThings(int mapTileIndex) { var tileTemp = Current.Game.World.tileTemperatures.GetOutdoorTemp(mapTileIndex); var isColony = Current.Game.World.worldObjects.AnySettlementAt(mapTileIndex); foreach (var thing in StockGeneratorUtility.TryMakeForStock(Things.Resource_IceBlocks, RandomCountOf(Things.Resource_IceBlocks))) { if (!isColony) { yield return(thing); } } }
public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { List <ThingDef> generatedDefs = new List <ThingDef>(); int numThingDefsToUse = thingDefCountRange.RandomInRange; var list = DefDatabase <ThingDef> .AllDefs.Where((ThingDef d) => HandlesThingDef(d) && d.tradeability.TraderCanSell()); for (int i = 0; i < numThingDefsToUse; i++) { if (!list.Where(d => (excludedThingDefs == null || !excludedThingDefs.Contains(d)) && !generatedDefs.Contains(d)).TryRandomElement(out ThingDef chosenThingDef)) { break; } foreach (Thing item in StockGeneratorUtility.TryMakeForStock(chosenThingDef, RandomCountOf(chosenThingDef), null)) { yield return(item); } generatedDefs.Add(chosenThingDef); chosenThingDef = null; } }