Table of Contents

Class ContentExpectations

Namespace
Valheim.Testing.Game
Assembly
Valheim.Testing.Game.dll

What a mod declares it registers, per side, for ContentCensus: the Owner plugin whose build must be the pinned one on each side, the Scope (name prefixes that are the mod's own content; every expected name starts with one, and only entries in scope can be Unexpected, so vanilla content never is) and the entries. Load it from a file (Load(string)) written as

{ "owner": "example.mymod", "scope": ["MyMod_", "Recipe_MyMod_"],
  "items":   [{ "name": "MyMod_SurveyStake", "sides": ["server", "client"] }],
  "prefabs": [{ "name": "MyMod_SurveyStake", "sides": ["server", "client"] }],
  "recipes": [{ "name": "Recipe_MyMod_SurveyStake", "sides": ["server", "client"],
                "item": "MyMod_SurveyStake", "station": "piece_workbench", "resources": ["Wood"] }],
  "pieces": [{ "name": "MyMod_SurveyPost", "tool": "Hammer", "sides": ["server", "client"],
               "station": "none", "resources": ["Wood"] }],
  "statusEffects": [{ "name": "MyMod_SurveyBlessing", "sides": ["server", "client"] }] }

Anything else in the file (another key, a side other than server or client, a name twice, a name outside the scope) is refused. Derive it from the mod's design, never from a census: a census copied into its own expectations can only pass.

public sealed class ContentExpectations
Inheritance
object
ContentExpectations

Constructors

ContentExpectations(string, IEnumerable<string>, IEnumerable<ExpectedContent>)

public ContentExpectations(string owner, IEnumerable<string> scope, IEnumerable<ExpectedContent> entries)

Parameters

owner string
scope IEnumerable<string>
entries IEnumerable<ExpectedContent>

Fields

LaterKinds

Reserved for format kinds without an observer; empty now that pieces and effects are observed.

public static readonly IReadOnlyList<string> LaterKinds

Field Value

IReadOnlyList<string>

ObservedKinds

The kinds this census observes. An older adapter that omits a kind reports it unsupported.

public static readonly IReadOnlyList<string> ObservedKinds

Field Value

IReadOnlyList<string>

Properties

Entries

public IReadOnlyList<ExpectedContent> Entries { get; }

Property Value

IReadOnlyList<ExpectedContent>

Owner

public string Owner { get; }

Property Value

string

Scope

public IReadOnlyList<string> Scope { get; }

Property Value

IReadOnlyList<string>

Methods

For(CensusSide)

The entries side must have.

public IEnumerable<ExpectedContent> For(CensusSide side)

Parameters

side CensusSide

Returns

IEnumerable<ExpectedContent>

InScope(string?)

Whether name is in the declared scope.

public bool InScope(string? name)

Parameters

name string

Returns

bool

Load(string)

public static ContentExpectations Load(string path)

Parameters

path string

Returns

ContentExpectations

Parse(string)

Reads the file format above; anything it does not know is refused.

public static ContentExpectations Parse(string json)

Parameters

json string

Returns

ContentExpectations