# SelectionLayer record

> An override a gamemode, a weapon or any Plugin lays over a player's weapon selection with ISelection.Set. Every key left as it starts leaves selection as it was.

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

```csharp
public sealed record SelectionLayer
```

An override a gamemode, a weapon or any Plugin lays over a player's weapon selection with [ISelection.Set](/docs/api/iselection#set). Every key left as it starts leaves selection as it was.

Layers stack lowest [priority](#priority) first, ties in the order they were set. Any layer that [hides](#hidden) or [locks](#locked) selection does so whatever the others say, and for [Scroll](#scroll), [Selector](#selector) and [Slots](#slots) the topmost layer naming one wins. The server holds the stack, so a pick a locked or hidden player sends never switches their weapon.

```csharp
new SelectionLayer("physgun")
{
    Priority = SelectionLayer.Weapon,
    Scroll = false
};
```

## Members

### SelectionLayer (constructor)

```csharp
public SelectionLayer(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:intro"`. Setting another layer with the same source replaces it, and [Clear](/docs/api/iselection#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.

### Hidden (property)

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

Shuts weapon selection outright while the layer stands: the wheel closes, nothing opens it, and the last weapon key does nothing, as Garry's Mod's camera hides its selector.

### Locked (property)

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

Leaves the wheel opening but refuses every pick, with the selector's deny sound, as a cutscene or a round's warm-up might.

### Scroll (property)

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

`false` takes the mouse wheel from selection, so its notches reach the held weapon, as the physics gun's needs while it holds a prop; `true` gives it back over a lower layer's `false`. `null` says nothing.

### Selector (property)

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

A `selector` record to show in place of the player's, whatever their HUD offers.

### Slots (property)

```csharp
public int? Slots { get; init; }
```

How many slots the shown selector has, from 1 to 10, in place of its record's. A weapon whose slot is past the last isn't on the wheel.
