Difference between revisions of "Template:Required Resources"

From RimWorld Wiki
Jump to navigation Jump to search
(fixed handling of nutrition)
(better support for nutrition; simplification)
Line 1: Line 1:
<includeonly>{{#vardefine:notfirst|}}{{#if: {{Q|{{{1|{{PAGENAME}}}}}|Resource 1}} | {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}]]}}{{#ifeq: {{Q|{{{1|{{PAGENAME}}}}}|Resource 1}} | Stuff | &nbsp;({{#if: {{#pos:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|leathery}} |[[Leather]]{{#vardefine:notfirst|1}}}}{{#if: {{#pos:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|fabric}}  |{{#if:{{#var:notfirst}}|/|}}[[Fabric]]{{#vardefine:notfirst|1}}}}{{#if: {{#pos:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|woody}}   |{{#if:{{#var:notfirst}}|/|}}[[Wood]]{{#vardefine:notfirst|1}}}}{{#if: {{#pos:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|metallic}} |{{#if:{{#var:notfirst}}|/|}}[[Metals]]{{#vardefine:notfirst|1}}}}{{#if: {{#pos:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|stony}}   |{{#if:{{#var:notfirst}}|/|}}[[Stone]]}})}}{{#if:
+
<includeonly>{{#if:{{#vardefineecho:r1|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}}}|{{#ifeq:{{lc:{{#var:r1}}}}|nutrition||{{Icon Small|{{#var:r1}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Amount}} {{#ifeq:{{lc:{{#var:r1}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Type}})|{{#if:{{{simple|}}}||[[{{#var:r1}}]]}} }}<!--
{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}} |{{{sep|, }}} {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}]]}} }}{{#if:
+
-->{{#ifeq: {{lc:{{#var:r1}}}} | stuff | &nbsp;([[{{#explode:{{#vardefineecho:stuffTags|{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|,}}]]{{#if:{{#explode:{{#var:stuffTags}}|,|1}}|/[[{{#explode:{{#var:stuffTags}}|,|1}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|2}}|/[[{{#explode:{{#var:stuffTags}}|,|2}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|3}}|/[[{{#explode:{{#var:stuffTags}}|,|3}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|4}}|/[[{{#explode:{{#var:stuffTags}}|,|4}}]]}})}}<!--
{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}} |{{{sep|, }}} {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}]]}} }}{{#if:
+
-->{{#if:{{#vardefineecho:r2|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition||{{Icon Small|{{#var:r2}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Amount}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Type}})|{{#if:{{{simple|}}}||[[{{#var:r2}}]]}} }} }}<!--
{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}} |{{{sep|, }}} {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}]]}} }}{{#if:
+
-->{{#if:{{#vardefineecho:r3|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition||{{Icon Small|{{#var:r3}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Amount}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Type}})|{{#if:{{{simple|}}}||[[{{#var:r3}}]]}} }} }}<!--
{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}} |{{{sep|, }}} {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}]]}} }}{{#if:
+
-->{{#if:{{#vardefineecho:r4|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition||{{Icon Small|{{#var:r4}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Amount}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Type}})|{{#if:{{{simple|}}}||[[{{#var:r4}}]]}} }} }}<!--
{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}} |{{{sep|, }}} {{#if:{{Q|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}|Image}}|{{Icon Small|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}|16}}}} {{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Amount}} {{#if: {{{simple|}}}|{{#ifeq:{{lc:{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}}}|nutrition|[[Nutrition]]}}|[[{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}]]}} }} }}</includeonly><noinclude>
+
-->{{#if:{{#vardefineecho:r5|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition||{{Icon Small|{{#var:r5}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Amount}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Type}})|{{#if:{{{simple|}}}||[[{{#var:r5}}]]}} }} }}<!--
 +
-->{{#if:{{#vardefineecho:r6|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition||{{Icon Small|{{#var:r6}}}}&nbsp;}}{{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Amount}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Type}})|{{#if:{{{simple|}}}||[[{{#var:r6}}]]}} }} }} }}</includeonly><noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 20:27, 19 September 2022

Documentation icon Template documentation[view] [edit] [history] [purge]

Returns a list of the resources required to make an item.

Parameters

First parameter is the item whose required resources are to be returned (optional, default = PAGENAME).

Second parameter is a multiplier (optional, default = 1).

sep is the seperator parameter (optional, default = ",").

simple removes the name of the time and only leaves the icon (set to any text or value, usually "1").

Examples

{{Required Resources|Plate armor}}

Stuff 170 Stuff (Metallic/Woody)


{{Required Resources|Plate armor|3}}

Stuff 170 Stuff (Metallic/Woody)


{{Required Resources|Phoenix armor}}

Plasteel 150 Plasteel, Uranium 50 Uranium, Advanced component 6 Advanced component, Steel 75 Steel, Component 4 Component, Chemfuel 40 Chemfuel


{{Required Resources|Phoenix armor|sep=&nbsp;+}}

Plasteel 150 Plasteel + Uranium 50 Uranium + Advanced component 6 Advanced component + Steel 75 Steel + Component 4 Component + Chemfuel 40 Chemfuel


{{Required Resources|Phoenix armor|sep=&nbsp;+|simple=1}}

Plasteel 150  + Uranium 50 + Advanced component 6 + Steel 75 + Component 4 + Chemfuel 40


{{Required Resources|Phoenix armor|sep=&nbsp;+|simple=1|2}}

Plasteel 150  + Uranium 50 + Advanced component 6 + Steel 75 + Component 4 + Chemfuel 40