Шаблон:Source code ref/doc

Матеріал з Terraria Wiki
Перейти до навігації Перейти до пошуку

This template can be used to mark information as being taken from Terraria's source code. It prints a short, modifiable text wrapped in a <ref> tag.

Usage

{{source code ref | v = <source code version> | old = y/yes | method = <method name(s)> | t = <further comments> | <custom text> | noref = y/yes | name = <custom <ref> name> }}

v

Set it to the version of Terraria from which the information was taken. This is important because the game and source code change over time, and it helps identifying potentially outdated information in future updates.

old

Setting this parameter signifies that the information is intentionally taken from an outdated version of Terraria's source code, e.g. for historical pieces of trivia.

method

If there is a specific method that the information was taken from, its name (including full namespace) can be passed to this parameter. This is useful for an automatic, standardized formatting and localization. Multiple method names can be passed as well, separated by a slash (/). Has no effect if the first unnamed parameter is set.

t

Can be used to add further comments to the information passed in $method. Has no effect if the first unnamed parameter is set.

First unnamed parameter

Generally, all relevant information should be provided in $method and optionally $t. However, it may be necessary to use an entirely custom text, in which case this parameter can be used. It overrides both $method and $t.

noref

Set to y/yes to suppress the <ref> tag.

name

Can be used to specify a custom name for the <ref>, so that a <ref> can be reused several times (via <ref name="<name>" />). Has no effect if $noref is set.

Notes

  • Although all parameters are optional, $v should always be set.
  • If the version passed in $v is different from the current Desktop version (determined via {{version|desktop}}), a note will be appended. The page will furthermore be categorized in Category:Pages with information based on outdated versions of Terraria's source code.
    • This can be prevented with the $old parameter.
  • If there is at least one call of {{source code ref}} without $noref on the page, a new section "References" or "Footnotes" with {{reflist}} needs to be added.

Examples

Code Result
{{source code ref|v=1.4.4.9|noref=y}} Інформація взята з вихідного коду гри, версії 1.4.4.9 для ПК версія ПК.
{{source code ref|v=1.3.0.1|noref=y}} Інформація взята з вихідного коду гри, версії 1.3.0.1 для ПК версія ПК. Можливі неточності, оскільки поточною Виявлена петля у шаблонах: Шаблон:L10n ПК версією є 1.4.4.9.
{{source code ref|v=1.2.4.1|old=y|noref=y}} Інформація взята з вихідного коду гри, версії 1.2.4.1 для ПК версія ПК.
{{source code ref|v=1.4.4.9|the field {{code|FooBar}} in {{code|Bas.cs}}.|noref=y}} Інформація взята з вихідного коду гри, версії 1.4.4.9 для ПК версія ПК, the field FooBar in Bas.cs.
{{source code ref|v=1.4.4.9|method=Bar.Foo|t=The first <code>if-else</code> block in the method shows that ...|noref=y}} Інформація взята з вихідного коду гри, версії 1.4.4.9 для ПК версія ПК, метод Foo() в Bar.cs. The first if-else block in the method shows that ...
{{source code ref|v=1.4.4.9|method=Bar.Foo / Lorem.Ipsum.Dolor / Bar.Bas|noref=y}} Інформація взята з вихідного коду гри, версії 1.4.4.9 для ПК версія ПК, методи Foo() в Bar.cs, Dolor() в Lorem.Ipsum.cs, та Bas() в Bar.cs.
The thing takes three seconds to be done in Classic Mode and six seconds in Expert Mode.{{source code ref|v=1.3.0.1|method=Bar.Foo}} The thing takes three seconds to be done in Classic Mode and six seconds in Expert Mode.[1]

References

  1. Інформація взята з вихідного коду гри, версії 1.3.0.1 для ПК версія ПК, метод Foo() в Bar.cs. Можливі неточності, оскільки поточною Виявлена петля у шаблонах: Шаблон:L10n ПК версією є 1.4.4.9.