Template:List

From RimWorld Wiki
Jump to navigation Jump to search

This template lists the contents of the category given as its first argument, e.g. to list all pages in the category Category: Fabric, use:

   {{List|Fabric}}

Result Order and Number

Optionally, you can limit the number of pages listed, sort the list and order it. For example, to list the two most expensive fabrics, breaking ties by ease to work with them, you could use (NB: Whitespace and captitalization matter):

   {{List|Fabric|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}

This gives:

Alpacawool.png

Alpaca wool

The remarkably soft wool of an alpaca. It is warm, protects well from heat, and fetches a high price.

Alpaca wool is a type of fabric gathered by animal handlers by shearing tamed alpacas. Alpaca wool is a very good insulator, and is therefore recommended in clothing like parkas and tuques.

Bisonwool.png

Bison wool

Thick and coarse wool of a bison. Quite warm.

Bison wool is a type of fabric gathered by animal handlers by shearing tamed bison.

Cloth b.png

Cloth

Cloth woven from organic fibers.

Cloth is a basic plant-based fabric that can be grown by planting the cotton plant. It can be used to create clothing and a few specialty items like carpets. It is 20% more flammable than most other textiles.

Devilstrand b.png

Devilstrand

Fabric spun from microfibers extracted from devilstrand mushrooms. It is very tough, good at insulating, and protects exceptionally well against flame.

Devilstrand is a valuable fabric obtained from the devilstrand mushroom. It is an extremely strong fabric, much more protective than cloth and most types of leather.

Hyperweave b.png

Hyperweave

Nano-fibers woven into sheets molecule-by-molecule using specialized production mechanites. While it flexes freely most of the time, it stiffens to absorb blows as they land, and is incredibly difficult to break. The secrets of its production are known only to the most advanced glitterworld cultures.

Hyperweave is a space age, highly protective and rare fabric produced only on high-tech Glitterworlds.

Megaslothwool.png

Megasloth wool

While somewhat coarse, megasloth wool's long fibers make it very strong. It is very warm.

Megasloth wool is a type of fabric gathered by animal handlers by shearing tamed megasloth. Megasloth wool is the second warmest textile in the game, after Guinea pig fur and tied with Thrumbofur, and is essential for colonies on cold biomes like sea ice and ice sheet. It can be hard to obtain lots of it as it takes quite a while for megasloth's to produce the wool (usually only enough to make one parka) and it is rarely sold by traders.

Muffalowool.png

Muffalo wool

Soft, light and provides very good insulation. Muffalo wool clothes can keep the body warm even in very cold conditions.

Muffalo wool is a type of fabric gathered by animal handlers by shearing tamed muffalos.

Sheepwool.png

Sheep wool

Sheep's wool. It provides good insulation.

Sheep wool is a type of fabric gathered by animal handlers by shearing tamed sheep.

Synthread b.png

Synthread

Spacer-tech synthetic fabric designed for making ordinary clothes. It is soft, light, strong, and insulates well.

Synthread is a space age type of fabric only available through trading or through random drops.

Wool.png

Wool

'

Customizing Result Appearance

The list template calls the template Template:Ask/Item for every page. You can override this with its item parameter. It passes the following parameters to the item template:

Parameter Description
{{{Name}}} Name of the page
{{{Image}}} Name of the icon for the page
{{{Description}}} Description of the page (from XML)
{{{Note}}} Description of the page (user-set, usually the first paragraph of the page content)
{{{Tags}}} Name of the template that can produce the tags for the page
{{{userparam}}} Value passed to param= in the list template

How does the template work?

The template uses the Semantic MediaWiki (SMW) extension to get its data. In particular, it uses the {{#ask: ... }} parser function. You can get the full details about how it works in its official documentation, but here are the basics:

Let's return to above example:

   {{List|Fabric|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}

When MediaWiki expands that template, it becomes:

   {{#ask: [[Category: Fabric]]
    | ?# = Name
    | ?Image
    | ?Description
    | ?Note
    | ?Tags
    | format     = template
    | named args = yes
    | link       = none
    | template   = Ask/Item
    | limit      = 2
    | sort       = Market Value Base,Work To Make Factor
    | order      = desc,asc
    }}

The first line tells SMW to look for all pages in the Category: Fabric category. The new five lines start with ? and tell it which data to select from those pages (more about that below). The "?# = Name" means "take the page title and refer to it as Name". After that, the template tells SMW to called the Template:Ask/Item template for every result (format = template and template = Ask/Item), to pass along the data as named arguments, and to use only page names instead of links (e.g. "Devilstrand" instead of "[[Devilstrand]]").

Thus, the above template call becomes:

   {{Ask/Item|Name=Hyperweave|Image=File:Hyperweave.png|Description=High-tech nano-fibers...|Note=Top-of-the-shelf, incredibly tough...|Tags=Template:Textile/Tags}}
   {{Ask/Item|Name=Devilstrand|Image=File:Devilstrand.png|Description=Fabric spun...|Note=Devilstrand is obtained...|Tags=Template:Textile/Tags}}

These are then substituted normally again.

(NB: Template:Textile/Tags does not exist yet, so the Tags parameter above is empty at the moment. This will change soon.)

Where does the data come from?

SMW know about, say, the description of Devilstrand, because on the Devilstrand page there is a Template:Define template, which executes the following:

  {{#set: Description = {{{description|}}} }}

The {{#set: ... }} parser function is the opposite of {{#ask: ... }}, it tells SMW that the page in question has one or more properties or relations. For the full description, see again the official documentation.

You can browse the data available about a page by using the "Browse Properties" link under "Tools" in the menu on the left side of the screen. You can browse all page/value pairs for a property by visiting its page in the Property: namespace, e.g. Property:Market_Value_Base.