private static void ScrapChassis(int num, ChassisDef p1, MechBayChassisInfoWidget widget, MechBayPanel mechBay) { for (int i = 0; i < num; i++) { UnityGameInstance.BattleTechGame.Simulation.ScrapInactiveMech(p1.Description.Id, true); } mechBay.RefreshData(false); mechBay.SelectChassis(null); }
private static void ScrapParts(int num, ChassisDef mech, MechBayChassisInfoWidget widget, MechBayPanel mechBay) { for (int i = 0; i < num; i++) { UnityGameInstance.BattleTechGame.Simulation.ScrapMechPart(mech.Description.Id, 1, UnityGameInstance.BattleTechGame.Simulation.Constants.Story.DefaultMechPartMax, true); } widget.SetData(mechBay, null); mechBay.RefreshData(false); mechBay.SelectChassis(null); }
private static void SplitToParts(ChassisDef chassisDef, int min, int max, MechBayPanel mechBay) { int k = mechBay.Sim.NetworkRandom.Int(min, max + 1); UnityGameInstance.BattleTechGame.Simulation.ScrapInactiveMech(chassisDef.Description.Id, false); var mech = ChassisHandler.GetMech(chassisDef.Description.Id); for (int i = 0; i < k; i++) { mechBay.Sim.AddMechPart(mech.Description.Id); } mechBay.RefreshData(false); mechBay.SelectChassis(null); GenericPopupBuilder.Create($"Scraped {mech.Description.UIName}.", $"We manage to get <color=#20ff20>{k}</color> parts from {mech.Description.UIName} chassis") .AddButton("Ok", null, true, null) .CancelOnEscape().AddFader(new UIColorRef?(LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.PopupBackfill), 0f, true).Render(); }
public static void ScrapChassis(List <ChassisCount> filteredChassis) { MechBayPanel mechBayPanel = LazySingletonBehavior <UIManager> .Instance.GetOrCreateUIModule <MechBayPanel>(); foreach (ChassisCount item in filteredChassis) { Mod.Log.Debug?.Write($"Scrapping chassis: {item.ChassisDef.Description.Name}"); for (int i = 0; i < item.ChassisQty; i++) { mechBayPanel.Sim.ScrapInactiveMech(item.ChassisDef.Description.Id, pay: true); Mod.Log.Debug?.Write($" -- scrapped one full mech"); } for (int i = 0; i < item.PartsCount; i++) { Mod.Log.Debug?.Write($" -- scrapped one mech part"); mechBayPanel.Sim.ScrapMechPart(item.ChassisDef.Description.Id, 1f, item.ChassisDef.MechPartMax, pay: true); } mechBayPanel.RefreshData(resetFilters: true); mechBayPanel.SelectChassis(null); } }