Example #1
0
        // TODO move to CC
        internal bool ValidateAddSimple(ChassisDef chassisDef, ChassisLocations location, MechComponentDef newComponentDef)
        {
            if (newComponentDef.ComponentType != ComponentType.Weapon)
            {
                return(true);
            }

            var chassisLocationDef = chassisDef.GetLocationDef(location);
            var hardpoints         = chassisLocationDef.Hardpoints;

            if (hardpoints == null)
            {
                // how can this happen? is this from the properties widget?
                //Control.mod.Logger.LogDebug($"hardpoints is null");
                return(true);
            }

            var calc = new HardpointOmniUsageCalculator(null, hardpoints);

            return(calc.CanAdd(newComponentDef));
        }
Example #2
0
 private int GetMaxSlots(ChassisLocations location)
 {
     return(Chassis.GetLocationDef(location).InventorySlots);
 }