CavePopulationSpawnInformation
A class in Root.Township, Alta.Populations.
Spawn information for cave populations: picks random spawn spots weighted by a map chunk layer's values, then places them through a SpawnAreaDisplay.
- Listed in World generation
- Inherits or implements
PopulationSpawnInformation
Constructors
| Member | What it is |
|---|---|
CavePopulationSpawnInformation(SpawnAreaDisplay display, MapChunkLayer layer, MapChunkLayer floor) | Creates a CavePopulationSpawnInformation from display, layer and floor. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private SpawnAreaDisplay display | The display that turns a layer cell into a spawn point. |
private SpawnPoint dud | Placeholder point returned by GetPoint. |
private MapChunkLayer floor | The floor layer passed to the display. |
private MapChunkLayer layer | The map chunk layer whose values weight the spawn chance. |
private List<MapChunkLayer.Value> points | Non-zero layer values, used when the layer plugin keeps such a list. |
private float[][] rows | Running totals of the layer values row by row, used when there is no non-zero list. |
private int size | Layer chunk size in cells. |
private float totalScore | Sum of all weights (each capped at 1 in the row mode). |
Methods
| Member | What it is |
|---|---|
override SpawnPoint GetPoint(int pointIndex) | Always returns a dummy point; cave spawns have no fixed indexed points. |
override SpawnPoint GetRandom(PopulationDefinition definition) | Picks a cell at random, weighted by the layer's values, and spawns a point there through the display. |
1 private and internal method
| Member | What it is |
|---|---|
private SpawnPoint Raycast(int x, int z) | Asks the spawn display for a spawn point at a layer cell. |