Class ModDeclaration
- Namespace
- Valheim.Testing.GameSessions
- Assembly
- Valheim.Testing.GameSessions.dll
What a mod declares to the runner once (#258): the read-only session capability its test adapter serves (for example
my.mod.testing/session) and the environment variable that passes the owned session token to it, and, optionally,
the Harmony patches it applies. With HarmonyCapability, Owner and Patches, a
GameSession checks at runtime-ready, as the Setup step "server: the mod's Harmony patches are applied", that
every declared patch is applied on its owned server (RequirePatchesApplied(GameActor)) when the server's pins load the
mod (Plugin pinned to a build), so no scenario runs on a server where the mod is
loaded but not patched in. Clients are not checked by the session yet.
public sealed record ModDeclaration
- Inheritance
-
objectModDeclaration
Constructors
ModDeclaration(string, string)
What a mod declares to the runner once (#258): the read-only session capability its test adapter serves (for example
my.mod.testing/session) and the environment variable that passes the owned session token to it, and, optionally,
the Harmony patches it applies. With HarmonyCapability, Owner and Patches, a
GameSession checks at runtime-ready, as the Setup step "server: the mod's Harmony patches are applied", that
every declared patch is applied on its owned server (RequirePatchesApplied(GameActor)) when the server's pins load the
mod (Plugin pinned to a build), so no scenario runs on a server where the mod is
loaded but not patched in. Clients are not checked by the session yet.
public ModDeclaration(string SessionCapability, string SessionTokenVariable)
Parameters
SessionCapabilitystringSessionTokenVariablestring
Properties
HarmonyCapability
The test adapter's Harmony census capability, for example my.mod.testing/harmony; null declares no check.
public string? HarmonyCapability { get; init; }
Property Value
- string
Owner
The mod's Harmony ID (new Harmony(id)), whose patches the census lists.
public string? Owner { get; init; }
Property Value
- string
Patches
The patches the mod applies; every one must be in the census.
public IReadOnlyList<DeclaredPatch> Patches { get; init; }
Property Value
- IReadOnlyList<DeclaredPatch>
Plugin
The plugin GUID an actor's pins name when it loads the mod; the Owner when left out.
public string? Plugin { get; init; }
Property Value
- string
SessionCapability
public string SessionCapability { get; init; }
Property Value
- string
SessionTokenVariable
public string SessionTokenVariable { get; init; }
Property Value
- string
Methods
RequirePatchesApplied(GameActor)
Every declared patch is applied on actor (its adapter's census, Check(string, IEnumerable<DeclaredPatch>)).
public void RequirePatchesApplied(GameActor actor)
Parameters
actorGameActor
Validate()
Refuses a declaration that names only part of the Harmony check, or a patch kind Harmony has not, before anything is copied.
public void Validate()