Template:Construction: Difference between revisions
Updated template to support pipes. updated doc |
m added category |
||
| Line 71: | Line 71: | ||
Yields: | Yields: | ||
{{Construction|2|Wood=8}} | {{Construction|2|Wood=8}} | ||
</noinclude> | |||
[[Category:Lua-based templates]]</noinclude> | |||
Revision as of 03:56, 2 October 2024
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 |
| Bricks | number | The number of |
| Fabric | number | The number of |
| Parts | number | The number of |
| Wood | number | The number of Wood=
|
| Pipes | number | The number of Pipes=
|
Examples
This table shows all possible values. {{Construction|Planks=12|Bricks=8|Fabric=4|Parts=2|Wood=10|Pipes=4}} yields:
| 10 | |
| 12 | |
| 8 | |
| 4 | |
| 2 | |
| 4 |
Alternatively, you do not have to name some of the parameters. {{Construction|12|8|4|2} yields the same thing:
| 10 | |
| 12 | |
| 8 | |
| 4 | |
| 2 | |
| 4 |
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 | |
| 2 |
Remember you need to declare the amount of Wood and Pipes 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 | |
| 3 |
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 |
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 | |
| 2 |


