Exemplo n.º 1
0
 private void SetCompProps(CompProperties_Shearable compProps, Production p)
 {
     if (compProps != null)
     {
         compProps.woolAmount        = p.Amount;
         compProps.shearIntervalDays = p.IntervalDays;
     }
 }
Exemplo n.º 2
0
 public static void Wool()
 {
     DebugTables.MakeTablesDialog(DefDatabase <ThingDef> .AllDefs.Where((ThingDef d) => d.category == ThingCategory.Pawn && d.race.IsFlesh && d.GetCompProperties <CompProperties_Shearable>() != null), new TableDataGetter <ThingDef>("animal", (ThingDef d) => d.defName), new TableDataGetter <ThingDef>("woolDef", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.defName), new TableDataGetter <ThingDef>("woolAmount", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolAmount.ToString()), new TableDataGetter <ThingDef>("woolValue", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.BaseMarketValue.ToString("F2")), new TableDataGetter <ThingDef>("shear interval", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().shearIntervalDays.ToString("F1")), new TableDataGetter <ThingDef>("value per year", delegate(ThingDef d)
     {
         CompProperties_Shearable compProperties = d.GetCompProperties <CompProperties_Shearable>();
         return((compProperties.woolDef.BaseMarketValue * (float)compProperties.woolAmount * (60f / (float)compProperties.shearIntervalDays)).ToString("F0"));
     }));
 }
Exemplo n.º 3
0
        private List <ThingDef> getProduction(ThingDef from)
        {
            List <ThingDef> allProduction = new List <ThingDef>();

            if (from.race != null)
            {
                if (from.race.meatDef != null)
                {
                    allProduction.Add(from.race.meatDef);
                }
                if (from.race.useMeatFrom != null)
                {
                    allProduction.Add(from.race.meatDef);
                }
                if (from.race.leatherDef != null)
                {
                    allProduction.Add(from.race.leatherDef);
                }
                CompProperties_Milkable milkProp = from.GetCompProperties <CompProperties_Milkable>();
                if (milkProp != null)
                {
                    allProduction.Add(milkProp.milkDef);
                }
                CompProperties_Shearable shearProp = from.GetCompProperties <CompProperties_Shearable>();
                if (shearProp != null)
                {
                    allProduction.Add(shearProp.woolDef);
                }
            }
            if (from.plant != null)
            {
                if (from.plant.harvestedThingDef != null)
                {
                    allProduction.Add(from.plant.harvestedThingDef);
                }
            }
            if (from.building != null)
            {
                if (from.building.mineableThing != null)
                {
                    allProduction.Add(from.building.mineableThing);
                }
            }
            return(allProduction);
        }
Exemplo n.º 4
0
        public static void Wool()
        {
            IEnumerable <ThingDef> arg_129_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.category == ThingCategory.Pawn && d.race.IsFlesh && d.GetCompProperties <CompProperties_Shearable>() != null
                                               select d;

            TableDataGetter <ThingDef>[] expr_2D = new TableDataGetter <ThingDef> [6];
            expr_2D[0] = new TableDataGetter <ThingDef>("animal", (ThingDef d) => d.defName);
            expr_2D[1] = new TableDataGetter <ThingDef>("woolDef", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.defName);
            expr_2D[2] = new TableDataGetter <ThingDef>("woolAmount", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolAmount.ToString());
            expr_2D[3] = new TableDataGetter <ThingDef>("woolValue", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.BaseMarketValue.ToString("F2"));
            expr_2D[4] = new TableDataGetter <ThingDef>("shear interval", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().shearIntervalDays.ToString("F1"));
            expr_2D[5] = new TableDataGetter <ThingDef>("value per year", delegate(ThingDef d)
            {
                CompProperties_Shearable compProperties = d.GetCompProperties <CompProperties_Shearable>();
                return((compProperties.woolDef.BaseMarketValue * (float)compProperties.woolAmount * (60f / (float)compProperties.shearIntervalDays)).ToString("F0"));
            });
            DebugTables.MakeTablesDialog <ThingDef>(arg_129_0, expr_2D);
        }