Exemplo n.º 1
0
        public IEnumerable <IChange> ValidateDropOnRemove(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab, List <IChange> changes)
        {
            Control.LogDebug(DType.ComponentInstall, "--- AutoLinked Remove");

            if (Links == null || Links.Length == 0)
            {
                yield break;
            }

            foreach (var link in Links)
            {
                var widget = mechlab.GetLocationWidget(link.Location);
                if (widget != null)
                {
                    Control.LogDebug(DType.ComponentInstall, $"---- {link.ComponentDefId} from {link.Location}");
                    var remove = new LocationHelper(widget).LocalInventory.FirstOrDefault(e =>
                                                                                          e?.ComponentRef?.ComponentDefID == link.ComponentDefId);
                    if (remove != null)
                    {
                        Control.LogDebug(DType.ComponentInstall, $"----- removed");
                        yield return(new RemoveChange(link.Location, remove));
                    }
                    else
                    {
                        Control.LogDebug(DType.ComponentInstall, $"----- not found");
                    }
                }
            }
        }
 public void AdjustSlotElement(MechLabItemSlotElement element, MechLabPanel panel)
 {
     foreach (var cc in element.ComponentRef.Def.GetComponents <IAdjustSlotElement>())
     {
         cc.AdjustSlotElement(element, panel);
     }
 }
Exemplo n.º 3
0
        public IEnumerable <IChange> ValidateDropOnAdd(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab, List <IChange> changes)
        {
            Control.LogDebug(DType.ComponentInstall, "--- AutoLinked Add");

            if (Links == null || Links.Length == 0)
            {
                yield break;
            }

            foreach (var link in Links)
            {
                Control.LogDebug(DType.ComponentInstall, $"---- {link.ComponentDefId} to {link.Location}");
                var slot = DefaultHelper.CreateSlot(link.ComponentDefId, link.ComponentDefType ?? Def.ComponentType, mechlab.MechLab);

                if (slot != null)
                {
                    Control.LogDebug(DType.ComponentInstall, $"----- added");
                    yield return(new AddDefaultChange(link.Location, slot));
                }
                else
                {
                    Control.LogDebug(DType.ComponentInstall, $"----- not found");
                }
            }
        }
Exemplo n.º 4
0
        public void RefreshSlotElement(MechLabItemSlotElement instance, MechLabPanel panel)
        {
            var weights = instance.ComponentRef?.Def?.GetComponent <Weights>();

            if (weights == null)
            {
                return;
            }

            var mechDef = panel.activeMechDef;

            if (mechDef == null)
            {
                return;
            }

            var tonnageSaved = CalculateWeightSavings(mechDef, weights);

            tonnageSaved -= CalculateEngineTonnageChanges(mechDef, weights);
            var adapter = new MechLabItemSlotElementAdapter(instance);

            if (!Mathf.Approximately(tonnageSaved, 0))
            {
                var sign = tonnageSaved > 0 ? "- " : "";
                adapter.bonusTextA.text = $"{sign}{tonnageSaved} ton";
            }
            else if (adapter.bonusTextA.text.EndsWith("ton"))
            {
                adapter.bonusTextA.text = instance.ComponentRef.Def.BonusValueA;
            }
        }
Exemplo n.º 5
0
        static bool Prefix(MechLabPanel __instance, bool ___batchActionInProgress, MechLabItemSlotElement ___dragItem)
        {
            var hk = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);

            if (!hk)
            {
                return(true);
            }

            if (!__instance.Initialized)
            {
                return(false);
            }
            if (___dragItem != null)
            {
                return(false);
            }
            ___batchActionInProgress = true;
            __instance.headWidget.AdvancedStripping(__instance);
            __instance.centerTorsoWidget.AdvancedStripping(__instance);
            __instance.leftTorsoWidget.AdvancedStripping(__instance);
            __instance.rightTorsoWidget.AdvancedStripping(__instance);
            __instance.leftArmWidget.AdvancedStripping(__instance);
            __instance.rightArmWidget.AdvancedStripping(__instance);
            __instance.leftLegWidget.AdvancedStripping(__instance);
            __instance.rightLegWidget.AdvancedStripping(__instance);
            __instance.FlagAsModified();
            __instance.ValidateLoadout(false);
            ___batchActionInProgress = false;
            return(false);
        }
Exemplo n.º 6
0
            internal Filler()
            {
                gameObject = DataManager.PooledInstantiate(
                    MechLabPanel.MECHCOMPONENT_ITEM_PREFAB,
                    BTLoadUtils.GetResourceType(nameof(BattleTechResourceType.UIModulePrefabs)),
                    null, null);


                {
                    element           = gameObject.GetComponent <MechLabItemSlotElement>();
                    element.AllowDrag = false;
                    {
                        var rect = gameObject.GetComponent <RectTransform>();
                        rect.pivot            = new Vector2(0, 1);
                        rect.anchorMin        = new Vector2(0, 0);
                        rect.anchorMax        = new Vector2(1, 1);
                        rect.anchoredPosition = Vector2.zero;
                    }
                }

                {
                    var rep = gameObject.transform.GetChild("Representation");
                    var layout_components = rep.GetChild("layout_component");
                    var backgrounds       = layout_components.GetChild("BACKGROUNDS");
                    backgroundsRect = backgrounds.GetComponent <RectTransform>();
                }
            }
Exemplo n.º 7
0
        public void AdjustSlotElement(MechLabItemSlotElement instance, MechLabPanel panel)
        {
            var def = instance.ComponentRef.GetComponent <EngineHeatBlockDef>();

            if (def == null)
            {
                return;
            }

            if (panel.activeMechDef == null || panel.activeMechDef.Chassis == null)
            {
                return;
            }

            var engine = panel.GetEngine();

            if (engine == null)
            {
                return;
            }

            var adapter = new MechLabItemSlotElementAdapter(instance);

            adapter.bonusTextA.text = BonusValueEngineHeatDissipation(engine);
            adapter.bonusTextB.text = BonusValueEngineHeatSinkCounts(engine);
        }
 public Change_Add(MechLabItemSlotElement slot, ChassisLocations location)
 {
     this.slot = slot;
     ItemID    = slot.ComponentRef.ComponentDefID;
     Type      = slot.ComponentRef.ComponentDefType;
     Location  = location;
 }
Exemplo n.º 9
0
        private static string ValidateECM(MechLabItemSlotElement item, ChassisLocations locations)
        {
            var def = item.ComponentRef.Def;

            if (def.ComponentSubType < MechComponentType.Prototype_Generic &&
                def.ComponentSubType != MechComponentType.ElectronicWarfare)
            {
                return(string.Empty);
            }

            int count = MechLabHelper.CurrentMechLab.ActiveMech.Inventory.Count(cref => cref.Def.ComponentSubType == def.ComponentSubType);

            if (count > 0)
            {
                if (def.ComponentSubType == MechComponentType.ElectronicWarfare || def.ComponentSubType == MechComponentType.Prototype_ElectronicWarfare)
                {
                    return
                        ("ELECTRONIC WARFARE COMPONENT LIMIT: You can only equip one Electronic Warfare component on this 'Mech.");
                }
                else
                {
                    return
                        ($"PROTOTYPE COMPONENT LIMIT: You can only equip one {def.ComponentSubType} component on this 'Mech");
                }
            }

            return(string.Empty);
        }
        public void ApplyToMechlab()
        {
            if (Applied)
            {
                return;
            }
            var mechLab = MechLabHelper.CurrentMechLab;
            var lhelper = mechLab.GetLocationHelper(Location);

            if (lhelper == null)
            {
                return;
            }

            if (slot != null)
            {
                if (mechLab.InSimGame)
                {
                    WorkOrderEntry_InstallComponent subEntry = mechLab.MechLab.Sim.CreateComponentInstallWorkOrder(
                        mechLab.MechLab.baseWorkOrder.MechID,
                        slot.ComponentRef, Location, slot.MountedLocation);
                    mechLab.MechLab.baseWorkOrder.AddSubEntry(subEntry);
                }
            }
            else
            {
                slot = DefaultHelper.CreateSlot(ItemID, Type);
            }

            lhelper.widget.OnAddItem(slot, true);
            slot.MountedLocation = Location;
        }
Exemplo n.º 11
0
        public HeatSinkDef HeatSinkDef => Def as HeatSinkDef; // TODO reintroduce GenericCustomComponent


        public string PreValidateDrop(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab)
        {
            if (Control.settings.AllowMixingHeatSinkTypes)
            {
                return(string.Empty);
            }

            var engine =
                mechlab.MechLab.activeMechDef.Inventory.FirstOrDefault(i => i.Def.Is <EngineCoreDef>());


            // if engine exist - check its heatsink type
            if (engine != null)
            {
                var engineRef = engine.GetEngineCoreRef();
                if (engineRef.HeatSinkDef.HSCategory != HSCategory)
                {
                    return($"Cannot add {Def.Description.Name}: Mixing heat sink types is not allowed");
                }
            }
            // else checking elaready installed heatsink
            else
            if (mechlab.MechLab.activeMechDef.Inventory.Any(i => i.Def.Is <EngineHeatSink>(out var hs) && hs.HSCategory != HSCategory))
            {
                return($"Cannot add {Def.Description.Name}: Mixing heat sink types is not allowed");
            }

            return(string.Empty);
        }
        public string PreValidateDrop(MechLabItemSlotElement item, ChassisLocations location)
        {
            if (!Valid)
            {
                return(string.Empty);
            }

            var hardpoints = MechLabHelper.CurrentMechLab.ActiveMech.GetAllHardpoints(location);

            int n = 0;

            foreach (var hardpoint in hardpoints)
            {
                if (hardpoint.hpInfo.Visible)
                {
                    n += 1;
                    if (hardpoint.hpInfo.WeaponCategory.ID == WeaponCategory.ID)
                    {
                        return(string.Empty);
                    }
                }
            }

            if (n >= 4)
            {
                return(Control.Settings.Message.Hardpoints_TooManyHardpoints);
            }

            return(string.Empty);
        }
Exemplo n.º 13
0
        public void AdjustSlotElement(MechLabItemSlotElement instance, MechLabPanel panel)
        {
            var weights = instance.ComponentRef?.Def?.GetComponent <Weights>();

            if (weights == null)
            {
                return;
            }

            var mechDef = panel.activeMechDef;

            if (mechDef == null)
            {
                return;
            }

            var tonnageChanges = CalculateWeightChanges(mechDef, weights);
            var adapter        = new MechLabItemSlotElementAdapter(instance);

            if (!Mathf.Approximately(tonnageChanges, 0))
            {
                adapter.bonusTextA.text = $"{FloatToText(tonnageChanges)} ton";
            }
            else if (adapter.bonusTextA.text.EndsWith("ton"))
            {
                adapter.bonusTextA.text = instance.ComponentRef.Def.BonusValueA;
            }
        }
        public string ValidateDrop(MechLabItemSlotElement drop_item, List <InvItem> new_inventory)
        {
            var mechDef = MechLabHelper.CurrentMechLab.ActiveMech;

            var errors1 = new Errors();

            validator.ValidateMech(mechDef, errors1);

            var mechDef2   = new MechDef(mechDef);
            var inventory2 = new_inventory.Select(x =>
            {
                var r             = new MechComponentRef(x.Item);
                r.MountedLocation = x.Location;
                return(r);
            }).ToList();

            mechDef2.SetInventory(inventory2.ToArray());

            var errors2 = new Errors();

            validator.ValidateMech(mechDef2, errors2);

            var newErrors = errors2.Except(errors1);

            return(newErrors.FirstOrDefault()?.Message ?? string.Empty);
        }
Exemplo n.º 15
0
        public void SetDragItem(MechLabItemSlotElement item)
        {
            if (drag_item == null)
            {
                drag_item = main.Field("dragItem");
            }

            drag_item.SetValue(item);
        }
Exemplo n.º 16
0
        public string PreValidateDrop(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab)
        {
            Control.LogDebug(DType.ComponentInstall, $"-- Category {CategoryID}");

            if (!CategoryDescriptor.AllowMixTags && mechlab.MechLab.activeMechDef.Inventory.Any(i => i.Def.IsCategory(CategoryID, out var c) && GetTag() != c.GetTag()))
            {
                return(string.Format(CategoryDescriptor.AddMixed, CategoryDescriptor.DisplayName));
            }

            return(string.Empty);
        }
Exemplo n.º 17
0
        internal void ApplyTo(MechLabItemSlotElement element, bool isReservedSlot)
        {
            var adapter = new MechLabItemSlotElementAdapter(element);

            if (NameText == "")
            {
                adapter.nameText.gameObject.SetActive(false);
            }
            else if (NameText != null)
            {
                adapter.nameText.text = NameText;
                adapter.nameText.gameObject.SetActive(true);
            }

            if (BonusAText == "")
            {
                adapter.bonusTextA.gameObject.SetActive(false);
            }
            else if (BonusAText != null)
            {
                adapter.bonusTextA.text = BonusAText;
                adapter.bonusTextA.gameObject.SetActive(true);
            }

            if (BonusBText == "")
            {
                adapter.bonusTextB.gameObject.SetActive(false);
            }
            else if (BonusBText != null)
            {
                adapter.bonusTextB.text = BonusBText;
                adapter.bonusTextB.gameObject.SetActive(true);
            }

            if (!string.IsNullOrEmpty(BackgroundColor))
            {
                adapter.backgroundColor.SetColorFromString(BackgroundColor);
            }

            if (ShowIcon.HasValue)
            {
                adapter.icon.gameObject.SetActive(ShowIcon.Value);
            }

            if (ShowFixedEquipmentOverlay.HasValue)
            {
                adapter.fixedEquipmentOverlay.gameObject.SetActive(ShowFixedEquipmentOverlay.Value);
            }

            var text = isReservedSlot ? DynamicSlotsFeature.settings.ReservedSlotText : DynamicSlotsFeature.settings.MovableSlotText;

            adapter.bonusTextA.SetText(new Text(text).ToString());
            adapter.bonusTextA.gameObject.SetActive(true);
        }
Exemplo n.º 18
0
        private static string ValidateJumpJets(MechLabItemSlotElement drop_item, MechDef mech, List <InvItem> new_inventory, List <IChange> changes)
        {
            var total = new_inventory.Count(i => i.item.ComponentDefType == ComponentType.JumpJet);
            var max   = mech.Chassis.MaxJumpjets;

            if (total > max)
            {
                return($"Cannot add {drop_item.ComponentRef.Def.Description.Name}: Max number of jumpjets for 'Mech reached");
            }
            return(string.Empty);
        }
Exemplo n.º 19
0
        public string PreValidateDrop(MechLabItemSlotElement item, ChassisLocations location)
        {
            Control.LogDebug(DType.ComponentInstall, "-- TonnageAllowed");
            var tonnage = MechLabHelper.CurrentMechLab.ActiveMech.Chassis.Tonnage;

            if (tonnage != Tonnage)
            {
                return((new Localize.Text(Control.Settings.Message.Tonnage_AddAllow, item.ComponentRef.Def.Description.UIName, Tonnage)).ToString());
            }

            return(string.Empty);
        }
Exemplo n.º 20
0
        public string PreValidateDrop(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlabf)
        {
            Control.LogDebug(DType.ComponentInstall, "-- TonnageAllowed");
            var tonnage = location.mechLab.activeMechDef.Chassis.Tonnage;

            if (tonnage != Tonnage)
            {
                return($"{Def.Description.Name} designed for {Tonnage}t 'Mech");
            }

            return(string.Empty);
        }
Exemplo n.º 21
0
 internal static void ForceItemDropStrip(this MechLabPanel mechlab, MechLabItemSlotElement item)
 {
     Control.LogDebug(DType.DefaultHandle, $"Dropping {item.ComponentRef.Def.Description.Id} ");
     if (strip_state)
     {
         foreach (var validator in item.ComponentRef.Def.GetComponents <IOnItemGrabbed>())
         {
             validator.OnItemGrabbed(item, mechlab, strip_widget);
         }
         mechlab.ForceItemDrop(item);
     }
 }
        public string PostValidatorDrop(MechLabItemSlotElement drop_item, List <InvItem> new_inventory)
        {
            if (Control.Settings.AllowMechlabWrongHardpoints)
            {
                return(string.Empty);
            }

            var mechDef = MechLabHelper.CurrentMechLab.ActiveMech;


            var weapons_per_location = new_inventory
                                       .Select(i => new { location = i.Location, item = i.Item, wcat = i.Item.GetWeaponCategory() })
                                       .Where(i => !i.wcat.Is_NotSet)

                                       .GroupBy(i => i.location)
                                       .Select(i => new { location = i.Key, items = i.ToList() })
                                       .ToList();

            foreach (var w_location in weapons_per_location)
            {
                var hardpoints = mechDef.GetAllHardpoints(w_location.location, new_inventory);

                //foreach (var hardpoint in hardpoints)
                //{
                //    Control.Log($"{w_location.location} - {hardpoint.hpInfo.WeaponCategory.Name} - {hardpoint.Used}/{hardpoint.Total}");
                //}

                foreach (var recrd in w_location.items)
                {
                    if (HardpointsByID.TryGetValue(recrd.wcat.ID, out var hpInfo))
                    {
                        var nearest = hardpoints.FirstOrDefault(i => i.Total > i.Used && i.hpInfo.CompatibleID.Contains(hpInfo.WeaponCategory.ID));
                        if (nearest != null)
                        {
                            nearest.Used += 1;
                        }
                        else
                        {
                            return(new Localize.Text(Control.Settings.Message.Base_AddNotEnoughHardpoints,
                                                     mechDef.Description.UIName, recrd.item.Def.Description.Name,
                                                     recrd.item.Def.Description.UIName,
                                                     recrd.wcat.Name, recrd.wcat.FriendlyName,
                                                     w_location.location
                                                     ).ToString());
                        }
                    }
                }
            }

            return(string.Empty);
        }
Exemplo n.º 23
0
        public void RefreshSlotElement(MechLabItemSlotElement instance, MechLabPanel panel = null)
        {
            var engineRef = instance.ComponentRef.GetEngineCoreRef();

            if (engineRef == null)
            {
                return;
            }

            var adapter = new MechLabItemSlotElementAdapter(instance);

            adapter.bonusTextA.text = engineRef.BonusValueA;
            adapter.bonusTextB.text = engineRef.BonusValueB;
        }
Exemplo n.º 24
0
        public string PostValidateDrop(MechLabItemSlotElement drop_item, MechDef mech, List <InvItem> new_inventory,
                                       List <IChange> changes)
        {
            var slots   = new MechDefSlots(mech.Chassis, new_inventory.Select(x => x.item).ToList());
            var missing = slots.Missing;

            if (missing > 0)
            {
                return
                    ($"Cannot add {drop_item.ComponentRef.Def.Description.Name}: Mech requires {missing} additional free slots");
            }

            return(string.Empty);
        }
Exemplo n.º 25
0
        private static string ValidateBase(MechLabItemSlotElement item, ChassisLocations locations)
        {
            var component = item.ComponentRef.Def;
            var lhelper   = MechLabHelper.CurrentMechLab.GetLocationHelper(locations);
            var mech      = MechLabHelper.CurrentMechLab.ActiveMech;

            if (lhelper.widget.loadout.CurrentInternalStructure <= 0f)
            {
                // 0 - item Name, 1 - Location name, 2 - item.uiname
                return(new Localize.Text(Control.Settings.Message.Base_LocationDestroyed, component.Description.Name, lhelper.LocationName, component.Description.UIName).ToString());
            }

            return(string.Empty);
        }
Exemplo n.º 26
0
 public static void Postfix(MechLabItemSlotElement __instance, UIColorRefTracker ___backgroundColor)
 {
     try
     {
         if (HasOverrideColor(__instance.ComponentRef.Def, out Color overrideColor))
         {
             ___backgroundColor.OverrideWithColor(overrideColor);
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Exemplo n.º 27
0
        public string PostValidateDrop(MechLabItemSlotElement drop_item, MechDef mech, List <InvItem> new_inventory, List <IChange> changes)
        {
            Control.LogDebug(DType.ComponentInstall, $"-- Category {CategoryID}");

            if (CategoryDescriptor.MaxEquiped > 0)
            {
                var total = new_inventory.Count(i => i.item.Def.IsCategory(CategoryID));
                Control.LogDebug(DType.ComponentInstall, $"---- {total}/{CategoryDescriptor.MaxEquiped}");
                if (total > CategoryDescriptor.MaxEquiped)
                {
                    if (CategoryDescriptor.MaxEquiped > 1)
                    {
                        return(string.Format(CategoryDescriptor.AddMaximumReached, CategoryDescriptor.displayName, CategoryDescriptor.MaxEquiped));
                    }
                    else
                    {
                        return(string.Format(CategoryDescriptor.AddAlreadyEquiped, CategoryDescriptor.displayName));
                    }
                }
            }

            if (CategoryDescriptor.MaxEquipedPerLocation > 0)
            {
                var total = new_inventory
                            .Where(i => i.item.Def.IsCategory(CategoryID))
                            .Select(i =>
                {
                    i.item.Def.IsCategory(CategoryID, out var component);
                    return(new { l = i.location, c = component });
                })
                            .GroupBy(i => i.l)
                            .FirstOrDefault(i => i.Count() > CategoryDescriptor.MaxEquipedPerLocation);

                if (total != null)
                {
                    if (CategoryDescriptor.MaxEquipedPerLocation > 1)
                    {
                        return(string.Format(CategoryDescriptor.AddMaximumLocationReached, CategoryDescriptor.DisplayName,
                                             CategoryDescriptor.MaxEquipedPerLocation, total.Key));
                    }
                    else
                    {
                        return(string.Format(CategoryDescriptor.AddAlreadyEquipedLocation,
                                             CategoryDescriptor.DisplayName, total.Key));
                    }
                }
            }

            return(string.Empty);
        }
Exemplo n.º 28
0
        private static string ValidateBase(MechLabItemSlotElement item, LocationHelper location, MechLabHelper mechlab)
        {
            var component = item.ComponentRef.Def;

            if (location.widget.loadout.CurrentInternalStructure <= 0f)
            {
                return($"Cannot add {component.Description.Name} to {location.LocationName}: The location is Destroyed.");
            }
            if ((component.AllowedLocations & location.widget.loadout.Location) <= ChassisLocations.None)
            {
                return($"Cannot add {component.Description.Name} to {location.LocationName}: Component is not permitted in this location.");
            }
            return(string.Empty);
        }
        internal static void Postfix(this MechLabItemSlotElement __instance, TextMeshProUGUI ___nameText, TextMeshProUGUI ___bonusTextA, TextMeshProUGUI ___bonusTextB)
        {
            try
            {
                {
                    var engineRef = __instance.ComponentRef.GetEngineCoreRef(null);
                    if (engineRef != null)
                    {
                        ___bonusTextA.text = engineRef.BonusValueA;
                        ___bonusTextB.text = engineRef.BonusValueB;
                    }
                }

                // didn't work
                //Control.mod.Logger.LogDebug("__instance.ComponentRef.Def.IsEngineCenterSlots() = " + __instance.ComponentRef.Def.IsEngineCenterSlots());
                //if (__instance.ComponentRef.Def.IsEngineCenterSlots())
                //{
                //    var mechLab = MechLab.Current;
                //    Control.mod.Logger.LogDebug("mechLab = " + mechLab);
                //    if (mechLab != null)
                //    {
                //        var engineRef = mechLab.activeMechInventory.GetEngineCoreRef();

                //        Control.mod.Logger.LogDebug("engineRef = " + engineRef);
                //        if (engineRef != null)
                //        {
                //            var changes = engineRef.TonnageChanges;

                //            Control.mod.Logger.LogDebug("changes = " + changes);
                //            if (changes > 0 || changes < 0)
                //            {
                //                if (engineRef.TonnageChanges > 0)
                //                {
                //                    ___bonusTextA.text = "+ " + engineRef.TonnageChanges + " Tons";
                //                }
                //                else
                //                {
                //                    ___bonusTextA.text = "- " + -engineRef.TonnageChanges + " Tons";
                //                }
                //            }
                //        }
                //    }
                //}
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }
Exemplo n.º 30
0
        public string PreValidateDrop(MechLabItemSlotElement item, ChassisLocations location)
        {
            var allowed = item.ComponentRef.Is <IAllowedLocations>(out var al)
                ? al.GetLocationsFor(MechLabHelper.CurrentMechLab.ActiveMech)
                : item.ComponentRef.Def.AllowedLocations;


            if ((location & allowed) <= ChassisLocations.None)
            {
                return(new Text(Control.Settings.Message.Base_AddWrongLocation,
                                item.ComponentRef.Def.Description.Name, location,
                                item.ComponentRef.Def.Description.UIName).ToString());
            }

            return(string.Empty);
        }