public void ApplyStats(object def) { if (def is RecipeDef d) { d.workAmount = this.workAmount; d.allowMixingIngredients = this.allowMixingIngredients; d.autoStripCorpses = this.autoStripCorpses; d.productHasIngredientStuff = this.productHasIngredientStuff; d.targetCountAdjustment = this.targetCountAdjustment; d.workSkillLearnFactor = this.workSkillLearnFactor; d.hideBodyPartNames = this.hideBodyPartNames; d.isViolation = this.isViolation; d.surgerySuccessChanceFactor = this.surgerySuccessChanceFactor; d.deathOnFailedSurgeryChance = this.deathOnFailedSurgeryChance; d.targetsBodyPart = this.targetsBodyPart; d.anesthetize = this.anesthetize; d.dontShowIfAnyIngredientMissing = this.dontShowIfAnyIngredientMissing; //d.fixedIngredientFilter = new ThingFilter(); //this.fixedIngredientFilter.ApplyStats(d.fixedIngredientFilter); //d.fixedIngredientFilter = new ThingFilter(); //this.defaultIngredientFilter.ApplyStats(d.defaultIngredientFilter); Util.AssignDef(this.researchPrerequisite, out d.researchPrerequisite); Util.AssignDef(this.requiredGiverWorkType, out d.requiredGiverWorkType); Util.AssignDef(this.unfinishedThingDef, out d.unfinishedThingDef); Util.AssignDef(this.soundWorking, out d.soundWorking); Util.AssignDef(this.workSpeedStat, out d.workSpeedStat); Util.AssignDef(this.efficiencyStat, out d.efficiencyStat); Util.AssignDef(this.workTableEfficiencyStat, out d.workTableEfficiencyStat); Util.AssignDef(this.workTableSpeedStat, out d.workTableSpeedStat); Util.AssignDef(this.addsHediff, out d.addsHediff); Util.AssignDef(this.removesHediff, out d.removesHediff); Util.AssignDef(this.workSkill, out d.workSkill); Util.AssignDef(this.effectWorking, out d.effectWorking); Util.Populate(out d.specialProducts, this.specialProducts, true); Util.Populate(out d.forceHiddenSpecialFilters, this.forceHiddenSpecialFilters, v => v.Def); Util.Populate(out d.recipeUsers, this.recipeUsers, v => v.Def); Util.Populate(out d.appliedOnFixedBodyParts, this.appliedOnFixedBodyParts, v => v.Def); Util.Populate(out d.products, this.products, (v) => new ThingDefCountClass(v.Def, v.value), false); Util.Populate(out d.skillRequirements, this.skillRequirements, delegate(IntValueDefStat <SkillDef> v) { return(new SkillRequirement() { skill = v.Def, minLevel = v.value }); }, false); Util.ListIndexAssign(this.ingredients, d.ingredients, (f, t) => IngredientCountStats.SetIngredientCount(t, f.Count)); Util.Populate(out List <ThingDef> l, this.premultipliedSmallIngredients, v => v.Def); SetPremultipliedSmallIngredients(d, l); Util.Populate(out d.factionPrerequisiteTags, this.factionPrerequisiteTags); } }
public IngredientCountWidget(IngredientCount ingredientCount) { this.uniqueId = uniqueCount; ++uniqueCount; this.IngredientCount = ingredientCount; this.filter = new ThingFilterWidget("Ingredient Filter", this.IngredientCount.filter); this.count = new FloatInputWidget <IngredientCount>( this.IngredientCount, "Ingredient Count", (ic) => IngredientCountStats.GetIngredientCount(ic), (ic, f) => IngredientCountStats.SetIngredientCount(ic, f)); }