Table of Contents

Class OrderedHookList<T>

Namespace
WorldgenLib
Assembly
WorldgenLib.VintageStory.dll

Generic ordered-delegate registry. Each step holds a sorted list of (order, index, delegate) tuples. Frozen after initWorldGen.

public sealed class OrderedHookList<T> where T : class

Type Parameters

T
Inheritance
OrderedHookList<T>
Inherited Members

Properties

Count

Number of registered delegates.

public int Count { get; }

Property Value

int

HasDisabledRegistrations

Whether at least one registration has been disabled.

public bool HasDisabledRegistrations { get; }

Property Value

bool

IsFrozen

Whether the list is frozen.

public bool IsFrozen { get; }

Property Value

bool

Snapshot

Return the frozen ordered entries without allocating. This is the path used by terrain and BlockLayers hot loops. The returned span remains valid until this list is discarded; entries are immutable.

public ReadOnlySpan<OrderedHookList<T>.HookEntry> Snapshot { get; }

Property Value

ReadOnlySpan<OrderedHookList<T>.HookEntry>

Methods

Disable(string)

Disable all registrations owned by a mod after an invocation failure. This implements the per-hook failure boundary without mutating the sorted delegate array used by the worldgen hot path.

public bool Disable(string modId)

Parameters

modId string

Returns

bool

Enumerate()

Iterate delegates in frozen order. Throws if not frozen.

public IEnumerable<(double Order, string ModId, T Delegate)> Enumerate()

Returns

IEnumerable<(double Order, string ModId, T Delegate)>

Freeze()

Freeze the list. After this, no more registrations are allowed. Delegates are sorted by (order, registration index) for stable order.

public void Freeze()

GetRegistrationReport()

List registered effects for the startup report.

public IReadOnlyList<(double Order, string ModId)> GetRegistrationReport()

Returns

IReadOnlyList<(double Order, string ModId)>

IsDisabled(string)

Check disabled state without allocating or taking a lock.

public bool IsDisabled(string modId)

Parameters

modId string

Returns

bool

Register(string, double, T)

Register a delegate. Throws if frozen (after initWorldGen).

public void Register(string modId, double order, T handler)

Parameters

modId string
order double
handler T