Skip to content
EvilEngine.Formats.Records

WeaponEvent record

public sealed record WeaponEvent

One entry of a weapon record’s events list, which plays a look at a moment in its model’s animation (Events). It matches either an event the model’s sequence carries, by On, as Source’s models carry them, or a point in a sequence, by Sequence and Cycle, never both. It plays one thing: an Effect, a Casing or a Sound.

events = [
    { sequence = "reload", cycle = 0.4, casing = "casing", at = "eject" },
    { on = "AE_MUZZLEFLASH", effect = "muzzle", at = "{2}" },
]

Each of Effect, Casing, Sound and At may hold {1} to {9}, which stand for the model event’s own words, so Source’s events pass their attachment and sound names through. The engine fills them with Fill.

Assembly
EvilEngine.Formats
Commit
4ff877b1

Members

WeaponEvent constructor

public WeaponEvent()

Makes an event matching nothing and playing nothing, for setting what you need.

On property

public string? On { get; init; }

The model event matched, from on, by its name or number as the model gives it, such as AE_MUZZLEFLASH or 6001, in any case. null for an event matched by Sequence.

Options property

public string? Options { get; init; }

The words the model event’s options must start with, from options, compared word by word in any case, or null to match any. Only an event with On has them.

Sequence property

public string? Sequence { get; init; }

The sequence matched, from sequence, by name in any case, such as a glb’s fire action. null for an event matched by On.

Cycle property

public double Cycle { get; init; }

How far through the Sequence it plays, from cycle, from 0 at its start to 1 at its end. 0 unless set, and only an event with Sequence has one.

Effect property

public string? Effect { get; init; }

The effect record it plays, from effect: an id, or muzzle or impact for the weapon’s own in the held mode. Any other bare name warns once and plays nothing.

Casing property

public string? Casing { get; init; }

The casing record it ejects, from casing: an id, or casing for the weapon’s own in the held mode. Any other bare name warns once and plays nothing.

Sound property

public string? Sound { get; init; }

The sound it plays, from sound: an id, or a name from the weapon’s sounds. A bare name that’s none of them is a sound by that name in the model’s namespace, as a Source model’s events name its game’s sounds. Empty once filled, it plays nothing.

At property

public string? At { get; init; }

The attachment it plays at, from at, or null for the weapon’s muzzle, or its eject port for a casing.

Matches method

public bool Matches(string name, string options)

Whether the event matches a model event named name with options: On is that name in any case, and options starts with every word of Options. An event with no On matches none.

Fill method

public static string Fill(string text, string options)

text with {1} to {9} replaced by the words of options in turn, a missing word by nothing. Text with no { comes back as it is.