Skip to content
EvilEngine.Api.Weapons

WeaponBullets record

public sealed record WeaponBullets

Bullets a weapon fires through IWeaponHolder.Fire.

holder.Fire(new WeaponBullets(1, 0.0087, holder.Record?.Damage ?? 0, 668 * WeaponBullets.Unit) { TracerEvery = 2 });
Assembly
EvilEngine.Api
Commit
4ff877b1

Members

WeaponBullets constructor

public WeaponBullets(int Count, double Spread, double Damage, double Impulse)

How many pellets, the cone’s spread as the sine of its half angle, each pellet’s damage and the impulse each pushes a prop with, in kg·m/s.

Unit field

public const double Unit = 0.0254

One Source unit in metres, 0.0254, for weapons whose numbers are Source’s.

MostPellets field

public const int MostPellets = 100

The most pellets one shot fires, 100. Half-Life 2’s shotgun fires 7, or 12 on its double blast.

Count property

public int Count { get; init; }

How many pellets fire at once, from 1 to MostPellets. Fewer than 1 fires 1, and more than MostPellets throws ArgumentOutOfRangeException.

Spread property

public double Spread { get; init; }

The sine of the cone’s half angle: 0.0087 is a 1° cone.

Damage property

public double Damage { get; init; }

Each pellet’s damage.

Impulse property

public double Impulse { get; init; }

The push each pellet gives what it hits, along its direction.

Distance property

public double Distance { get; init; }

How far each pellet reaches, 56,756 units by default.

TracerEvery property

public int TracerEvery { get; init; }

A tracer every so many pellets this body fires, or none at 0.

PersonDamage property

public double? PersonDamage { get; init; }

Each pellet’s damage to a person, where it differs from what it does to props, or null for Damage.

Tracer property

public ContentId? Tracer { get; init; }

A tracer record these bullets draw in place of the weapon’s, or null for the weapon’s own.

Impact property

public ContentId? Impact { get; init; }

An effect record played where each pellet hits in place of the weapon’s impact, or null for the weapon’s own, then the surface’s.

Muzzle property

public ContentId? Muzzle { get; init; }

An effect record flashed at the muzzle in place of the weapon’s, or null for the weapon’s own. Naming one also flashes it in first person when the view model’s own events would have.

Decal property

public ContentId? Decal { get; init; }

A decal record each pellet leaves where it hits in place of the struck surface’s decals.bullet, or null for the surface’s own. The server picks one of its pictures and every player sees the same (see Scopes/Decals.md).