见 Terraria Wiki:项目/1.4.5 获取 wiki 状态与更新指南
Template:Mph
This template is used to display a speed/velocity value in miles per hour, optionally including the equivalent in tiles per second.
Usage
{{ mph | <numerical mph/tiles-per-sec/pixels-per-tick value> | tiles/tiles_text/text_tiles/full (optional) | mode = tiles/tiles_text/text_tiles/full (optional) }}
- First unnamed parameter
The numerical value of the speed/velocity in mph, tiles per second, or the pixels-per-tick unit used in Terraria's source code. The string tile or tiles (case-insensitive) needs to be appended for values in tiles per second (e.g. 31 tiles), and the string pixel or pixels (case-insensitive) needs to be appended for values in pixels per tick (e.g. 31 pixels). Supports decimals and negative numbers.
- Second unnamed parameter or mode
Control the output format:
| Mode | Description |
|---|---|
| (default) | The numerical speed/velocity appended with mph, as displayed in-game |
tiles |
Raw numerical tiles-per-second value |
tiles_texttext_tiles |
The tiles-per-second value with unit |
full |
The default output appended with the tiles_text output
|
All mph values can be hovered over to reveal a brief explanation.
Examples
| Code | Result |
|---|---|
| No input | |
{{mph}} |
mph |
{{mph|}} |
mph |
| Mph input | |
{{mph|31}} |
31 mph |
{{mph|3.1415}} |
3.1415 mph |
{{mph|-31415}} |
−31,415 mph |
{{mph|31|tiles}} |
22.73 |
{{mph|31|tiles_text}} |
22.73 格/秒 |
{{mph|31|full}} |
31 mph (22.73 格/秒) |
{{mph|{{#expr:15/11 round 4}}|full}} |
1.3636 mph (1 格/秒) |
| Tiles/sec input | |
{{mph|31tile}} |
42 mph |
{{mph|3.1415tiles}} |
4 mph |
{{mph|-31415 tile}} |
−42,839 mph |
{{mph|31 tiles|mode=tiles}} |
31 |
{{mph|31 TILES|mode=tiles_text}} |
31 格/秒 |
{{mph|31TILE|mode=full}} |
42 mph (31 格/秒) |
{{mph|{{#expr:11/15 round 4}}tiles|mode=full}} |
1 mph (0.7333 格/秒) |
| Pixels/tick input | |
{{mph|31pixel}} |
159 mph |
{{mph|3.1415pixels}} |
16 mph |
{{mph|-31415 pixel}} |
−160,645 mph |
{{mph|31 pixels|mode=tiles}} |
116.25 |
{{mph|31 PIXELS|mode=tiles_text}} |
116.25 格/秒 |
{{mph|31PIXEL|mode=full}} |
159 mph (116.25 格/秒) |
{{mph|1 pixel|mode=full}} |
5 mph (3.75 格/秒) |
{{mph|{{#expr:1/3.75}} pixels|mode=tiles_text}} |
1 格/秒 |
Notes
- Note the rounding that is issued when displaying mph values:
{{mph|42|full}}→ 42 mph (30.8 格/秒){{mph|31 tiles|mode=full}}→ 42 mph (31 格/秒)
- The exact mph equivalent of 31 tiles per second would be 42.272727272727 mph, but this value is rounded just like it is in-game.
Options
This template supports options through {{options}} template. All valid options are listed below, see {{options}} for usage and other infomation.
See Template:mph/initOptions for the initial options setting of this template.
| Name | Alias | Initial Value | Value Mapping[1] | Note |
|---|---|---|---|---|
mode | (empty) | text_tiles → tiles_texttext tiles → tiles_texttext+tiles → tiles_texttiles+text → tiles_texttiles text → tiles_texttext_tile → tiles_texttext tile → tiles_texttext+tile → tiles_texttile_text → tiles_texttile+text → tiles_texttile text → tiles_text |
- ↑ Values with mapping will be stored and loaded as mapped value. Other values without mapping will be stored and loaded as-is.
Example:
{{mph|10}}
{{options|mph|mode=tiles_text}}
{{mph|10}}
{{options|mph|mode=tiles}}
{{mph|10}}
{{options|mph|reset}}
{{mph|10}}
Will output:
10 mph
7.33 格/秒
7.33
10 mph