Skip to main content

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.

Constructors​

MemberWhat it is
CavePopulationSpawnInformation(SpawnAreaDisplay display, MapChunkLayer layer, MapChunkLayer floor)Creates a CavePopulationSpawnInformation from display, layer and floor.

Fields​

8 private and internal fields
MemberWhat it is
private SpawnAreaDisplay displayThe display that turns a layer cell into a spawn point.
private SpawnPoint dudPlaceholder point returned by GetPoint.
private MapChunkLayer floorThe floor layer passed to the display.
private MapChunkLayer layerThe map chunk layer whose values weight the spawn chance.
private List<MapChunkLayer.Value> pointsNon-zero layer values, used when the layer plugin keeps such a list.
private float[][] rowsRunning totals of the layer values row by row, used when there is no non-zero list.
private int sizeLayer chunk size in cells.
private float totalScoreSum of all weights (each capped at 1 in the row mode).

Methods​

MemberWhat 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
MemberWhat it is
private SpawnPoint Raycast(int x, int z)Asks the spawn display for a spawn point at a layer cell.