Skip to main content

GeneratedLoot

A class in Root.Township, Alta.Loot.

A dock array that fills its docks with random loot from its chunk's biome and refills them on a timer (one day by default). Server side.

Constructors​

MemberWhat it is
GeneratedLoot()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private int cachedPluginIdentifierAn int kept in the save data and restored on load; nothing else in this class reads it.
private float incrementingFailChanceHow much the chance to stop filling grows with each dock tried. Passed to LootHelper.Spawn.
private static Logger loggerNLog logger for this class.
private float respawnFrequencySeconds between refills. Default 86400 (one day).
private SpawnData spawnDataUnused field; Respawn uses the chunk's spawn data instead.
private Timeline.IEntry waitToRefillThe Timeline entry for the repeating refill. Saved, and on load any missed refill runs on the next frame.

Properties​

MemberWhat it is
bool IsGenerationValueUsed { get; }Always true.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: fills the docks on first generation (on the next frame) and starts the repeating refill timer if none was loaded.
3 private and internal methods
MemberWhat it is
private void OnDestroy()Cancels the refill timer.
private void Respawn()Server: clears the docks and fills them again through LootHelper.Spawn with the chunk's spawn data. Logs an error if the entity has no chunk.
private void Respawn(int count)Server: clears the docks and fills them again through LootHelper.Spawn with the chunk's spawn data. Logs an error if the entity has no chunk.