Template:Buildingbox: Difference between revisions

From Against the Storm Official Wiki
m (76561197969631737 moved page Template:Shopbox to Template:Buildingbox: Wrote a better module that handles all buildings. moving this to not break existing pages.)
(Made generic instead of specific to industry buildings)
Line 1: Line 1:
<includeonly>{{#invoke: Shopbox|renderShopbox
<includeonly>{{#invoke: Buildingbox|renderBuildingbox
| name= {{{name| {{{1|}}} }}}
| name= {{{name| {{{1|}}} }}}
| purpose={{{purpose|}}}
| purpose={{{purpose|}}}
Line 6: Line 6:
}}</includeonly><noinclude>
}}</includeonly><noinclude>


{{Shopbox|name=Cookhouse}}
{{Buildingbox|name=Mine}}


'''Shopbox''' is a template that creates an infobox on the page by displaying data provided by template parameters and loading data from the data template [[Template:Workshops_csv]]. The infobox to the right on this page is an example.
'''Buildingbox''' is a template that creates an infobox on the page by displaying data provided by template parameters and loading data about the building corresponding to the name requested. The infobox to the right on this page is an example.


== Overview ==
== Overview ==


This template should be used for all Production Buildings on the wiki, that is, buildings whose recipes convert goods into other goods. The template requires only the <code>name</code> parameter, which tells the code behind the scenes which building you want an infobox for.
This template should be used for all production, service, gathering, farming, and collecting buildings on the wiki—that is, any building with a recipe (not Hearths, Warehouses, or Housing). The template requires only the <code>name</code> parameter, which tells the code behind the scenes which building you want an infobox for.


In the future, this template could be augmented to automatically create categories based on the information retrieved. For example, the infobox for the [[Cookhouse]] could add categories for food production, complex food, crafting materials, large buildings, or even 2-star buildings.
In the future, this template could be augmented to automatically create page categories based on the information retrieved. For example, the infobox for the [[Cookhouse]] could add categories for food production, complex food, crafting materials, large buildings, or even 2-star buildings.


== Parameters ==
== Parameters ==
Line 39: Line 39:
'''Example:'''
'''Example:'''


<pre>{{Shopbox}}</pre>
<pre>{{Buildingbox}}</pre>


Yields:
Yields:


{{Shopbox}}
{{Buildingbox}}


When providing the name of a building, it is important that it is spelled correctly, including any punctuation. Otherwise, an error will return from the data module.
When providing the name of a building, it is important that it is spelled correctly, including any punctuation. Otherwise, an error will return from the data module.
Line 49: Line 49:
'''Example:'''
'''Example:'''


Broken: <code><nowiki>{{Shopbox|name=Alchemist Hut}}</nowiki></code>
Broken: <code><nowiki>{{Buildingbox|name=Alchemist Hut}}</nowiki></code>


{{Shopbox|name=Alchemist Hut}}
{{Buildingbox|name=Alchemist Hut}}


Fixed:  <code><nowiki>{{Shopbox|name=Alchemist's Hut}}</nowiki></code>
Fixed:  <code><nowiki>{{Buildingbox|name=Alchemist's Hut}}</nowiki></code>


{{Shopbox|name=Alchemist's Hut}}
{{Buildingbox|name=Alchemist's Hut}}
</noinclude>
</noinclude>

Revision as of 16:28, 24 December 2023


Script error: The function "renderBuildingbox" does not exist.

Buildingbox is a template that creates an infobox on the page by displaying data provided by template parameters and loading data about the building corresponding to the name requested. The infobox to the right on this page is an example.

Overview

This template should be used for all production, service, gathering, farming, and collecting buildings on the wiki—that is, any building with a recipe (not Hearths, Warehouses, or Housing). The template requires only the name parameter, which tells the code behind the scenes which building you want an infobox for.

In the future, this template could be augmented to automatically create page categories based on the information retrieved. For example, the infobox for the Cookhouse could add categories for food production, complex food, crafting materials, large buildings, or even 2-star buildings.

Parameters

Only the first, name is required, and it must be spelled correctly to match the in-game name of the building. Other parameters are optional, but add to the value of displaying the infobox.

Parameter Type Description
name string Required. The in-game name of the building for which you want to display the infobox. Will also serve as the header of the box.
purpose string The overall purpose of the building, such as "Services" or omit this parameter. For example, if the purpose is "Industry," the infobox will already show "Industry" for the building's Category, so you may omit it.
species_preference string For buildings that provide services consumed by villagers, you may write which species prefers these services. For example, Leisure is preferred by "Beaver, Human." (Do not duplicate specialization information as species preferences.)
specializations string For buildings with specializations, you can include them here.

Errors

When the template is called without a name, the template reminds you that it is required.

Example:

{{Buildingbox}}

Yields:

Script error: The function "renderBuildingbox" does not exist.

When providing the name of a building, it is important that it is spelled correctly, including any punctuation. Otherwise, an error will return from the data module.

Example:

Broken: {{Buildingbox|name=Alchemist Hut}}

Script error: The function "renderBuildingbox" does not exist.

Fixed: {{Buildingbox|name=Alchemist's Hut}}

Script error: The function "renderBuildingbox" does not exist.