public static void PerformMechAssemblyStorePopup(SimGameState s, MechDef d, Action onClose) { WwiseManager.PostEvent(AudioEventList_ui.ui_sim_popup_newChassis, WwiseManager.GlobalAudioObject, null, null); MechDef toAdd = PerformMechAssembly(s, d); int mechbay; if (toAdd.IsVehicle()) { mechbay = CUIntegration.GetFirstFreeMechBay(s, d); // vehicle bay, +100 or something similar } else { mechbay = s.GetFirstFreeMechBay(); } GenericPopupBuilder pop = GenericPopupBuilder.Create($"{d.GetMechOmniVehicle()} Assembled", $"Yang: [[DM.MechDefs[{d.Description.Id}],{d.Chassis.Description.UIName} {d.Chassis.VariantName}]] finished!\n{d.Chassis.YangsThoughts}\n\n"); pop.AddButton("storage", delegate { StoreMech(s, toAdd); CallMessages(s, toAdd); Log.Log("direct storage"); onClose?.Invoke(); }, true, null); if (mechbay < 0) // no space - direct storage { pop.Body += $"We have no space for a new {d.GetMechOmniVehicle()}, so it goes into storage."; } else { pop.Body += "Should I put it into storage or ready it for combat?"; pop.AddButton("ready it", delegate { if (Settings.AssembledMechsNeedReadying) { ReadyMech(s, toAdd, mechbay); CallMessages(s, toAdd); } else { s.AddMech(mechbay, toAdd, true, false, false); CallMessages(s, toAdd); } Log.Log("added to bay " + mechbay); onClose?.Invoke(); }, true, null); } if (s.IsSellingAllowed()) { int cost = toAdd.GetMechSellCost(s); pop.Body += $"\n\nDarius: We could also sell it for {SimGameState.GetCBillString(cost)}, although Yang would certanly not like it."; pop.AddButton("sell it", delegate { s.AddFunds(cost, "Store", true, true); Log.Log("sold for " + cost); s.CompanyStats.ModifyStat("Mission", 0, "COMPANY_MechsAdded", StatCollection.StatOperation.Int_Add, 1, -1, true); CallMessages(s, toAdd); onClose?.Invoke(); }, true, null); } pop.AddFader(new UIColorRef?(LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.PopupBackfill), 0f, true); pop.Render(); }