Table of Contents

Class ContentCensus

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

Reads each side's registered content and reconciles it with what the mod declares. A registration double can show that a mod calls ObjectDB or ZNetScene; only the running game shows what each process ended up with, and a client's registries are its own: a server observation never stands for a client. Read(GameActor, string, ContentExpectations) takes one process's census through a strictly pinned actor; Reconcile(ContentExpectations, params SideObservation[]) judges all sides together.

public static class ContentCensus
Inheritance
object
ContentCensus

Fields

Source

public const string Source = "content-census"

Field Value

string

Methods

Parse(JsonElement)

Parses a complete census; anything malformed, incomplete or empty throws rather than reading as "nothing registered".

public static ContentObservation Parse(JsonElement data)

Parameters

data JsonElement

Returns

ContentObservation

Read(GameActor, string, ContentExpectations)

One complete census through capabilityPath (for example valheim.observe/content-census), for the owner and scope of expectations. A census that is not ready (no world, registries not populated, a client's player not spawned), an empty registry, a reply for another owner or scope, or any malformed reply throws: none of them is an empty census.

public static ContentObservation Read(GameActor actor, string capabilityPath, ContentExpectations expectations)

Parameters

actor GameActor
capabilityPath string
expectations ContentExpectations

Returns

ContentObservation

Reconcile(ContentExpectations, params SideObservation[])

Judges every side's observation against expectations. For each side that must have content: the side is observed (a null observation, or none supplied, fails), by that side itself (a server observation supplied as the client's is refused), and with the owner's pinned build (PinnedBuild: the MD5, or a prefix of at least 8 hex characters, as strict pins take it). A refused or missing observation fails the side, and its expected entries are Missing. On an accepted observation each expected entry gets its state, and every in-scope entry that side was not expected to have is Unexpected.

public static ContentCensusReport Reconcile(ContentExpectations expectations, params SideObservation[] observed)

Parameters

expectations ContentExpectations
observed SideObservation[]

Returns

ContentCensusReport