Skip to content
EvilEngine.Api.Crosshair

CrosshairLayer record

public sealed record CrosshairLayer

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.

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 first and ties in the order they were set. A layer’s keys beat the player’s, and its locks 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.

new CrosshairLayer("shotgun")
{
    Priority = CrosshairLayer.Weapon,
    Gap = 12,
    Thickness = 2,
    Locked = [CrosshairKey.Gap]
};
Assembly
EvilEngine.Api
Commit
4ff877b1

Members

CrosshairLayer constructor

public CrosshairLayer(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:teams". 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.

Style property

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

public bool Hidden { get; init; }

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

Colour property

public CrosshairColour? Colour { get; init; }

The crosshair’s colour, alpha and all.

Blend property

public CrosshairBlend? Blend { get; init; }

Whether the crosshair is laid over the world or added onto it.

Length property

public double? Length { get; init; }

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

Gap property

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

public double? Thickness { get; init; }

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

Outline property

public double? Outline { get; init; }

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

Dot property

public bool? Dot { get; init; }

Whether the classic cross draws a dot at the middle.

Top property

public bool? Top { get; init; }

Whether the classic cross draws its top arm.

Locked property

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

The keys 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.