public void MakePawnAndInitCrafting(DroidCraftingDef def) { //Update costs. orderProcessor.requestedItems.Clear(); foreach (ThingOrderRequest cost in def.costList) { ThingOrderRequest costCopy = new ThingOrderRequest(); costCopy.nutrition = cost.nutrition; costCopy.thingDef = cost.thingDef; costCopy.amount = cost.amount; orderProcessor.requestedItems.Add(costCopy); } craftingTime = def.timeCost; //Apply template. if (def.useDroidCreator) { pawnBeingCrafted = DroidUtility.MakeDroidTemplate(def.pawnKind, Faction, Map.Tile); } else { pawnBeingCrafted = PawnGenerator.GeneratePawn(def.pawnKind, Faction); } crafterStatus = CrafterStatus.Filling; }
public override void InitiatePawnCrafting() { //Bring up Float Menu //FloatMenuUtility. List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); foreach (DroidCraftingDef def in DefDatabase <DroidCraftingDef> .AllDefs.OrderBy(def => def.orderID)) { bool disabled = false; string labelText = ""; if (def.requiredResearch != null && !def.requiredResearch.IsFinished) { disabled = true; } if (disabled) { labelText = "AndroidDroidCrafterPawnNeedResearch".Translate(def.label, def.requiredResearch.LabelCap); } else { labelText = "AndroidDroidCrafterPawnMake".Translate(def.label); } FloatMenuOption option = new FloatMenuOption(labelText, delegate() { //Stuff if (!disabled) { lastDef = def; MakePawnAndInitCrafting(def); } } ); option.Disabled = disabled; floatMenuOptions.Add(option); } if (floatMenuOptions.Count > 0) { FloatMenu floatMenu = new FloatMenu(floatMenuOptions); Find.WindowStack.Add(floatMenu); } /*pawnBeingCrafted = * DroidUtility.MakeDroidTemplate( * printerProperties.pawnKind.race, * printerProperties.pawnKind, Faction, * Map, * printerProperties.skills, * printerProperties.defaultSkillLevel); * * crafterStatus = CrafterStatus.Filling;*/ }