Difference between revisions of "Template:Habitats"

From RimWorld Wiki
Jump to navigation Jump to search
(made the biomes link)
(made "or" an option)
Line 2: Line 2:
 
Returns a nicely-formatted list of all the biomes an animal can appear in.
 
Returns a nicely-formatted list of all the biomes an animal can appear in.
  
For example, if used on [[Timber wolf]]: {{Habitats|Timber wolf}}
+
For example, if used on [[Timber wolf]], the result is: {{Habitats|Timber wolf}}
 +
 
 +
You can also make it produce "or" rather than "and" by doing<code><nowiki>{{Habitats|Timber wolf|or}}:</nowiki></code>{{Habitats|Timber wolf|or}}
 
</noinclude><includeonly>{{#vardefine:total_habitats|{{#expr:{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Forest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Swamp}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Rainforest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Swamp}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Arid Shrubland}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Desert}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Extreme Desert}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Boreal Forest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Cold Bog}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tundra}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Ice Sheet}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Sea Ice}}|1|0}}}}}}
 
</noinclude><includeonly>{{#vardefine:total_habitats|{{#expr:{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Forest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Swamp}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Rainforest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Swamp}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Arid Shrubland}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Desert}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Extreme Desert}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Boreal Forest}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Cold Bog}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tundra}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Ice Sheet}}|1|0}} + {{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Sea Ice}}|1|0}}}}}}
{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Forest}}|[[temperate forest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Swamp}}|[[temperate swamp]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Rainforest}}|[[tropical rainforest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Swamp}}|[[tropical swamp]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Arid Shrubland}}|[[arid shrubland]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Desert}}|[[desert]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Extreme Desert}}|[[extreme desert]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Boreal Forest}}|[[boreal forest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Cold Bog}}|[[cold bog]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tundra}}|[[tundra]]{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Ice Sheet}}|[[ice sheet]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Sea Ice}}|[[sea ice]]{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, and }}}}}}</includeonly>
+
{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Forest}}|[[temperate forest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Temperate Swamp}}|[[temperate swamp]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Rainforest}}|[[tropical rainforest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tropical Swamp}}|[[tropical swamp]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Arid Shrubland}}|[[arid shrubland]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Desert}}|[[desert]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Extreme Desert}}|[[extreme desert]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Boreal Forest}}|[[boreal forest]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Cold Bog}}|[[cold bog]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Tundra}}|[[tundra]]{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Ice Sheet}}|[[ice sheet]]s{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}{{#if:{{Q|{{{1|{{PAGENAME}}}}}|Lives In Sea Ice}}|[[sea ice]]{{#vardefine:total_habitats|{{#expr:{{#var:total_habitats}} - 1}}}}{{#ifexpr:{{#var:total_habitats}} > 1|, |{{#ifexpr:{{#var:total_habitats}} > 0|, {{{2|and}}} }}}}}}</includeonly>

Revision as of 16:19, 4 October 2021

Returns a nicely-formatted list of all the biomes an animal can appear in.

For example, if used on Timber wolf, the result is: temperate forests, temperate swamps, boreal forests, cold bogs, and tundra

You can also make it produce "or" rather than "and" by doing{{Habitats|Timber wolf|or}}: temperate forests, temperate swamps, boreal forests, cold bogs, or tundra