Difference between revisions of "Template:Infobox/Part"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (Changing template to use my missing image placeholder by default. It wanted a file in the JPEG format, which doesn't support transparency.)
m (Add option for default variant cost/mass)
 
(268 intermediate revisions by 35 users not shown)
Line 1: Line 1:
{| border="0" style="padding-left: 10px; padding-right: 10px; float:right; width:200px; border: 1px solid #cccccc; background-color:#f0f0f0"
+
<includeonly>{{Infobox|width=280
! colspan="2" | {{{Name|{{PAGENAME}}}}}
+
|name={{Dict/part name|{{#if: {{{name|}}}|{{{name}}}|{{BASEPAGENAME}}}}}}
|-
+
|file={{{file|}}}
| colspan="2" style="text-align: center;" | ''{{{Role|??}}}'' <small>([[{{{Class|??}}}]])</small>
+
|hovertext={{Infobox/Part/Dict|Image}}
|-
+
|lines=
| colspan="2" style="text-align: center;" | [[File:{{{File|Image-needed.png}}}|180px|Part image]]
+
<!-- Type + Manufacturer -->
|-
+
{{Infobox/Line|{{#if: {{Infobox/Part/roles|{{{type|}}}|{{{role|}}}}}|'''{{Infobox/Part/roles|{{{type|}}}|{{{role|}}}}}'''}} <span style{{=}}"font-size:smaller; white-space:normal;">{{Dict|by}} {{#if: {{{type|}}}{{{role|}}}|<br/>}}{{Infobox/Part/Manufacturer entry|{{Infobox/Part/ManufacturerUntranslated|{{#if: {{{manufacturer|}}}|{{{manufacturer}}}|?}}}}|{{Infobox/Part/Manufacturer|{{#if: {{{manufacturer|}}}|{{{manufacturer}}}|?}}}}}}{{#if: {{{manufacturer2|}}}|
| Costs || {{{Costs|??}}}
+
<!-- Manufacturer2 -->
|-
+
{{Dict|and}} {{Infobox/Part/Manufacturer entry|{{Infobox/Part/ManufacturerUntranslated|{{#if: {{{manufacturer2|}}}|{{{manufacturer2}}}|?}}}}|{{Infobox/Part/Manufacturer|{{#if: {{{manufacturer2|}}}|{{{manufacturer2}}}|?}}}}}}}}</span>|style=text-align: center}}{{#if: {{{size|}}}|<br/>
| Mass || {{{Mass|??}}} kg
+
<!-- Radial Size -->
{{{More|}}}
+
{{Infobox/Line|[[Radial size{{if lang}}|{{Infobox/Part/Dict|Size}}]]|<span style{{=}}"white-space:normal;">{{Radial size|{{{size}}}}}{{#if: {{{size2|}}}|, {{Radial size|{{{size2}}}}}}}{{#if: {{{size3|}}}|, {{Radial size|{{{size3}}}}}}}{{#if: {{{size4|}}}|, {{Radial size|{{{size4}}}}}}}</span>}}}}
|-
+
<!-- Cost -->
| since || {{{since|??}}}
+
{{Infobox/Line|{{Dict|Cost}}|{{Formatnum|{{#expr: {{{costs}}}+({{{capacity|0}}}*35+{{{motorCost|0}}}*(100*0.01*{{{motorOutput|0}}}))+{{{variantCost|0}}}}}|2}}&nbsp;{{Mark|fund}}|{{#if: {{{lf|}}}{{{ox|}}}{{{mp|}}}{{{sf|}}}{{{xg|}}}{{{ia|}}}{{{eva|}}}{{{or|}}}{{{ab|}}}{{{capacity|}}}{{{motorOutput|}}}{{{motorCost|}}}|{{Formatnum|{{#expr: {{{costs}}}-({{{lf|0}}}*0.8+{{{ox|{{{lf|0}}}*11/9}}}*0.18+{{{mp|0}}}*1.2+{{{sf|0}}}*0.6+{{{xg|0}}}*4+{{{ia|0}}}*0+{{{eva|0}}}*0+{{{or|0}}}*0.02+{{{ab|0}}}*0.5)}}|2}}&nbsp;{{Mark|fund}}}}
|-
+
|type1={{Infobox/Part/Dict|Total}}
| colspan="2" style="text-align: center;" | <small>[[{{{cfg}}}|view part.cfg]]</small>
+
|type2={{Infobox/Part/Dict|Dry}}}}
|}
+
<!-- Mass -->
<includeonly>
+
{{Infobox/Line|{{Infobox/Part/Dict|Mass}}|{{Formatnum|{{#expr: {{{mass}}}+({{{lf|0}}}*0.005+{{{ox|{{{lf|0}}}*11/9}}}*0.005+{{{mp|0}}}*0.004+{{{sf|0}}}*0.0075+{{{xg|0}}}*0.0001+{{{ia|0}}}*0.005+{{{eva|0}}}*0.005+{{{or|0}}}*0.01+{{{ab|0}}}*0.001+{{#ifeq: {{{crew|0}}}|0|{{{capacity|0}}}*{{#ifeq: {{{applyKerbalMass|y}}}|y|0.049|0.094}}|0}}+{{{motorMass|0}}}*(100*0.01*{{{motorOutput|0}}})+{{{maxShots|0}}}*{{{shellMass|0}}}*0.001+{{#if: {{{shellMass|}}}|{{{mass}}}|0}})+{{{variantMass|0}}}}}|3}}&nbsp;{{Dict|t}} {{#ifeq: {{lc:{{{physics insignificant}}}}}|y|{{#tag:ref|{{Infobox/Part/Dict|Massless}}|name="phyinsig"}}}}|{{#if: {{{lf|}}}{{{ox|}}}{{{mp|}}}{{{sf|}}}{{{xg|}}}{{{ia|}}}{{{eva|}}}{{{or|}}}{{{ab|}}}{{{capacity|}}}{{{crew|}}}{{{motorOutput|}}}{{{motorMass|}}}{{{maxShots|}}}{{{shellMass|}}}|{{Formatnum|{{#expr: {{{mass}}}-({{{capacity|0}}}*{{#ifeq: {{{applyKerbalMass|y}}}|y|{{#ifexpr: {{{crew|0}}}>0|0.094|0.045}}|0}})+({{{ia|0}}}*0.005+1*{{{shellMass|0}}}*0.001+{{#if: {{{shellMass|}}}|{{{mass}}}|0}})}}|3}}&nbsp;{{Dict|t}}}}
[[Category:{{{Role}}}]]
+
|type1={{Infobox/Part/Dict|Total}}
</includeonly>
+
|type2={{Infobox/Part/Dict|Dry}}}}
<noinclude>
+
<!-- Drag -->
<br clear="both" />
+
{{Infobox/Line|{{Infobox/Part/Dict|Drag}}|{{{drag}}} {{#ifeq: {{lc:{{{physics insignificant}}}}}|y|{{#tag:ref|{{Infobox/Part/Dict|Massless}}|name="phyinsig"}}}}}}
== Template ==
+
<!-- Max. Temp. -->
<pre><nowiki>{{Partbox
+
{{Infobox/Line|{{Infobox/Part/Dict|Temp}}|{{{temp}}}&nbsp;{{Dict|K}}}}
|Name=
+
<!-- Impact Tolerance -->
|Role=
+
{{Infobox/Line|{{Infobox/Part/Dict|Tolerance}}|{{{tolerance}}}&nbsp;{{Dict|m}}/{{Dict|s}}}}
|File=
+
<!-- Research -->
|Costs=
+
{{Infobox/Line|{{Infobox/Part/Dict|Research}}|{{#if: {{{research|}}}|{{#if: {{Infobox/Part/ricon|{{{research}}}}}|[[{{Infobox/Part/ricon|
|Mass=
+
{{{research}}}}}|24x24px|link=Technology tree{{if lang}}#{{{research}}}]]&nbsp;}}[[Technology tree{{if lang}}#{{{research}}}|{{Dict/sci node|{{{research}}}}}]]|{{Dict|Unknown}}}}}}
|More=
+
<!-- Unlock cost -->
|since=
+
{{Infobox/Line|{{Infobox/Part/Dict|Unlock}}|{{Formatnum|{{{unlock cost}}}}}&nbsp;{{Mark|fund}}}}
|cfg=
+
<!-- Since version -->
|Class=
+
{{Infobox/Line|{{Dict|Since}}|{{#if: {{{since|}}}|{{version|{{{since}}}|}}|{{Dict|Unknown}}}}}}
}}</nowiki></pre>
+
<!-- Part configuration -->
 
+
{{Infobox/Line|{{Infobox/Part/Dict|Config}}|{{#if: {{{part|}}}<!--
== Usage ==
+
-->|style="word-break:break-all;" {{!}} [[{{#switch: {{lc:{{{dlc|}}}}}<!--
This templates takes the following arguments:
+
  -->|mh=MakingHistory/<!--
 
+
  -->|bg=Serenity/<!--
{| class="wikitable"
+
  -->|#default=}}<!--
|-
+
-->Parts/{{#if: {{{parent|}}}|{{{parent}}}/}}{{{part}}}/{{{filename}}}|{{{filename}}}]]<!--
! Argument !! Explanation !! Example !! mandatory?
+
-->|{{Infobox/Part/Dict|Unknown}}[[Category:Infobox/Part with missing parameters]]
|-
+
}}}}{{#if: {{{more|}}}|<br/>
| Name || Name of the part. Defaults to ''<nowiki>{{PAGENAME}}</nowiki>'' || FL-T500 Fuel Tank || no
+
{{{more|}}}}}
|-
+
|notes={{{notes|}}}{{#if: {{{nref|}}}{{#ifeq: {{lc:{{{physics insignificant}}}}}|y|1}}|{{#tag:references}}}}
| Role || Role the part fulfills || Fuel Tank || '''yes'''
+
}}</includeonly><noinclude>
|-
+
{{documentation}}
| Class || The Part Module the part uses || FuelTank || '''yes'''
+
<!-- Add categories to the /doc subpage, not here! -->
|-
 
| File || Name of the file to be displayed || FL-T500 Fuel Tank.jpg || '''yes'''
 
|-
 
| Costs || Costs of the part || 550 || '''yes'''
 
|-
 
| Mass || Mass of the part || 2.5 || '''yes'''
 
|-
 
| More || More module-specific information || (see below) || no
 
|-
 
| since || Version the part first appeared in || 0.7.3 || '''yes'''
 
|-
 
| cfg || Link to cfg-entry in wiki || Parts/FuelTank/parts.cfg || '''yes'''
 
|}
 
 
 
=== More fields ===
 
Many fields are module-specific. As it is difficult to use pipes '''|''' in templates, the template {{Template|PB-more}} is used. Refer to this example:
 
<pre><nowiki>
 
{{Partbox
 
|Name=FL-T500 Fuel Tank
 
|Role=Fuel Tank
 
|File=FL-T500 Fuel Tank.jpg
 
|Costs=550
 
|Mass=25
 
|More=
 
{{PB-more|Dry Mass|0.3 kg}}
 
{{PB-more|Fuel|500}}
 
|cfg=Parts/FuelTank/parts.cfg
 
|Class=FuelTank
 
}}
 
</nowiki></pre>
 
 
 
[[Category:Templates|Partbox]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 21:07, 20 October 2024

Documentation icon Template documentation[view] [edit] [history] [purge]Pages that link to Template:Infobox/Part
Infobox
Part image
Adapter by
O.M.B. Demolition Enterprises

Radial size Large, Small, Tiny
Cost (total) 800.00 Funds
Mass (total) 0.200 t
Drag 0.3
Max. Temp. 3400 K
Impact Tolerance 12 m/s
Research Meta-materials.png Meta-Materials
Unlock cost 1 200 Funds
Since version 0.21
Part configuration adapterLargeSmallQuad.cfg
Outgoing connectors 4
Packed volume 425 l
Stacking capacity 3 units

Usage

To avoid adding the information for each language this templates should be reused and with the suggested subpage name /Box. The Templates help page contains additional information how to implement reusing. All page which use template directly should add the {{Data template used}} note.

Parameters

Name Optional Description Default
name Yes Name of the part, which can be found in the localization file. Uses {{Dict/part name}} to translate names. {{BASEPAGENAME}}
file Yes Filename to image of the part. File:Image needed.svg
type No Type of the part. Automatically defines the role parameter.
role Yes Role of the part. Overrides the type parameter. {{type}}
size Yes Radial size of the part (uses {{Radial size}}). Not set/Hidden
size2 Yes Second radial size of the part (uses {{Radial size}}). Not set/Hidden
size3 Yes Third radial size of the part (uses {{Radial size}}). Not set/Hidden
size4 Yes Fourth radial size of the part (uses {{Radial size}}). Not set/Hidden
manufacturer Yes Manufacturer of the part. If set, linked to the category of this name (see also Category:Manufacturers). Automatically uses {{Infobox/Part/Manufacturer}} and {{Infobox/Part/Manufacturer entry}} on it. ?
manufacturer2 Yes Second manufacturer of the part. Not set/Hidden
costs No Cost of the part, which is usually given in the part configuration.
mass No Mass of the part, which is usually given in the part configuration.
lf Yes Max amount of Liquid Fuel on the part in units. Only used for wet mass/dry costs calculation. 0
ox Yes Max amount of Oxidizer on the part in units. Only used for wet mass/dry costs calculation. 0
sf Yes Max amount of Solid Fuel on the part in units. Only used for wet mass/dry costs calculation. 0
mp Yes Max amount of Monopropellant on the part in units. Only used wet mass/dry costs calculation. 0
xg Yes Max amount of Xenon Gas on the part in units. Only used for wet mass/dry costs calculation. 0
ia Yes Max amount of Intake Air on the part in units. Only used for wet mass/dry costs calculation. 0
eva Yes Max amount of EVA Propellant on the part in units. Only used for wet mass/dry costs calculation. 0
or Yes Max amount of Ore on the part in units. Only used for wet mass/dry costs calculation. 0
ab Yes Max amount of Ablator on the part in units. Only used for wet mass/dry costs calculation. 0
capacity Yes Total amount of crew capacity on the part. Only used for wet mass/dry costs calculation. 0
crew Yes Amount of crew the part starts with. Only used for wet/dry mass calculation. 0
motorOutput Yes Maximum output of the motor on the part. Only used for wet mass/dry costs calculation. 0
motorCost Yes The extra cost the motor adds to the part. Only used for wet costs calculation. 0
motorMass Yes The extra mass the motor adds to the part. Only used for wet mass calculation. 0
maxShots Yes Maximum amount of firework shots on the part. Only used for wet mass calculation. 0
shellMass Yes The extra mass every firework shell adds to the part. Only used for wet/dry mass calculation. 0
variantCost Yes The extra cost the default variant adds to the part. Only used for wet costs calculation. 0
variantMass Yes The extra mass the default variant adds to the part. Only used for wet mass calculation. 0
drag No Drag of the part. By different values, add minimum_drag first and then maximum_drag
temp No Temperature resistance of the part, which is usually given in the part configuration.
tolerance No Impact tolerance of the part, which is usually given in the part configuration.
research Yes Research node required for this part. Uses {{Dict/sci node}} to translate names. Unknown
unlock cost No Cost to unlock the part, which is usually given in the part configuration.
since Yes Version the part first appeared in. It will be used in {{version}}. Unknown
dlc Yes Name of the dlc. Used for linking to the cfg-entry on the wiki. Can be:
  • mh (Making History)
  • bg (Breaking Ground)
Not Set
physics insignificant Yes Mark the mass and drag automatically with a note that they are insignificant (so called massless parts). Must be set to "y" to show insignificance. This will use {{{nref}}}, so if it isn't set, will set it automatically to "1". Not set/Hidden
applyKerbalMass Yes Whether the part applies extra mass of a Kerbal on the part. Must be set to "n" to exclude the added mass. Only used for wet/dry mass calculation. y
filename No The filename (with extension) of the part configuration.
part Yes Name of the part folder. Used for linking to the cfg-entry on the wiki. It will create a link to Parts/{{{parent}}}/{{{part}}}/{{{filename}}}. Unknown cfg
parent Yes Parent directory of the part folder. Used for linking to the cfg-entry on the wiki. Not set/Hidden
more Yes More module-specific information (see More parameter). Not set
notes Yes Additional notes below the part information. Not set/Hidden
nref Yes Automatically adds references below the part information. Not set/Hidden

If a mandatory parameter is missing Category:Infobox/Part with missing parameters will be added.

Configuration file

With the new folder structure since version 0.20 the part config file must be placed at Parts/{{{parent}}}/{{{part}}}/{{{filename}}}. The {{Part config}} template should be used in the part configuration pages. For some parts the actual parent differs from the type. For those cases parent overrides the type-based parent definition. One example is the Vernor Engine, because it's a RCS engine but it's definition is in Engine although the other two RCS engines are in Utility.

More parameter

To add additional fields the {{{more}}} parameter should be used with {{Infobox/Part/Line}} or {{Infobox/Line}}. It is preferred to use one of the modules.

Attention! To describe the required cargo parameters of any part, such as "value" and "stacking", there is a separate {{Infobox/Part/cargo}} module, which must be included in the infobox of each part

Manufacturer

To add a manufacturer, it has to be added to the template {{Infobox/Part/Manufacturer}} and to {{Infobox/Part/ManufacturerUntranslated}}.

Types

For different types of parts this template allows to set the type parameter. The type will automatically set {{{role}}} and {{{parent}}} though they can be manually overwritten. The following values are supported:

Type Role Parent Subtemplate
cs Control surface Aero {{Infobox/Part/control surface}}
fan Fan shroud (n/a)
fr Fairing {{Infobox/Part/fairing}}
hs Heat shield {{Infobox/Part/heat shield}}
int Air intake {{Infobox/Part/air intake}}
let Winglet {{Infobox/Part/winglet}}
nc Nose cone (n/a)
win Wing {{Infobox/Part/lifting surface}}
car Cargo module Cargo {{Infobox/Part/inventory}}
cit Cargo item {{Infobox/Part/cargo}}
ga Ground anchor (n/a)
cm Command module Command {{Infobox/Part/command module}}
cp Cockpit
pod Command pod
rw Reaction wheel {{Infobox/Part/torque}}
sas Stability Augmentation System {{Infobox/Part/SAS}}
ft Fuel transfer CompoundParts (n/a)
str Strut (n/a)
air Airlock Coupling (n/a)
dec Decoupler {{Infobox/Part/separator}}
sep Separator
epl Engine plate
bat Battery Electrical {{Infobox/Part/energy storage}}
gen Generator {{Infobox/Part/generator}}
pan Solar panel {{Infobox/Part/solar panel}}
lfe Liquid fuel engine Engine {{Infobox/Part/reaction engine}}
mpe Monopropellant engine
srb Solid rocket booster {{Infobox/Part/solid fuel engine}}
je Jet engine {{Infobox/Part/jet engine}}
ie Ion engine {{Infobox/Part/ion engine}}
he Hybrid engine {{Infobox/Part/reaction engine}}, {{Infobox/Part/jet engine}}
dra Drain valve FuelTank (n/a)
lft Liquid fuel tank {{Infobox/Part/tank}}
mpt Monopropellant tank
xgt Xenon gas tank
tel Telescope Misc (n/a)
pro Propeller Propellers {{Infobox/Part/control surface}}
con Converter Resources {{Infobox/Part/converter}}
dri Resource harvester (n/a)
fc Fuel cell {{Infobox/Part/converter}}
ot Ore tank {{Infobox/Part/tank}}
sca Scanner (n/a)
cyl Cylinder Robotics {{Infobox/Part/servo}}
eng Engine
hin Hinge
pco Robotic controller (n/a)
rot Rotor {{Infobox/Part/servo}}
ser Servo
arm Scanning arm Science {{Infobox/Part/scanner arm}}, {{Infobox/Part/sensor}}
lab Laboratory {{Infobox/Part/laboratory}}
sen Environmental sensor {{Infobox/Part/sensor}}
sto Experiment Storage (n/a)
ada Adapter Structural {{Infobox/Part/adapter}}
grp Grip pad (n/a)
ste Structural element (n/a)
rad Radiator Thermal {{Infobox/Part/radiator}}
ant Antenna Utility {{Infobox/Part/antenna}}
cb Cargo bay (n/a)
chu Parachute {{Infobox/Part/parachute}}
claw Advanced Grabbing Unit (n/a)
dp Docking port {{Infobox/Part/docking port}}
fla Flag (n/a)
hab Habitation module {{Infobox/Part/crew}}
lad Ladder {{Infobox/Part/ladder}}
leg Landing leg (n/a)
les Launch Escape System (n/a)
lig Electric light {{Infobox/Part/electric usage}}
rcs Reaction Control System {{Infobox/Part/reaction engine}}, {{Infobox/Part/thrust vectors}}
sb Service bay (n/a)
gea Landing gear Wheel (n/a)
rov Rover wheel {{Infobox/Part/rover wheel}}


If a part uses more than one type, for example the R.A.P.I.E.R. Engine, the type parameter is usually omitted and each subtemplate should use a header from {{Infobox/Part/title}}.

Additionally test subjects can use {{Infobox/Part/test subject}}.

Roles

Prior to the module system "roles" where used, but have been abandoned because they are not flexible enough. Currently only {{Infobox/Part/Strut}} is the only role template still used.

Template

{{Infobox/Part
|name=
|file=
|type=
|role=
|size=
|size2=
|size3=
|size4=
|manufacturer=
|manufacturer2=
|costs=
|mass=
|lf=
|ox=
|sf=
|mp=
|xg=
|ia=
|eva=
|or=
|ab=
|capacity=
|crew=
|motorOutput=
|motorCost=
|motorMass=
|maxShots=
|shellMass=
|variantCost=
|variantMass=
|drag=
|temp=
|tolerance=
|research=
|unlock cost=
|since=
|dlc=
|physics insignificant=
|applyKerbalMass=
|filename=
|part=
|parent=
|more={{Infobox/Part/cargo
 |volume=
 |stack=
}}
|notes=
|nref=
}}

Example

Example used on this page:

{{Infobox/Part
|file=TVR-400L Stack Quad-Adapter.png
|type=ada
|size=large
|size2=small
|size3=tiny
|manufacturer=OMB
|costs=800
|mass=0.2
|drag=0.3
|temp=3400
|tolerance=12
|research=Meta-Materials
|unlock cost=1200
|since=0.21
|filename=adapterLargeSmallQuad.cfg
|part=stackAdapters
|parent=Structural
|more={{Infobox/Part/adapter
 |out=4
}}
{{Infobox/Part/cargo
 |volume=425
 |stack=3
}}
}}

Translation

When using this template, most of it is translated automatically. To translate this template or one of the subtemplates, go to the {{Infobox/Part/Dict}} template.

Manufacturer

To add a translation for a manufacturer's name, add it to {{Infobox/Part/Manufacturer}} (use the {{lang}} template). Do not translate manufacturer names in the template {{Infobox/Part/ManufacturerUntranslated}}.