Difference between revisions of "Template:BlockVolume"
From Space Engineers Wiki
Vox Serico (talk | contribs) m (Added parameter volumeonly, code cleanup) |
Vox Serico (talk | contribs) m (Better example usage) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly> | + | <includeonly>{{#vardefine:blockwidth | {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = lwidth | small = swidth}}}}}} {{#vardefine:blockheight| {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = lheight | small = sheight}}}}}} {{#vardefine:blockdepth | {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = ldepth | small = sdepth}}}}}} {{#vardefine:blockvolume | {{#expr: {{#var:blockwidth}} * {{#var:blockheight}} * {{#var:blockdepth}} * {{#switch:{{{2}}} | large = 15.625 | small = 0.125}}}}}} {{#switch:{{{volumeonly}}} | yes = {{#var:blockvolume}} | #default = {{#var:blockwidth}}×{{#var:blockheight}}×{{#var:blockdepth}} ({{#var:blockvolume}} m<sup>3</sup>)}}</includeonly><noinclude> |
− | {{#vardefine:blockwidth | {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = lwidth | small = swidth}}}}}} | ||
− | {{#vardefine:blockheight| {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = lheight | small = sheight}}}}}} | ||
− | {{#vardefine:blockdepth | {{#show: {{{1|}}}|? {{#switch: {{{2}}}| large = ldepth | small = sdepth}}}}}} | ||
− | {{#vardefine:blockvolume | {{#expr: {{#var:blockwidth}} * {{#var:blockheight}} * {{#var:blockdepth}} * {{#switch:{{{2}}} | large = 15.625 | small = 0.125}}}}}} | ||
− | {{# | ||
− | </includeonly><noinclude> | ||
Displays block dimensions and calculates its volume. | Displays block dimensions and calculates its volume. | ||
− | Usage:<pre>{{BlockVolume|Block name|size}}</pre> | + | Usage:<pre>{{BlockVolume|Block name|size|[volumeonly=yes]}}</pre> |
Where ''Block name'' is the page of the block and ''size'' is ''small'' or ''large'' for respective the block size. | Where ''Block name'' is the page of the block and ''size'' is ''small'' or ''large'' for respective the block size. | ||
− | <pre>{{BlockVolume|Large Thruster|small}}</pre> | + | |
− | + | The parameter ''volumeonly'' is optional and accepts ''yes'' to only return the block's volume as a number. | |
− | <pre>{{BlockVolume|Large Thruster|large}}</pre> | + | |
− | + | {| | |
− | <pre>{{BlockVolume|Large Thruster|large|volumeonly=yes}}</pre> | + | ! Example usage !! Result |
− | + | |- | |
+ | | <pre>{{BlockVolume|Large Thruster|small}}</pre> | ||
+ | | {{BlockVolume|Large Thruster|small}} | ||
+ | |- | ||
+ | | <pre>{{BlockVolume|Large Thruster|large}}</pre> | ||
+ | | {{BlockVolume|Large Thruster|large}} | ||
+ | |- | ||
+ | | <pre>{{BlockVolume|Large Thruster|large|volumeonly=yes}}</pre> | ||
+ | | {{BlockVolume|Large Thruster|large|volumeonly=yes}} | ||
+ | |} | ||
</noinclude> | </noinclude> |
Latest revision as of 17:13, 27 March 2020
Displays block dimensions and calculates its volume.
{{BlockVolume|Block name|size|[volumeonly=yes]}}
Where Block name is the page of the block and size is small or large for respective the block size.
The parameter volumeonly is optional and accepts yes to only return the block's volume as a number.
Example usage | Result |
---|---|
{{BlockVolume|Large Thruster|small}} |
×× (Expression error: Unexpected * operator. m3) |
{{BlockVolume|Large Thruster|large}} |
×× (Expression error: Unexpected * operator. m3) |
{{BlockVolume|Large Thruster|large|volumeonly=yes}} |
Expression error: Unexpected * operator. |