CaveLayerChunk
A class in Root.Township, Alta.Chunks.
The location chunk for one cave layer, on the same object as its ICaveLayer. On the server it makes sure the layers above and below exist whenever it loads or is looked up.
- Listed in World, chunks and saving
- Inherits or implements
LocationChunk - Documented in Chunks
Constructors
| Member | What it is |
|---|---|
CaveLayerChunk() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
1 private and internal field
| Member | What it is |
|---|---|
private ICaveLayer caveLayer | The cave layer this chunk belongs to. |
Properties
| Member | What it is |
|---|---|
override ChunkRegion ChunkRegion { get; } | Always ChunkRegion.caves. |
Methods
| Member | What it is |
|---|---|
override void GetNeighboursForLoading(float remainingLoadBudget, HashSet<Chunk> result) | Spawns the adjacent layers first (server), then returns the normal loading neighbours. |
override IEnumerable<LocationChunk> GetNeighboursForLookup() | Spawns the adjacent layers first (server), then returns the normal lookup neighbours. |
override void Initialize() | Finds the ICaveLayer on the object and registers this chunk with LocationChunkHelper. |
override void InitializeAsServer(SpawnData spawnData) | Server: hooks FullyLoaded so adjacent layers spawn once this chunk is loaded. |
override void PlayerEnteredChunk(Player player) | Also reports the layer depth (layer + 1) to the game task system, for depth-based tasks. |
protected override void OnDestroy() | Client: unregisters the chunk and resets the other chunk bounds. |
2 private and internal methods
| Member | What it is |
|---|---|
private void OnFullyLoaded(Chunk chunk) | Handler for FullyLoaded: spawns the adjacent layers. |
private void PrepareAdjacentLayers() | Server: spawns the layer below, and the one above if this isn't layer 0, without generating them. |