24,539
ARTICLES
ON THIS WIKI
ON THIS WIKI
Module:Grid/T4Aspect
This is the Lua module for Template:Grid/T4Aspect. Below is the documentation for that template. |
This template is used to display Thaumcraft 4 aspects in grid templates, similar to {{Grid/Item}}, this template can show an amount and tooltip for the aspect.
Syntax[edit]
{{Grid/T4Aspect|<params>}}
Parameters[edit]
-
name
: The aspect's name, always used for hover text, and is used to determine image name and link target if not overwritten. -
top
: Distance of the top-left image corner from the top edge of the grid. -
left
: Distance of the top-left image corner from the left edge of the grid. -
link
: Replacement link target. Default: List of Aspects -
amount
: Stack size number, must be between 2 and 64 to be displayed. Default: Hidden
local p = {}
local g = require("Module:Common")
local s = require("Module:Sprite")
local cn = require("Module:Grid/Crafting_Square_Numbers")
p.aspects = {
["aer"] = 2;
["alienis"] = 3;
["aqua"] = 4;
["arbor"] = 5;
["auram"] = 6;
["bestia"] = 7;
["citrus"] = 67; -- PFG
["cognitio"] = 8;
["coralos"] = 77; -- ABI
["corpus"] = 9;
["desidia"] = 50; -- FM
["dreadia"] = 76; -- ABI
["electrum"] = 57; -- GT
["exanimis"] = 10;
["exubitor"] = 64; -- TW
["fabrico"] = 11;
["fames"] = 12;
["fluctuatio"] = 68; -- TE
["fluxus"] = 68; -- PFG
["gelum"] = 13;
["granum"] = 65; -- TA
["gula"] = 51; -- FM
["herba"] = 14;
["humanus"] = 15;
["ignis"] = 16;
["infernus"] = 52; -- FM
["instrumentum"] = 17;
["invidia"] = 53; -- FM
["ira"] = 54; -- FM
["iter"] = 18;
["limus"] = 19;
["lucrum"] = 20;
["lux"] = 21;
["luxuria"] = 55; -- FM
["machina"] = 22;
["magnes"] = 69; -- PFG
["magneto"] = 58; -- GT
["matrix"] = 73; -- ET
["messis"] = 23;
["metallum"] = 24;
["meto"] = 25;
["mortuus"] = 26;
["motus"] = 27;
["mru"] = 71; -- ET
["nebrisum"] = 59; -- GT
["ordo"] = 28;
["pannus"] = 29;
["perditio"] = 30;
["perfodio"] = 31;
["permutatio"] = 32;
["potentia"] = 33;
["praecantatio"] = 34;
["radiation"] = 72; -- ET
["radio"] = 60; -- GT
["revelatio"] = 70; -- PFG
["sanctus"] = 63; -- TheE
["sano"] = 35;
["saxum"] = 66; -- TA
["sensus"] = 36;
["spiritus"] = 37;
["strontio"] = 61; -- GT
["superbia"] = 56; -- FM
["telum"] = 38;
["tempestas"] = 39;
["tempus"] = 62; -- MB
["tenebrae"] = 40;
["terminus"] = 74; -- Avaritia
["terra"] = 41;
["tincturem"] = 75; -- BA
["tutamen"] = 42;
["unknown"] = 1;
["vacuos"] = 43;
["venenum"] = 44;
["victus"] = 45;
["vinculum"] = 46;
["vitium"] = 47;
["vitreus"] = 48;
["volatus"] = 49;
}
function p.makeAspect(name, amount, link, tooltip, top, left)
local sprite = p.aspects[name:lower()] or p.aspects['unknown']
local output = '<div data-tooltip="' .. tooltip .. '" class="tooltip griditem" '
output = output .. 'style="top:' .. g.px(top) .. ';left:' .. g.px(left)
output = output .. '">' .. s.makeSprite('T4aspects.png', sprite - 1, 32, 512, link, g.cap(name))
output = output .. '</div>'
if amount > 1 or amount == 0 then
output = output .. '<div data-tooltip="' .. tooltip .. '" class="tooltip gridamount" '
output = output .. 'style="top:' .. g.px(top + 16) .. ';left:' .. g.px(left - 4)
output = output .. '">' .. cn.makeCraftingNumbers(amount, link) .. '</div>'
end
return output
end
function p.makeShadedAspect(name, amount, link, tooltip, top, left)
local output = '<div data-tooltip="' .. tooltip .. '" class="tooltip griditem" '
output = output .. 'style="width:64px;height:64px;'
output = output .. 'top:' .. g.px(top) .. ';left:' .. g.px(left)
output = output .. '">' .. g.img('T4aspectback.png', "64px", link, g.cap(name))
output = output .. '</div>'
return output .. p.makeAspect(name, amount, link, tooltip, top + 16, left + 16)
end
function p.main(frame)
local frame, args = g.getFrameAndArgs(frame)
local name = args.name
if not g.isGiven(name) then
name = 'unknown'
end
name = g.cap(name:lower())
local amount = 1
if g.isGiven(args.amount) and tonumber(args.amount) then
amount = tonumber(args.amount)
end
local tooltip = name
if amount > 1 or amount == 0 then
tooltip = amount .. ' ' .. tooltip
end
local top = 0
if g.isGiven(args.top) and tonumber(args.top) then
top = tonumber(args.top)
end
local left = 0
if g.isGiven(args.left) and tonumber(args.left) then
left = tonumber(args.left)
end
local link = 'List of Aspects'
if g.isGiven(args.link) then
link = args.link
end
local output = ''
if g.isGiven(args.shaded) then
output = p.makeShadedAspect(name, amount, link, tooltip, top, left)
if g.isGiven(args.nogrid) then
output = '<div class="tc4aspect _64px">' .. output .. '</div>'
end
else
output = p.makeAspect(name, amount, link, tooltip, top, left)
if g.isGiven(args.nogrid) then
output = '<div class="tc4aspect _32px">' .. output .. '</div>'
end
end
return output
end
return p
View All FTB Twitter Feed
Discussion
To discuss the topics on this wiki, you can visit our community forums!