public static bool IsOfType(this SupportedBlockTypes type, MyDefinitionBase block)
        {
            switch (type)
            {
            case SupportedBlockTypes.Weapon:
                return(block is MyWeaponBlockDefinition);

            case SupportedBlockTypes.CryoChamber:
                return(block is MyCockpitDefinition && ((Type)block.Id.TypeId).Name.ToLower().Contains("cryo"));

            case SupportedBlockTypes.MedicalRoom:
                return(block is MyMedicalRoomDefinition);

            case SupportedBlockTypes.ShipController:
                return(block is MyShipControllerDefinition);

            case SupportedBlockTypes.ShipConstruction:
                return(block is MyShipGrinderDefinition || block is MyShipWelderDefinition || block is MyProjectorDefinition);

            case SupportedBlockTypes.Docking:
                return(block.Id.TypeId == typeof(MyObjectBuilder_ShipConnector));

            case SupportedBlockTypes.Communications:
                return(block is MyLaserAntennaDefinition || block is MyRadioAntennaDefinition);

            default:
                return(false);
            }
        }
예제 #2
0
 public BlockRequirement BlockCountRequirement(SupportedBlockTypes key)
 {
     return(m_blockCountRequirements.GetValueOrDefault(key, BlockRequirement.Zero));
 }