Difference between revisions of "Template:Infobox/Resource"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (! image. * wikitabled flow modes.)
m (Update logic)
 
(40 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Infobox
+
<includeonly>{{Infobox
|width=200
+
|name={{Dict/resource|{{{name|{{BASEPAGENAME}}}}}}}
|padding=.5
 
|name='''{{{name|{{BASEPAGENAME}}}}}'''
 
 
|file=none
 
|file=none
 +
|icon={{{icon|}}}
 +
|icon width={{{icon width|}}}
 
|lines=
 
|lines=
{{Infobox/Line|Density|2={{#ifeq: {{{density}}}|N|None|{{{density}}}&nbsp;kg/{{#ifeq: {{{unit|l}}}|unit|unit|<abbr title="Assuming that 1 unit = 1 liter">{{{unit|l}}}</abbr>}}}}}}
+
{{Infobox/Line|{{Infobox/Resource/Dict|Density}}|{{#ifexpr: {{{density}}} * 1000|{{#expr: {{{density}}} * 1000 round 1}}&nbsp;{{Dict|k}}{{Dict|g}}/{{Unit|{{{unit|{{Dict|l}}}}}}}|{{Dict|None}}}}}}
{{Infobox/Line|Transferable|{{#ifeq: {{{transfer}}}|N|{{No}}|{{Yes}}}}}}
+
{{Infobox/Line|{{Infobox/Resource/Dict|Transferable}}|{{Boolean|{{{transfer}}}|{{No}}}}}}
{{Infobox/Line|[[Resource#Flow modes|Flow mode]]|{{#switch: {{{flow}}}
+
{{Infobox/Line|{{Infobox/Resource/Dict|Tweakable}}|{{Boolean|{{{tweakable}}}|{{No}}}}}}
|a=Adjacent
+
{{Infobox/Line|{{Infobox/Resource/Dict|Drainable}}|{{Boolean|{{{drainable}}}|{{Yes}}}}}}
|e=Everywhere
+
{{Infobox/Line|{{Infobox/Resource/Dict|Flow Mode}}|{{#switch: {{lc:{{{flow}}}}}
|i=Internal
+
|a={{Infobox/Resource/Dict|Adjacent}}
|#default=<span class="error">Invalid flow mode</span>}}}}
+
|e={{Infobox/Resource/Dict|Everywhere}}
{{Infobox/Line|Since|{{#if: {{{since|}}}|{{version|{{{since}}}|}}|Unknown}}}}
+
|i={{Infobox/Resource/Dict|Internal}}
}}<noinclude>Infobox for [[resource]]s.
+
|n={{Dict|None}}
 
+
|#default=<span class="error" style="white-space:normal;">{{Infobox/Resource/Dict|Invalid}}</span>}}}}
== Parameters ==
+
{{Infobox/Line|{{Dict|Cost}}|{{#ifexpr: {{{cost}}}|{{{cost}}}&nbsp;{{Mark|fund}}/{{Unit|{{{unit|{{Dict|l}}}}}}}|{{Dict|None}}}}|{{#ifexpr: {{{cost}}} * ({{{density}}} * 1000)|{{#expr: {{{cost}}} / ({{{density}}} * 1000) round 2}}&nbsp;{{Mark|fund}}/{{Dict|k}}{{Dict|g}}}}}}
{{Parameter Table|name=text|parameters=
+
{{Infobox/Line|{{Dict|Since}}|{{#if: {{{since|}}}|{{version|{{{since}}}|}}|{{Dict|Unknown}}}}}}
{{ParameterRow|density|Density of the resource in kg/{{{unit}}}. Allows <tt>N</tt> for ''None'' and without unit.}}
+
}}</includeonly><noinclude>
{{ParameterRow|transfer|If this resource is transferable. Allows <tt>N</tt> for {{No}} and shows {{Yes}} for every other value.|{{Yes}}}}
+
{{Documentation}}
{{ParameterRow|flow|The [[Resource#Flow%20modes|flow mode]] of the resource.}}
 
{{ParameterRow|since|The introduction of this resource.}}
 
{{ParameterRow|unit|The unit of volume for the density.|<tt>l</tt>}}
 
}}
 
 
 
=== Flow modes ===
 
{| class="wikitable"
 
! Code
 
! Type
 
! Description
 
|-
 
| a
 
| Adjacent
 
| Resources will only flow between adjacent sources and sinks, meaning that tanks can be drained unevenly.
 
|-
 
| e
 
| Everywhere
 
| The resource is always available to all parts structurally connected to the vessel, and the same amount of resources is drained from every container.
 
|-
 
| i
 
| Internal
 
| The resource can only be used by the part containing it.
 
|}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 07:48, 17 September 2024

Documentation icon Template documentation[view] [edit] [history] [purge]Pages that link to Template:Infobox/Resource
Infobox
Density 5 kg/l
Transferable No
Tweakable Yes
Drainable No
Flow mode Adjacent
Cost 0.8 Funds/l
0.16 Funds/kg
Since version 0.20

Infobox for resources.

Parameters

Name Optional Description Default
name Yes Name of the resource. {{BASEPAGENAME}}
icon Yes Icon of the resource. Not set/Hidden
icon width Yes Width of the image. Not set/Hidden
density No Density of the resource in kg/{{{unit}}}. Allows 0 for None and without unit.
transfer Yes Whether the resource is transferable. Allows y for {{Yes}} and shows {{No}} for every other value. No
tweakable Yes Whether the resource is tweakable in the VAB/SPH. Allows y for {{Yes}} and shows {{No}} for every other value. No
drainable Yes Whether the resource is drainable. Allows n for {{No}} and shows {{Yes}} for every other value. Yes
flow No The flow mode of the resource.
cost No Cost per unit of the resource. Allows 0 for None and without unit. Also calculates costs per mass if density and cost are both not zero.
since Yes The introduction of this resource. If not set shows the value unknown. Unknown
unit Yes The unit of volume for the density. l

Flow modes

Code Type Description
a Adjacent Resources will only flow between adjacent sources and sinks, meaning that tanks can be drained unevenly.
e Everywhere The resource is always available to all parts structurally connected to the vessel, and the same amount of resources is drained from every container.
i Internal The resource can only be used by the part containing it.
n None The resource won't be pumped automatically but can be manually transferred.