Nebula
Containers

ContainerRegistry

The container graph of the loaded level: every Container, indexed deterministically so all processes agree on indices, plus adjacency.

generated from the sources
public static class ContainerRegistry

The container graph of the loaded level: every Container, indexed deterministically so all processes agree on indices, plus adjacency. Adjacent = bounds touch or overlap.

Two ways to populate it: Rebuild scans the loaded scene and sorts by id (single-scene games), or Load takes an already ordered list built from a WorldContainerManifest (partitioned worlds), in which case lookups go through a grid of cells instead of a linear scan.

Properties

All

public static IReadOnlyList<Container> All { get; }

Count

public static int Count { get; }

IsGridded

public static bool IsGridded { get; }

A partitioned world's manifest is loaded: containers know their cell and lookups use the grid.

Events

Rebuilt

public static event Action Rebuilt;

LeasesChanged

public static event Action LeasesChanged;

Raised after a batch of leases was applied (the worker and client do this whenever the control plane changes).

Methods

Rebuild

public static void Rebuild();

Scan the loaded scene(s) for containers and index them by id.

Load

public static void Load(IList<Container> ordered, bool gridded);

Index ordered as given (position = wire index). With gridded every container must carry its Container.Cell; adjacency is then only tested between containers of neighbouring cells and Find only visits the cells around the point.

InCell

public static IReadOnlyList<Container> InCell(Vector3Int cell);

Containers whose cell is cell (the cell container and its nested ones). Empty when not gridded.

Get

public static Container Get(ushort index);

RefreshCaches

public static void RefreshCaches();

Re-read every container's transform (the worker does this once per tick; see Container.RefreshCache).

FindById

public static Container FindById(string id);

Find

public static Container Find(Vector3 worldPosition);

The container whose volume holds the point; if none does, the nearest one. Containers may nest (an "outdoor" box enclosing per-building boxes): when several hold the point the smallest volume wins, so the most specific container is chosen. Pure geometry, so every process agrees.

Resolve

public static Container Resolve(Vector3 worldPosition, Container current, float hysteresis);

The container the entity should belong to after applying hysteresis: it must be at least hysteresis metres inside a different container before we consider it moved.

ApplyLease

public static void ApplyLease(string containerId, string workerId, ushort workerIndex, ulong epoch);

NotifyLeasesChanged

public static void NotifyLeasesChanged();

Tell listeners (world streaming, overlays) that a batch of ApplyLease calls is complete.

On this page