WeaponTuning class
public sealed class WeaponTuning : IEquatable<WeaponTuning> A weapon record’s tuning table, the numbers and choices its behaviour reads. Its keys are free: a behaviour decides which it reads and what they mean, as evil.weapons does for its firearms, launchers, melee and beams (Making weapons). A record’s tuning merges key by key over its base’s, tables into tables.
Every read takes a fallback and never throws. A value of the wrong kind falls back and is kept as a mistake, and every key nothing read is listed as unread, so the server can note both once by the weapon and key. A behaviour reads its tuning when it’s made:
sealed class ChainLightning(WeaponRecord record) : IWeaponBehaviour
{
readonly double reach = record.Tuning.Number("reach", 6);
readonly string mode = record.Tuning.Choice("mode", "arc", "arc", "fork");
readonly (double R, double G, double B, double A) colour = record.Tuning.Colour("colour", "#80c0ff");
}
- Assembly
- EvilEngine.Formats
- Commit
- 4ff877b1