# WeaponMode record

> One of a weapon's modes, an entry in its record's modes list, as Garry's Mod's physics gun has. A player picks one by holding Alt, and while it's picked its title, icons, view model, world model, hold, effects and attachments stand in for the weapon's. Each one it leaves out is the weapon's. A behaviour reads the picked mode's index from IWeaponHolder.Mode, and the record's EffectsIn, WorldModelIn, HoldIn and AttachmentsIn fold a mode over the weapon for it.

Namespace `EvilEngine.Formats.Records`, assembly `EvilEngine.Formats`. Engine commit 4ff877b1.

```csharp
public sealed record WeaponMode
```

One of a weapon's modes, an entry in its record's `modes` list, as Garry's Mod's physics gun has. A player picks one by holding Alt, and while it's picked its title, icons, view model, world model, hold, effects and attachments stand in for the weapon's. Each one it leaves out is the weapon's. A behaviour reads the picked mode's index from [IWeaponHolder.Mode](/docs/api/iweaponholder#mode), and the record's [EffectsIn](/docs/api/weaponrecord#effectsin), [WorldModelIn](/docs/api/weaponrecord#worldmodelin), [HoldIn](/docs/api/weaponrecord#holdin) and [AttachmentsIn](/docs/api/weaponrecord#attachmentsin) fold a mode over the weapon for it.

```toml
modes = [
    { title = "Rifle", accent = "#40a0ff" },
    { title = "Grenade", accent = "#ff8020", viewmodel = "pulse:viewmodel/pulse_gl", effects = { muzzle = "pulse:effect/thump" } },
]
```

## Members

### WeaponMode (constructor)

```csharp
public WeaponMode(string Title, string Accent)
```

Makes a mode with its title and accent and nothing else.

### Title (property)

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

The mode's name, from `title`, which the wheel and the mode picker show in place of the weapon's while it's picked. A record's mode must have one.

### Accent (property)

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

The mode's colour in the mode picker, from `accent`, a lowercase `#rrggbb` or `#rrggbbaa`. A record's mode must have one.

### ViewModel (property)

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

The `viewmodel` record drawn in first person in this mode, from `viewmodel`, or `null` for the weapon's.

### WorldModel (property)

```csharp
public WeaponWorldModel? WorldModel { get; init; }
```

The model in the holder's hand in this mode, from `worldmodel`, or `null` for the weapon's.

### Hold (property)

```csharp
public string? Hold { get; init; }
```

The hold type the holder's body takes in this mode, from `hold`, or `null` for the weapon's.

### Icon (property)

```csharp
public WeaponIcon? Icon { get; init; }
```

The mode's icon, from `icon`, on the wheel while it's picked and in the mode picker, or `null` for the weapon's.

### IconSelected (property)

```csharp
public WeaponIcon? IconSelected { get; init; }
```

The icon drawn while the weapon or the mode is hovered, from `icon_selected`, or `null` for the mode's [Icon](#icon), then the weapon's selected icon and its icon.

### Effects (property)

```csharp
public WeaponEffects Effects { get; init; }
```

The mode's looks, from `effects`, each slot it sets over the weapon's. [None](/docs/api/weaponeffects#none) unless set.

### Attachments (property)

```csharp
public WeaponAttachments Attachments { get; init; }
```

The attachments the mode's looks come from, from `attachments`, each one it names over the weapon's. [None](/docs/api/weaponattachments#none) unless set.
