Jump to content

Module:UI/doc

From The Perfect Tower II

This is the documentation page for Module:UI

Draws Factory interfaces. It has one so far, the crafting grid, which Module:Recipe table calls for {{Crafting}} (through Module:Crafting). Inspired by Minecraft Wiki's Module:UI. The look is in Template:Crafting/styles.css (TemplateStyles), which the grid adds itself.

  • crafting(args): the 8×4 input grid, the output slot and the cost.
    • The inputs are A1 to H4 (columns A to H, rows 1 to 4) and the output is Output. Each takes an item stack as described in Module:Factory slot, which draws the slots. A slot's link is A1link and so on, Olink for the output.
    • The smallest rectangle that holds all inputs, at least 2×2, is drawn from the top-left corner as open slots; the rest of the 8×4 grid is drawn as locked slots.
    • cost is the cost in Factory resources, formatted by Module:FormatNumber, so it follows the reader's number format (scientific notation or named numbers). It defaults to 0, and negative values show as 0.
  • formatDoubleInteger(amount, nonNegative): an older formatter for counts (1.5E6, ∞). The grid only calls it when cost isn't a number, and then it returns a "NaN" error.