예제 #1
0
        public static Pair <ThingDef, float> ForagedFoodPerDayLeftAfterTradeableTransfer(List <Thing> allCurrentThings, List <Tradeable> tradeables, BiomeDef biome, Faction faction, StringBuilder explanation = null)
        {
            ForagedFoodPerDayCalculator.tmpThingCounts.Clear();
            TransferableUtility.SimulateTradeableTransfer(allCurrentThings, tradeables, ForagedFoodPerDayCalculator.tmpThingCounts);
            Pair <ThingDef, float> result = ForagedFoodPerDayCalculator.ForagedFoodPerDay(ForagedFoodPerDayCalculator.tmpThingCounts, biome, faction, explanation);

            ForagedFoodPerDayCalculator.tmpThingCounts.Clear();
            return(result);
        }
예제 #2
0
        public static Pair <ThingDef, float> ForagedFoodPerDay(List <ThingCount> thingCounts, BiomeDef biome, Faction faction, StringBuilder explanation = null)
        {
            ForagedFoodPerDayCalculator.tmpPawns.Clear();
            for (int i = 0; i < thingCounts.Count; i++)
            {
                if (thingCounts[i].Count > 0)
                {
                    Pawn pawn = thingCounts[i].Thing as Pawn;
                    if (pawn != null)
                    {
                        ForagedFoodPerDayCalculator.tmpPawns.Add(pawn);
                    }
                }
            }
            Pair <ThingDef, float> result = ForagedFoodPerDayCalculator.ForagedFoodPerDay(ForagedFoodPerDayCalculator.tmpPawns, biome, faction, true, false, explanation);

            ForagedFoodPerDayCalculator.tmpPawns.Clear();
            return(result);
        }
예제 #3
0
        public static Pair <ThingDef, float> ForagedFoodPerDayLeftAfterTransfer(List <TransferableOneWay> transferables, BiomeDef biome, Faction faction, StringBuilder explanation = null)
        {
            ForagedFoodPerDayCalculator.tmpPawns.Clear();
            for (int i = 0; i < transferables.Count; i++)
            {
                TransferableOneWay transferableOneWay = transferables[i];
                if (transferableOneWay.HasAnyThing && transferableOneWay.AnyThing is Pawn)
                {
                    for (int j = transferableOneWay.things.Count - 1; j >= transferableOneWay.CountToTransfer; j--)
                    {
                        ForagedFoodPerDayCalculator.tmpPawns.Add((Pawn)transferableOneWay.things[j]);
                    }
                }
            }
            Pair <ThingDef, float> result = ForagedFoodPerDayCalculator.ForagedFoodPerDay(ForagedFoodPerDayCalculator.tmpPawns, biome, faction, true, false, explanation);

            ForagedFoodPerDayCalculator.tmpPawns.Clear();
            return(result);
        }
예제 #4
0
 public static Pair <ThingDef, float> ForagedFoodPerDay(Caravan caravan, StringBuilder explanation = null)
 {
     return(ForagedFoodPerDayCalculator.ForagedFoodPerDay(caravan.PawnsListForReading, caravan.Biome, caravan.Faction, caravan.pather.MovingNow, caravan.NightResting, explanation));
 }