Jump to content

Module:Factory slot/doc

From The Perfect Tower II
Revision as of 01:41, 7 October 2026 by Speedybrain (talk | contribs) (Documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Factory slot

Draws one slot of a Factory grid: an item icon with its stack count. Module:UI uses it for the crafting grids of {{Crafting}}, and Module:Recipe table uses its stack parser. Inspired by and partially based on Minecraft Wiki's Module:Inventory slot.

The look is in Template:Crafting/styles.css (TemplateStyles). main adds that stylesheet; when a module calls slot, the module adds it, as Module:UI does.

Item stacks

A stack is written Name or Name,count. A tier at the end, Circuit Plate T3 or Circuit Plate [T3], gives the name Circuit Plate [T3] and the icon File:Circuit Plate T3.png, shown at 32×32 pixels and pixelated. Counts above 1 show in the corner of the slot: in full below a million, then as 1.5E6 (the E with the brand kit class .tpt-num__e), and as ∞ from 1E18 or when written ∞. The slot count always uses this notation; it doesn't follow the reader's number format.

Counts can be written in full or in E notation, with either case: Plate,1500000, Plate,1.5e6 and Plate,1.5E6 are the same stack.

Functions

  • slot(args): the slot as an mw.html span. args[1] is a stack string or table; without it the slot is empty. link is the page the icon and count link to (no link when empty or no). class and style go on the slot, itemClass and itemStyle on the item, numStyle on the count.
  • main(frame): the same for {{Factory slot}}, which no page uses at the moment.
  • parseStack(text) and stringifyStack(stack): convert between stack strings and { name, count } tables.
  • formatCount(count): the count text, or nil for counts below 2.