Template:Construction: Difference between revisions
(Modified to use the Lua module) |
(Added support for Wood) |
||
Line 4: | Line 4: | ||
| fabric = {{{Fabric| {{{3|}}} }}} | | fabric = {{{Fabric| {{{3|}}} }}} | ||
| parts = {{{Parts| {{{4|}}} }}} | | parts = {{{Parts| {{{4|}}} }}} | ||
| wood = {{{Wood|}}} | |||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
Line 12: | Line 13: | ||
== Parameters == | == Parameters == | ||
You may elect to name the parameters explicitly (<code>Planks=</code>) or use them in the order specified in the table | You may elect to name the parameters explicitly (<code>Planks=</code>) or use them in the order specified in the table. The exception is ''Wood'', which must be declared explicitly, but is placed at the beginning of the table. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 24: | Line 25: | ||
|- | |- | ||
| Parts || Number || The number of {{rl|Parts}} required. | | Parts || Number || The number of {{rl|Parts}} required. | ||
|- | |||
| Wood || Number || The number of {{rl|Wood}} required. This will appear at the top of the table. | |||
|} | |} | ||
Line 35: | Line 38: | ||
You can also mix naming and not-naming to make it easier to write when skipping over building materials. <code><nowiki>{{Construction|8|Parts=2}}</nowiki></code> yields: {{Construction|8|Parts=2}} | You can also mix naming and not-naming to make it easier to write when skipping over building materials. <code><nowiki>{{Construction|8|Parts=2}}</nowiki></code> yields: {{Construction|8|Parts=2}} | ||
Remember you need to declare the amount of Wood explicitly. This is because <code><nowiki>{{Construction|Wood=10|Parts=3}}</nowiki></code> is much easier to read than <code><nowiki>{{Construction||||3|Wood=10}}</nowiki></code> and affords the ability to declare ''most'' construction requirements with Planks. Here's the result: | |||
{{Construction|Wood=10|Parts=3}} | |||
== Errors == | == Errors == | ||
Line 54: | Line 61: | ||
Yields: | Yields: | ||
{{Construction||10|Bricks=12}} | {{Construction||10|Bricks=12}} | ||
Finally, even though no buildings currently require it, this template does permit you to display both Wood and Planks. | |||
<pre>{{Construction|2|Wood=8}}</pre> | |||
Yields: | |||
{{Construction|2|Wood=8}} | |||
</noinclude> | </noinclude> |
Revision as of 00:38, 29 November 2023
Overview
A template to populate small, well-aligned tables of construction goods.
Parameters
You may elect to name the parameters explicitly (Planks=
) or use them in the order specified in the table. The exception is Wood, which must be declared explicitly, but is placed at the beginning of the table.
Parameter | Type | Description |
---|---|---|
Planks | Number | The number of Planks required. |
Bricks | Number | The number of Bricks required. |
Fabric | Number | The number of Fabric required. |
Parts | Number | The number of Parts required. |
Wood | Number | The number of Wood required. This will appear at the top of the table. |
Examples
This table shows all possible values. {{Construction|Planks=12|Bricks=8|Fabric=4|Parts=2}}
yields:
12 | Planks |
8 | Bricks |
4 | Fabric |
2 | Parts |
Alternatively, you do not have to name the parameters. {{Construction|12|8|4|2}
yields the same thing:
12 | Planks |
8 | Bricks |
4 | Fabric |
2 | Parts |
You can also mix naming and not-naming to make it easier to write when skipping over building materials. {{Construction|8|Parts=2}}
yields:
8 | Planks |
2 | Parts |
Remember you need to declare the amount of Wood explicitly. This is because {{Construction|Wood=10|Parts=3}}
is much easier to read than {{Construction||||3|Wood=10}}
and affords the ability to declare most construction requirements with Planks. Here's the result:
10 | Wood |
3 | Parts |
Errors
This template does not result in any errors. However, there is no use for a template called without parameters.
{{Construction}}
Yields:
(It's there, but it's a blank table.)
The template also does not prevent you from mixing both named and unnamed parameters, but the result will be whichever is defined last.
{{Construction||10|Bricks=12}}
Yields:
12 | Bricks |
Finally, even though no buildings currently require it, this template does permit you to display both Wood and Planks.
{{Construction|2|Wood=8}}
Yields:
8 | Wood |
2 | Planks |