Template:Item: Difference between revisions

From Space Station 14 Wiki
Aliser (talk | contribs)
better support for bool "capitalize"
Aliser (talk | contribs)
added to item templates cat
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly>{{#invoke: Item|generate_item}}</includeonly><noinclude>
--><templatestyles src="Item/styles.css" /><!--
 
-->{{#vardefine: item_icon_size|{{{size|24px}}}}}<!--
 
-->{{#vardefine: item_id|{{#invoke: Item|lookup_item_id_by_name_and_amount|{{{1}}}|{{{2|}}}}}<!--/vardefine-->}}<!--
 
-->{{#iferror: {{#var:item_id}}
|{{#var:item_id}}
|{{#vardefine: item_icon_file|{{#invoke: Item|lookup_item_image_by_id|{{#var:item_id}}}}<!--/vardefine-->}}<!--
   
    -->{{#iferror: {{#var:item_icon_file}}
        |{{#var:item_icon_file}}
        |{{#vardefine: item_label|{{{label|{{{l|{{#invoke: Item|lookup_item_name_by_id|{{#var:item_id}}<!--/invoke-->}}<!--/l-->}}}<!--/label-->}}}<!--/vardefine-->}}<!--
       
        -->{{#if: {{{2|}}}|{{#vardefine: item_label|{{{2}}} {{#var:item_label}}<!--/vardefine-->}}<!--/if-->}}<!--
       
        -->{{#ifeq: {{yesno|{{{capitalize|{{{cap|0}}}<!--/1-->}}}}}|yes|{{#vardefine: item_label|{{ucfirst:{{#var:item_label}}}}<!--/vardef-->}}<!--/if-->}}<!--
 
--><span class="item"><!--
--><span class="item-icon">[[File:{{#var:item_icon_file}}|{{#var: item_icon_size}}]]</span><!--
-->{{#if: {{#var:item_label}}<!--
                -->|<span class="item-label">'''{{#var:item_label}}'''</span><!--
            -->}}<!--
--></span>
    }}
}}</includeonly><noinclude>
{{docs|bb=
{{docs|bb=
{{uses lua|Item}}
{{uses lua|Item}}
Line 31: Line 5:
}}
}}


[[Category:Item templates]]
[[Category:Image templates]]
[[Category:Image templates]]
[[Category:Template starter-kit]]
[[Category:Template starter-kit]]
Line 38: Line 13:
"1": {
"1": {
"label": "Item",
"label": "Item",
"description": "What item are you looking for? Any casing is allowed, including lowercase.",
"description": "What item are you looking for? ID, name or a custom alias? Use whatever you wish! Any casing is allowed, including lowercase.",
"type": "line",
"type": "line",
"example": "lv coil",
"example": "lv coil",
Line 45: Line 20:
"2": {
"2": {
"label": "Amount",
"label": "Amount",
"description": "Amount of item. Empty string by default.",
"description": "Amount of item. By default, no amount in particular is chosen.",
"example": "3",
"example": "3",
"type": "number",
"type": "number",
Line 54: Line 29:
"description": "Icon size",
"description": "Icon size",
"type": "line",
"type": "line",
"default": "24px",
"default": "32px",
"suggested": true
"suggested": true
},
},
Line 73: Line 48:
"description": "Makes the first letter in the label uppercase.",
"description": "Makes the first letter in the label uppercase.",
"type": "boolean",
"type": "boolean",
"autovalue": "0"
"suggested": true,
"default": "0"
},
"link": {
"label": "Link",
"description": "A link to give to the item. By default, a link is added if it's defined in the config - read more in Module:Item.",
"type": "wiki-page-name",
"suggested": true
},
"capitalize all": {
"aliases": [
"cap all"
],
"label": "Capitalize all",
"description": "Makes the first letter in every word inside the label uppercase.",
"type": "boolean",
"default": "0",
"suggested": true
}
}
},
},
Line 81: Line 73:
"size",
"size",
"label",
"label",
"capitalize"
"capitalize",
]
"capitalize all",
"link"
],
"description": "Produces an in-game item icon with a label. The label is the name of that item. Items without icons... will not have icons. See extra parameters for extra spice!"
}
}
</templatedata>
</templatedata>
</noinclude>
</noinclude>

Latest revision as of 09:56, 28 March 2025

Template documentation
view or edit this documentation about template documentation
Uses Lua module
This template uses Lua module:
Uses template styles
This template uses template styles found in:

Examples

Basic

{{item|lv}}

LV cable coil

For items without icons

Info
Not all items have their icons uploaded to the wiki. Such items will only have their label displayed.
Used here is some abstract item without icon.

{{item|foldable}}

foldable

Specifying amount of items

{{item|steel|25}}

25 steel

More examples

-55 steel

0 steel

0.5 steel

1 steel

5 steel

9 steel

10 steel

11 steel

15 steel

19 steel

20 steel

21 steel

25 steel

30 steel

35 steel

999999 steel

Custom label

{{item|proto-kinetic accelerator|label=hole-maker}}

hole-maker

Empty label

To remove the label alltogether, pass an empty string to label.

{{item|proto-kinetic accelerator|label=}}

Capitalizing the label

This makes the first letter of the label uppercase.

{{item|proto-kinetic accelerator|capitalize=1}}
or
{{item|proto-kinetic accelerator|cap=1}}

Proto-kinetic accelerator
or
Proto-kinetic accelerator


Capitalizing each word in the label

This makes the first letter in each word inside the label uppercase.

{{item|proto-kinetic accelerator|capitalize all=1}}
or
{{item|proto-kinetic accelerator|cap all=1}}

Proto-kinetic Accelerator
or
Proto-kinetic Accelerator

Custom icon size

{{item|lv|size=64px}}

LV cable coil

Adding links

{{item|Deckard|link=Guns}}

Deckard

Info
Some items have links by default, such as protolathe, so with this option you can override them as you wish.

A list of all items with icons

See Template:Item/doc/list of items with icons.

A list of all items

See Template:Item/doc/list_of_items.

Errors

Unknown item

{{item|lorem ipsum honk}}

Lua error in Module:Item at line 89: item generation failed: no item was found by ID/name 'lorem ipsum honk'.

Produces an in-game item icon with a label. The label is the name of that item. Items without icons... will not have icons. See extra parameters for extra spice!

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Item1

What item are you looking for? ID, name or a custom alias? Use whatever you wish! Any casing is allowed, including lowercase.

Example
lv coil
Linerequired
Amount2

Amount of item. By default, no amount in particular is chosen.

Example
3
Numbersuggested
Sizesize

Icon size

Default
32px
Linesuggested
Labellabel l

Label override.

Linesuggested
Capitalizecapitalize cap

Makes the first letter in the label uppercase.

Default
0
Booleansuggested
Capitalize allcapitalize all cap all

Makes the first letter in every word inside the label uppercase.

Default
0
Booleansuggested
Linklink

A link to give to the item. By default, a link is added if it's defined in the config - read more in Module:Item.

Page namesuggested