A class in Root.Township, Alta.Loot.
Loot origin asset: which loot tables an item of a given rarity can come from. Rarities pick an origin at random by weight, then the origin lists the possible items.
Constructors
| Member | What it is |
|---|
Origin() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private static Origin[] allOrigins | Every origin, loaded from Resources/Items/Origins/ on first use. |
private static LootTable[] allTables | Every loot table, loaded from Resources/Items/Loot Tables/ on first use. |
private bool isAllowingLocal | If true, GetItems also uses the local tables passed in by the caller. |
private bool isWhitelist | If true, tables lists the tables to use. If false, it lists tables to leave out and every other table is used. |
private LootTable[] tables | The loot tables this origin uses, or excludes when isWhitelist is off. |
private static HashSet<LootTable.Entry> workingDistinct | Shared scratch set that removes duplicate entries in GetItems. |
Methods
| Member | What it is |
|---|
void GetItems(List<LootTable.Entry> results, PickupDock dock, Rarity rarity, params LootTable[] local) | Fills results with the distinct loot entries for a rarity from this origin's tables, the local tables if allowed, and only those the dock accepts. |
static Origin GetRandom(Rarity rarity, List<Origin> ignore) | Picks an origin from the rarity's origin weightings at random, skipping ones in ignore. Null if none is picked. |
1 private and internal method
| Member | What it is |
|---|
private static void AddEntries(HashSet<LootTable.Entry> workingDistinct, Rarity rarity, LootTable table) | Adds a table's entries for one rarity to the set, plus entries for any active festivity. |
Used in
Members of other types that take, return or hold a Origin: