Module:OOOInfoBox: Difference between revisions
No edit summary |
No edit summary |
||
| Line 124: | Line 124: | ||
-- Basics | -- Basics | ||
add_group(box, 'General', { | |||
{'Category', pick(args, data, 'category')}, | |||
{'Subcategory',pick(args, data, 'subcategory')}, | |||
{'Price', pick(args, data, 'price')}, | |||
{'Art Number', art}, | |||
{'Domain', domain}, | |||
}) | |||
-- Performance (auto-hides if empty) | |||
add_group(box, 'Performance', { | |||
{'Throughput (m³/h)', pick(args, data, 'throughput_m3h')}, | |||
{'Capacity', pick(args, data, 'capacity')}, | |||
}) | |||
-- I/O (mergers/splitters etc.) | -- Power (keep separate from Performance; easy to add more later) | ||
add_group(box, 'Power', { | |||
{'Power (kW)', with_unit(pick(args, data, 'power_kw'), U.kw)}, | |||
-- Example for later: {'Generated (MW)', with_unit(pick(args, data, 'power_generated_mw'), U.mw)}, | |||
}) | |||
-- I/O (mergers/splitters etc.) | |||
add_group(box, 'I/O', { | |||
{'Conveyor inputs', pick(args, data, 'beltInputs')}, | |||
{'Conveyor outputs', pick(args, data, 'beltOutputs')}, | |||
{'Pipeline inputs', pick(args, data, 'pipeInputs')}, | |||
{'Pipeline outputs', pick(args, data, 'pipeOutputs')}, | |||
}) | |||
-- Dimensions: supports size={x,y,z} and compact/expanded modes | |||
local sx, sy, sz | |||
if data.size and type(data.size) == 'table' then | |||
sx, sy, sz = data.size.x, data.size.y, data.size.z | |||
end | |||
local size_w = pick(args, data, 'size_width') or sx | |||
local size_l = pick(args, data, 'size_length') or sy | |||
local size_h = pick(args, data, 'size_height') or sz | |||
local size_note = pick(args, data, 'size_note') | |||
local dims_mode = (args.dimensions or ''):lower() -- "compact" or "expanded" | |||
if dims_mode == '' then dims_mode = 'compact' end -- default: compact line | |||
if size_w or size_l or size_h | if dims_mode == 'compact' then | ||
local function fmt(x) return x and tostring(x) or '' end | |||
local compact = nil | |||
if size_w or size_l or size_h then | |||
compact = table.concat({fmt(size_w), '×', fmt(size_l), (size_h and '×' or ''), fmt(size_h)}, '') | |||
compact = mw.text.trim(compact) | |||
if compact ~= '' then compact = compact .. U.m end | |||
end | end | ||
add_group(box, 'Dimensions', { | |||
{'Overall', compact, 'Width × Length × Height'}, | |||
{'Note', size_note}, | |||
}) | |||
else | |||
add_group(box, 'Dimensions', { | |||
{'Width', with_unit(size_w, U.m), 'Measured outer width'}, | |||
{'Length', with_unit(size_l, U.m), 'Measured outer length'}, | |||
{'Height', with_unit(size_h, U.m), 'Measured to highest point'}, | |||
(tonumber(size_w) and tonumber(size_l)) | |||
and {'Area', with_unit(tonumber(size_w)*tonumber(size_l), U.m2)} | |||
or nil, | |||
{'Note', size_note}, | |||
}) | |||
end | |||
out:node(box) | out:node(box) | ||