private static void AddUpgradeToSalvage(Contract __instance, MechComponentDef d, SimGameState s, List <SalvageDef> sal) { string lootable = d.GetCCLootableItem(); if (lootable != null) { MechComponentDef l = s.DataManager.GetComponentDefFromID(lootable); if (l != null) { d = l; } } if (IsBlacklisted(d)) { SimpleMechAssembly_Main.Log.LogError("skipping, cause its blacklisted"); return; } try { __instance.AddMechComponentToSalvage(sal, d, ComponentDamageLevel.Functional, false, s.Constants, s.NetworkRandom, true); } catch (Exception e) { SimpleMechAssembly_Main.Log.LogError("failed to add mech component"); SimpleMechAssembly_Main.Log.LogException(e); GenericPopupBuilder.Create("SMA add component error", "Please delete your .modtek folder (so everything gets regenerated next start).\nIf it still happens afterwards, please report.").AddButton("ok", null, true, null).Render(); } }