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.
- Listed in World generation
- Inherits or implements
DockArray,ISavable<GeneratedLootSaveData>,ISavableSave<GeneratedLootSaveData>,ISavableSaveBase - Derived types
GeneratedLootSaveData
Constructors
| Member | What it is |
|---|---|
GeneratedLoot() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private int cachedPluginIdentifier | An int kept in the save data and restored on load; nothing else in this class reads it. |
private float incrementingFailChance | How much the chance to stop filling grows with each dock tried. Passed to LootHelper.Spawn. |
private static Logger logger | NLog logger for this class. |
private float respawnFrequency | Seconds between refills. Default 86400 (one day). |
private SpawnData spawnData | Unused field; Respawn uses the chunk's spawn data instead. |
private Timeline.IEntry waitToRefill | The Timeline entry for the repeating refill. Saved, and on load any missed refill runs on the next frame. |
Properties
| Member | What it is |
|---|---|
bool IsGenerationValueUsed { get; } | Always true. |
Methods
| Member | What 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
| Member | What 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. |