// only allow one engine slot per specific location internal static void EngineSlotsValidateAdd( MechComponentDef newComponentDef, List <MechLabItemSlotElement> localInventory, ref string dropErrorMessage, ref bool result) { try { if (!newComponentDef.IsEngineSlots()) { return; } var existingEngine = localInventory .Where(x => x != null) .Select(x => x.ComponentRef) .FirstOrDefault(x => x != null && x.Def != null && x.Def.IsEngineSlots()); if (existingEngine == null) { return; } dropErrorMessage = string.Format("Cannot add {0}: Engine shielding is already installed", newComponentDef.Description.Name); result = false; } catch (Exception e) { Control.mod.Logger.LogError(e); } }