public bool HasEnoughResourcesInHoppersFor(ThingDef thingDef) { //Log.Message( string.Format( "{0}.HasEnoughResourcesInHoppersFor( {1} )", this.ThingID, thingDef == null ? "null" : thingDef.defName ) ); var recipe = FindRecipeForProduct(thingDef); if (recipe == null) { return(false); } return(CompHopperUser.EnoughResourcesInHoppers(recipe)); }
public ThingDef BestProduct(Func <ThingDef, bool> where, Func <ThingDef, ThingDef, int> sort) { //Log.Message( string.Format( "{0}.BestProduct()", this.ThingID ) ); var thingDefs = AllProducts().Where(where.Invoke).ToList(); thingDefs.Sort(sort.Invoke); foreach (var thingDef in thingDefs) { var recipe = FindRecipeForProduct(thingDef); if (CompHopperUser.EnoughResourcesInHoppers(recipe)) { return(thingDef); } } return((ThingDef)null); }
public override bool HasEnoughFeedstockInHoppers() { int costPerDispense = this.def.building.foodCostPerDispense; /* Research Project cut from A13 * if( ResearchProjectDef.Named( "NutrientResynthesis" ).IsFinished ) * { * costPerDispense--; * } */ // Check for generic hoppers if (compHopperUser != null) { if (compHopperUser.EnoughResourcesInHoppers(costPerDispense)) { return(true); } } // Check for vanilla hoppers return(base.HasEnoughFeedstockInHoppers()); }