# CrosshairLayer record

> An override a gamemode, a weapon or any Plugin lays over a crosshair with ICrosshair.Set. Every key left null leaves the crosshair as it was.

Namespace `EvilEngine.Api.Crosshair`, assembly `EvilEngine.Api`. Engine commit 4ff877b1.

```csharp
public sealed record CrosshairLayer
```

An override a gamemode, a weapon or any Plugin lays over a crosshair with [ICrosshair.Set](/docs/api/icrosshair#set). Every key left `null` leaves the crosshair as it was.

What the player sees is the shown style's record, then the player's own values for the keys the style lets them set, then every layer, lowest [priority](#priority) first and ties in the order they were set. A layer's keys beat the player's, and its [locks](#locked) take the player's values away even for keys it doesn't set. Nothing a layer does shows a crosshair the player turned off with `crosshair 0`.

```csharp
new CrosshairLayer("shotgun")
{
    Priority = CrosshairLayer.Weapon,
    Gap = 12,
    Thickness = 2,
    Locked = [CrosshairKey.Gap]
};
```

## Members

### CrosshairLayer (constructor)

```csharp
public CrosshairLayer(string Source)
```

Makes an empty layer named by `source`.

### Gamemode (field)

```csharp
public const int Gamemode = 100
```

100, the priority a gamemode's layers take by convention, and every layer's unless set.

### Weapon (field)

```csharp
public const int Weapon = 200
```

200, the priority a weapon's layers take by convention, so a held weapon's sit over the gamemode's.

### Source (property)

```csharp
public string Source { get; init; }
```

Who set the layer, such as `"ctf:teams"`. Setting another layer with the same source replaces it, and [Clear](/docs/api/icrosshair#clear) takes it by its source. It can't be empty.

### Priority (property)

```csharp
public int Priority { get; init; }
```

Where the layer sits: higher goes on top. [Gamemode](#gamemode) unless set.

### Style (property)

```csharp
public ContentId? Style { get; init; }
```

A `crosshair` record to show in place of the player's pick, whether or not the HUD offers it. The topmost layer naming one wins.

### Hidden (property)

```csharp
public bool Hidden { get; init; }
```

Hides the crosshair outright while the layer stands, as a sniper's scope does.

### Colour (property)

```csharp
public CrosshairColour? Colour { get; init; }
```

The crosshair's [colour](/docs/api/crosshaircolour), alpha and all.

### Blend (property)

```csharp
public CrosshairBlend? Blend { get; init; }
```

Whether the crosshair is laid over the world or [added](/docs/api/crosshairblend#add) onto it.

### Length (property)

```csharp
public double? Length { get; init; }
```

The classic cross's arm length, in the style's lengths. From 0 to 1000.

### Gap (property)

```csharp
public double? Gap { get; init; }
```

From the middle to each arm's inner end, in the style's lengths. From 0 to 1000.

### Thickness (property)

```csharp
public double? Thickness { get; init; }
```

Each arm's thickness, at least a pixel whatever it's set to. From 0 to 1000.

### Outline (property)

```csharp
public double? Outline { get; init; }
```

The black outline's thickness, 0 for none. From 0 to 1000.

### Dot (property)

```csharp
public bool? Dot { get; init; }
```

Whether the classic cross draws a dot at the middle.

### Top (property)

```csharp
public bool? Top { get; init; }
```

Whether the classic cross draws its top arm.

### Locked (property)

```csharp
public IReadOnlyList<CrosshairKey> Locked { get; init; }
```

The [keys](/docs/api/crosshairkey) the player's own values can't reach while the layer stands, so a gamemode can pin every team's crosshair to the style's colour.
