Skip to main content

Origin

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​

MemberWhat it is
Origin()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

6 private and internal fields
MemberWhat it is
private static Origin[] allOriginsEvery origin, loaded from Resources/Items/Origins/ on first use.
private static LootTable[] allTablesEvery loot table, loaded from Resources/Items/Loot Tables/ on first use.
private bool isAllowingLocalIf true, GetItems also uses the local tables passed in by the caller.
private bool isWhitelistIf true, tables lists the tables to use. If false, it lists tables to leave out and every other table is used.
private LootTable[] tablesThe loot tables this origin uses, or excludes when isWhitelist is off.
private static HashSet<LootTable.Entry> workingDistinctShared scratch set that removes duplicate entries in GetItems.

Methods​

MemberWhat 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
MemberWhat 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: