Difference between revisions of "Template:Infobox Element"

From The Powder Toy
Jump to: navigation, search
(Matched format of elements.txt file)
m (update github username)
 
(32 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{ infobox
+
<includeonly>{{ infobox
 
| name = Element
 
| name = Element
 
| title = [[File:{{{icon}}}]] {{{longname}}}
 
| title = [[File:{{{icon}}}]] {{{longname}}}
| image = {{{image}}}
+
| image = {{{image|}}}
| caption = {{{description}}}
+
| caption = {{{description|}}}
 
| header1 = Properties
 
| header1 = Properties
 
| label2 = Section
 
| label2 = Section
| data2 = {{{section}}}
+
| data2 = <span data-toggle="tooltip" data-original-title="{{{menusection}}}">{{#switch: {{{menusection|}}}
| label3 = Hidden
+
  | SC_WALL = [[:Category:Walls|Walls]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Walls]] | }}
| data3 = {{{hidden}}}
+
  | SC_ELEC = [[:Category:Electronics|Electronics]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Electronics]] | }}
| label4 = Colour
+
  | SC_POWERED = [[:Category:Powered Materials|Powered Materials]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Powered Materials]] | }}
| data4 = &#35;{{{colour}}}
+
  | SC_SENSOR = [[:Category:Sensors|Sensors]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Sensors]] | }}
| label5 = [[Advection]]
+
  | SC_FORCE = [[:Category:Force|Force Elements]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Force]] | }}
| data5 = {{{advection}}}
+
  | SC_EXPLOSIVE = [[:Category:Explosives|Explosives]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Explosives]] | }}
| label6 = [[Airdrag]]
+
  | SC_GAS = [[:Category:Gases|Gases]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Gases]] | }}
| data6 = {{{airdrag}}}
+
  | SC_LIQUID = [[:Category:Liquids|Liquids]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Liquids]] | }}
| label7 = [[Airloss]]
+
  | SC_POWDERS = [[:Category:Powders|Powders]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Powders]] | }}
| data7 = {{{airloss}}}
+
  | SC_SOLIDS = [[:Category:Solids|Solids]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Solids]] | }}
| label8 = [[Loss]]
+
  | SC_NUCLEAR = [[:Category:Radioactive|Radioactive]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Radioactive]] | }}
| data8 = {{{loss}}}
+
  | SC_SPECIAL = [[:Category:Special|Special]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Special]] | }}
| label9 = [[Gravity]]
+
  | SC_LIFE = Life
| data9 = {{{gravity}}}
+
  | SC_TOOL = [[:Category:Tools|Tools]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Tools]] | }}
| label10 = [[Temperature]]
+
  | SC_DECO = [[:Category:Tools|Decoration tools]] {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Tools]] | }}
| data10 = {{formatnum:{{{temperature}}}}} K<br/>{{#expr:{{formatnum:{{{temperature}}}}}-273.15}} &deg;C<br/>{{#expr:({{formatnum:{{{temperature}}}}}*(9/5))-459.67}} &deg;F
+
  | SC_CRACKER = Shenanigans
| label11 = [[Heat Conductivity]]
+
  | SC_CRACKER2 = Shenanigans
| data11 = {{{heatconduct}}}
+
  | unknown
| label12 = [[Diffusion]]
+
}} {{#ifexpr: {{{menuvisible}}} = 0 | (hidden) | }}</span>
| data12 = {{{diffusion}}}
+
| label4 = Spawn temperature
| label13 = [[Flammability]]
+
| data4 = {{Temperature|t={{{temperature}}}}}
| data13 = {{{flammability}}}
+
| label5 = [[Heat Conductivity]]
| label14 = [[Weight]]
+
| data5 = <span data-toggle="tooltip" data-original-title="Raw value: {{{heatconduct}}}">{{#ifexpr: {{{heatconduct}}} > 250 | 100% | {{#expr:{{{heatconduct}}}*100/250 round 1}}% }}</span>
| data14 = {{{weight}}}
+
| label6 = Relative [[weight]]
| label15 = Explosive
+
| data6 = {{{weight}}}
| data15 = {{{explosive}}}
+
| label7 = [[Gravity]]
| label16 = Meltable
+
| data7 = {{{gravity}}}
| data16 = {{{meltable}}}
+
| label8 = [[Element:ACID|Acid]] dissolve rate
| label17 = Conductive
+
| data8 = {{#ifexpr: {{{hardness}}} > 1000 | 100% | {{#expr:{{{hardness}}}*100/1000 round 1}}% }}
| data17 = {{{conductive}}}
+
| label10 = [[Flammability]]
 +
| data10 = {{{flammable}}}
 +
| label12 = {{#ifexpr: {{{explosive}}} > 0 | Explosive | }}
 +
| data12 = {{#switch: {{{explosive}}}
 +
  | 1 = when touching fire
 +
  | 2 = with fire or pressure
 +
  |
 
}}
 
}}
 +
| label13 = State
 +
| data13 = <span data-toggle="tooltip" data-original-title="
 +
{{{state}}}
 +
{{#if: {{#pos:{{{properties|}}}|TYPE_LIQUID}} | TYPE_LIQUID | }}
 +
{{#if: {{#pos:{{{properties|}}}|TYPE_SOLID}} | TYPE_SOLID | }}
 +
{{#if: {{#pos:{{{properties|}}}|TYPE_GAS}} | TYPE_GAS | }}
 +
{{#if: {{#pos:{{{properties|}}}|TYPE_ENERGY}} | TYPE_ENERGY | }}
 +
{{#if: {{#pos:{{{properties|}}}|TYPE_PART}} | TYPE_PART | }}
 +
">{{#if: {{#pos:{{{properties|}}}|TYPE_SOLID}} | Solid | }} {{#if: {{#pos:{{{properties|}}}|TYPE_LIQUID}} | Liquid | }} {{#if: {{#pos:{{{properties|}}}|TYPE_GAS}} | Gas | }} {{#if: {{#pos:{{{properties|}}}|TYPE_PART}} | Powder | }} {{#if: {{#pos:{{{properties|}}}|TYPE_ENERGY}} | Energy particle | }}</span>
 +
| header30 = {{#if: {{{highpressuretransition|}}} {{{hightemperaturetransition|}}} {{{lowpressuretransition|}}} {{{lowtemperaturetransition|}}} | Transitions | }}
 +
| label31 = {{#if: {{{lowtemperaturetransition|}}} | Low temperature | }}
 +
| data31 = {{#if: {{{lowtemperaturetransition|}}} |
 +
  {{#ifeq: {{{lowtemperaturetransition}}} | special |
 +
    transition occurs |
 +
    {{MaterialBtn | {{{lowtemperaturetransition}}}}}
 +
  }} below {{Temperature|t={{{lowtemperature}}}}} | }}
 +
| label32 = {{#if: {{{hightemperaturetransition|}}} | High temperature | }}
 +
| data32 = {{#if: {{{hightemperaturetransition|}}} |
 +
  {{#ifeq: {{{hightemperaturetransition}}} | special |
 +
    transition occurs |
 +
    {{MaterialBtn | {{{hightemperaturetransition}}}}}
 +
  }} above {{Temperature|t={{{hightemperature}}}}} | }}
 +
| label33 = {{#if: {{{lowpressuretransition|}}} | Low pressure | }}
 +
| data33 = {{#if: {{{lowpressuretransition|}}} |
 +
  {{#ifeq: {{{lowpressuretransition}}} | special |
 +
    transition occurs |
 +
    {{MaterialBtn | {{{lowpressuretransition}}}}}
 +
  }} below {{{lowpressure}}} pressure | }}
 +
| label34 = {{#if: {{{highpressuretransition|}}} | High pressure | }}
 +
| data34 = {{#if: {{{highpressuretransition|}}} |
 +
  {{#ifeq: {{{highpressuretransition}}} | special |
 +
    transition occurs |
 +
    {{MaterialBtn | {{{highpressuretransition}}}}}
 +
  }} above {{{highpressure}}} pressure | }}
 +
| header40 = {{#if: {{#pos:{{{properties|}}} | PROP_}} | Misc properties |}}
 +
| data46 = {{#if: {{#pos:{{{properties|}}}|PROP_CONDUCTS}} | <span data-toggle="tooltip" data-original-title="PROP_CONDUCTS">Conducts electricity ({{Material|SPRK}})</span> {{#ifeq: {{{nocat|0}}} | 0 | [[Category:Conductive]] | }} | }}
 +
| data47 = {{#if: {{#pos:{{{properties|}}}|PROP_NEUTPENETRATE}} | <span data-toggle="tooltip" data-original-title="PROP_NEUTPENETRATE">Mangled by neutrons</span> | }}
 +
| data48 = {{#if: {{#pos:{{{properties|}}}|PROP_NEUTABSORB}} | <span data-toggle="tooltip" data-original-title="PROP_NEUTABSORB">Absorbs neutrons</span> | }}
 +
| data49 = {{#if: {{#pos:{{{properties|}}}|PROP_NEUTPASS}} | <span data-toggle="tooltip" data-original-title="PROP_NEUTPASS">Allows neutrons to pass through</span> | }}
 +
| data50 = {{#if: {{#pos:{{{properties|}}}|PROP_DEADLY}} | <span data-toggle="tooltip" data-original-title="PROP_DEADLY">Harmful to {{Material | STKM}}</span> | }}
 +
| data51 = {{#if: {{#pos:{{{properties|}}}|PROP_RADIOACTIVE}} | <span data-toggle="tooltip" data-original-title="PROP_RADIOACTIVE">Radioactive, harmful to {{Material | STKM}}</span> | }}
 +
| data60 = [https://github.com/ThePowderToy/The-Powder-Toy/blob/master/{{#if: {{{srcfile|}}}|{{{srcfile}}}|src/simulation/elements/{{#explode:{{{identifier|}}}|_|-1}}.cpp}} Source code]
 +
}}
 +
{{#ifeq: {{{nocat|0}}} | 0 | [[Category:Elements]] | }}
 +
</includeonly><noinclude>
 +
Infobox for displaying various element properties.
 +
 +
Most of them should be passed exactly as in the source code. However, the ''properties'' parameter should be space separated (so remove the pipes). Example: TYPE_LIQUID PROP_CONDUCTS PROP_NEUTPENETRATE PROP_LIFE_DEC
 +
 +
Example:
 +
 +
<pre><nowiki>{{ infobox Element
 +
| icon = ASDF.png
 +
| longname =
 +
| image =
 +
 +
| identifier = DEFAULT_PT_ASDF
 +
| name = ASDF
 +
| description = Very light dust. Flammable.
 +
| colour = FFE0A0
 +
| menusection = SC_POWDERS
 +
| menuvisible = 1
 +
| advection = 0.7
 +
| airdrag = 0.02
 +
| airloss = 0.96
 +
| loss = 0.8
 +
| collision = 0
 +
| diffusion = 0
 +
| explosive = 0
 +
| falldown = 1
 +
| flammable = 10
 +
| gravity = 0.1
 +
| hardness = 30
 +
| heatconduct = 70
 +
| hotair = 0
 +
| meltable = 0
 +
| state = ST_SOLID
 +
| temperature = 2564.15
 +
| weight = 85
 +
| properties = TYPE_PART PROP_LIFE_DEC PROP_LIFE_KILL_DEC PROP_CONDUCTS PROP_NEUTPENETRATE PROP_DEADLY
 +
| lowtemperature = 1234
 +
| lowtemperaturetransition = DUST
 +
| hightemperature = 5678
 +
| hightemperaturetransition = special
 +
| lowpressure =
 +
| lowpressuretransition =
 +
| highpressure =
 +
| highpressuretransition =
 +
}}</nowiki></pre>
 +
 +
which gives
 +
 +
{{ infobox Element
 +
| icon = ASDF.png
 +
| longname =
 +
| image =
 +
| nocat = 1
 +
 +
| identifier = DEFAULT_PT_ASDF
 +
| name = ASDF
 +
| description = Very light dust. Flammable.
 +
| colour = FFE0A0
 +
| menusection = SC_POWDERS
 +
| menuvisible = 1
 +
| advection = 0.7
 +
| airdrag = 0.02
 +
| airloss = 0.96
 +
| loss = 0.8
 +
| collision = 0
 +
| diffusion = 0
 +
| explosive = 0
 +
| falldown = 1
 +
| flammable = 10
 +
| gravity = 0.1
 +
| hardness = 30
 +
| heatconduct = 70
 +
| hotair = 0
 +
| meltable = 0
 +
| state = ST_SOLID
 +
| temperature = 2564.15
 +
| weight = 85
 +
| properties = TYPE_PART PROP_LIFE_DEC PROP_LIFE_KILL_DEC PROP_CONDUCTS PROP_NEUTPENETRATE PROP_DEADLY
 +
| lowtemperature = 1234
 +
| lowtemperaturetransition = DUST
 +
| hightemperature = 5678
 +
| hightemperaturetransition = special
 +
| lowpressure =
 +
| lowpressuretransition =
 +
| highpressure =
 +
| highpressuretransition =
 +
}}
 +
 +
</noinclude>

Latest revision as of 15:18, 7 July 2018

Infobox for displaying various element properties.

Most of them should be passed exactly as in the source code. However, the properties parameter should be space separated (so remove the pipes). Example: TYPE_LIQUID PROP_CONDUCTS PROP_NEUTPENETRATE PROP_LIFE_DEC

Example:

{{ infobox Element
| icon = ASDF.png
| longname = 
| image = 

| identifier = DEFAULT_PT_ASDF
| name = ASDF
| description = Very light dust. Flammable.
| colour = FFE0A0
| menusection = SC_POWDERS
| menuvisible = 1
| advection = 0.7
| airdrag = 0.02
| airloss = 0.96
| loss = 0.8
| collision = 0
| diffusion = 0
| explosive = 0
| falldown = 1
| flammable = 10
| gravity = 0.1
| hardness = 30
| heatconduct = 70
| hotair = 0
| meltable = 0
| state = ST_SOLID
| temperature = 2564.15
| weight = 85
| properties = TYPE_PART PROP_LIFE_DEC PROP_LIFE_KILL_DEC PROP_CONDUCTS PROP_NEUTPENETRATE PROP_DEADLY
| lowtemperature = 1234
| lowtemperaturetransition = DUST
| hightemperature = 5678
| hightemperaturetransition = special
| lowpressure = 
| lowpressuretransition = 
| highpressure = 
| highpressuretransition = 
}}

which gives

ASDF.png
Properties
Section Powders
Spawn temperature 2291°C
Heat Conductivity 28%
Relative weight 85
Gravity 0.1
Acid dissolve rate 3%
Flammability 10
State Powder
Transitions
Low temperature DUST.png below 960.85°C
High temperature transition occurs above 5404.85°C
Misc properties
Conducts electricity (SPRK)
Mangled by neutrons
Harmful to STKM
Source code