Skip to content
EvilEngine.Api.Selection

SelectionLayer record

public sealed record SelectionLayer

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.

Layers stack lowest priority first, ties in the order they were set. Any layer that hides or locks selection does so whatever the others say, and for Scroll, Selector and 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.

new SelectionLayer("physgun")
{
    Priority = SelectionLayer.Weapon,
    Scroll = false
};
Assembly
EvilEngine.Api
Commit
4ff877b1

Members

SelectionLayer constructor

public SelectionLayer(string Source)

Makes an empty layer named by source.

Gamemode field

public const int Gamemode = 100

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

Weapon field

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

public string Source { get; init; }

Who set the layer, such as "ctf:intro". Setting another layer with the same source replaces it, and Clear takes it by its source. It can’t be empty.

Priority property

public int Priority { get; init; }

Where the layer sits: higher goes on top. Gamemode unless set.

Hidden property

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

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

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

public ContentId? Selector { get; init; }

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

Slots property

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.