public static List <HPUsage> GetAllHardpoints(this ChassisDef chassis, ChassisLocations location,
                                                      IEnumerable <InvItem> inventory)
        {
            if (chassis == null)
            {
                return(null);
            }

            var result = chassis.GetHardpoints(location).Select(a => new HPUsage(a, true)).ToList();

            foreach (var invItem in inventory.Where(i => i.Location == location))
            {
                if (invItem.Item.Is <AddHardpoint>(out var add) && add.Valid)
                {
                    AddToList(result, add.WeaponCategory);
                }
        public static bool SetHardpoints(MechBayChassisInfoWidget __instance, LocalizableText ___jumpjetHardpointText,
                                         LocalizableText ___ballisticHardpointText, ChassisDef ___selectedChassis)
        {
            try
            {
                var hardpoints = __instance.GetComponent <UIModuleHPHandler>();
                if (hardpoints == null)
                {
                    hardpoints = __instance.gameObject.AddComponent <UIModuleHPHandler>();
                    hardpoints.Init(__instance, ___ballisticHardpointText.gameObject,
                                    ___jumpjetHardpointText.gameObject, new Vector2(320, -25));
                }

                var usage = ___selectedChassis.GetHardpoints();
                hardpoints.SetDataTotal(usage);
                hardpoints.SetJJ(___selectedChassis.GetJJMaxByChassisDef());
            }
            catch (Exception e)
            {
                Control.LogError(e);
            }
            return(false);
        }