Difference between revisions of "Template:Required Resources"

From RimWorld Wiki
Jump to navigation Jump to search
(Added a multiplier as a second parameter)
(Not certain about this, but clarity?)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#if:{{#vardefineecho:r1|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}}}|{{#ifeq:{{lc:{{#var:r1}}}}|nutrition||{{Icon Small|{{#var:r1}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r1}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Type}})|{{#if:{{{simple|}}}||[[{{#var:r1}}]]}} }}<!--
+
<includeonly>{{#if:{{#vardefineecho:r1|{{Q|{{#vardefineecho:name|{{{1|{{PAGENAME}}}}} }}|Resource 1}} }}|{{#vardefine:r1a|{{#expr:{{Q|{{#var:name}}|Resource 1 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r1}} }} | nutrition
-->{{#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}}]]}})}}<!--
+
| {{#var:r1a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 1 Type}})
-->{{#if:{{#vardefineecho:r2|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition||{{Icon Small|{{#var:r2}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Type}})|{{#if:{{{simple|}}}||[[{{#var:r2}}]]}} }} }}<!--
+
| {{Icon Small|{{#var:r1}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r1a}}|{{Plural|{{#var:r1a}}|{{#var:r1}}|link=1}} }}
-->{{#if:{{#vardefineecho:r3|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition||{{Icon Small|{{#var:r3}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Type}})|{{#if:{{{simple|}}}||[[{{#var:r3}}]]}} }} }}<!--
+
}} }}<!--
-->{{#if:{{#vardefineecho:r4|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition||{{Icon Small|{{#var:r4}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Type}})|{{#if:{{{simple|}}}||[[{{#var:r4}}]]}} }} }}<!--
+
-->{{#ifeq:{{lc:{{#var:r1}}}}|stuff|<nowiki> </nowiki>([[{{#explode:{{#vardefineecho:stuffTags|{{Q|{{#var:name}}|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}}]]}}{{#if:{{#pos:{{lc:{{#var:stuffTags}}}}|metallic}}|, {{#expr:10*{{#var:r1a}}}} for [[Small volume material|SMVs]]}})}}<!--
-->{{#if:{{#vardefineecho:r5|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition||{{Icon Small|{{#var:r5}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Type}})|{{#if:{{{simple|}}}||[[{{#var:r5}}]]}} }} }}<!--
+
-->{{#if:{{#vardefineecho:r2|{{Q|{{#var:name}}|Resource 2}} }}|{{{sep|,}}}{{#vardefine:r2a|{{#expr:{{Q|{{#var:name}}|Resource 2 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r2}} }} | nutrition
-->{{#if:{{#vardefineecho:r6|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition||{{Icon Small|{{#var:r6}}}}&nbsp;}}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Type}})|{{#if:{{{simple|}}}||[[{{#var:r6}}]]}} }} }} }}</includeonly><noinclude>
+
| {{#var:r2a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 2 Type}})
 +
| {{Icon Small|{{#var:r2}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r2a}}|{{Plural|{{#var:r2a}}|{{#var:r2}}|link=1}} }}
 +
}} }}<!--
 +
-->{{#if:{{#vardefineecho:r3|{{Q|{{#var:name}}|Resource 3}} }}|{{{sep|,}}}{{#vardefine:r3a|{{#expr:{{Q|{{#var:name}}|Resource 3 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r3}} }} | nutrition
 +
| {{#var:r3a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 3 Type}})
 +
| {{Icon Small|{{#var:r3}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r3a}}|{{Plural|{{#var:r3a}}|{{#var:r3}}|link=1}} }}
 +
}} }}<!--
 +
-->{{#if:{{#vardefineecho:r4|{{Q|{{#var:name}}|Resource 4}} }}|{{{sep|,}}}{{#vardefine:r4a|{{#expr:{{Q|{{#var:name}}|Resource 4 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r4}} }} | nutrition
 +
| {{#var:r4a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 4 Type}})
 +
| {{Icon Small|{{#var:r4}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r4a}}|{{Plural|{{#var:r4a}}|{{#var:r4}}|link=1}} }}
 +
}} }}<!--
 +
-->{{#if:{{#vardefineecho:r5|{{Q|{{#var:name}}|Resource 5}} }}|{{{sep|,}}}{{#vardefine:r5a|{{#expr:{{Q|{{#var:name}}|Resource 5 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r5}} }} | nutrition
 +
| {{#var:r5a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 5 Type}})
 +
| {{Icon Small|{{#var:r5}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r5a}}|{{Plural|{{#var:r5a}}|{{#var:r5}}|link=1}} }}
 +
}} }}<!--
 +
-->{{#if:{{#vardefineecho:r6|{{Q|{{#var:name}}|Resource 6}} }}|{{{sep|,}}}{{#vardefine:r6a|{{#expr:{{Q|{{#var:name}}|Resource 6 Amount}}*{{{2|1}}}}} }} {{#ifeq:{{lc:{{#var:r6}} }} | nutrition
 +
| {{#var:r6a}} [[Nutrition]] ({{Q|{{#var:name}}|Resource 6 Type}})
 +
| {{Icon Small|{{#var:r6}} }}&nbsp;{{#if:{{{simple|}}}|{{#var:r6a}}|{{Plural|{{#var:r6a}}|{{#var:r6}}|link=1}} }}
 +
}} }}</includeonly><noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 02:32, 16 June 2024

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

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

Parameters[edit]

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[edit]

{{Required Resources|Plate armor}}

Stuff 170 Stuff (Metallic/Woody, 1700 for SMVs)


{{Required Resources|Plate armor|3}}

Stuff 510 Stuff (Metallic/Woody, 5100 for SMVs)


{{Required Resources|Phoenix armor}}

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


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

Plasteel 150 Plasteel + Uranium 50 Uranium + Advanced component 6 Advanced components + Steel 75 Steel + Component 4 Components + 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 300 + Uranium 100 + Advanced component 12 + Steel 150 + Component 8 + Chemfuel 80