Inventory Display Scripts

Inventory Display Scripts
All relevant code is contained in Inventory/scripts/INV_Scripts.dh

void DisplayInventory, DisplayCrafting, DisplayEquipment, DisplayStash

Display scripts are broken up per display window, and are generally similar, with some differences.

The bulk of each script is a nested iterative loop running through the InventoryDef[][] array belonging to the chosen window. It displays a GridButton at each coordinate, and responds to LMB/RMB clicks.
 * With an empty cursor, LMB clicks on populated slots result in SwitchItemToCursor
 * While holding an item, LMB clicks on free OR populated slots result in SwitchCursorToItem
 * If an item is held when the script is toggled off, it will call SortInventory and PlaceItemInClosestSlot

Inventory

 * The inventory array size is variable dependent on the players bag upgrades

Crafting

 * For each item placed in the Crafting window, it runs CheckCraftArea

Equipment

 * These three windows are not arrays and therefore use SingleButton
 * Item class must match the window type in order to be placed in its slot.
 * Item size is ignored.

Stash

 * Stashes must first initialize their array indexes using PopulateChest
 * And then DepopulateChest