Template:Item icon: Difference between revisions
From Space Station 14 Wiki
Template:Item icon
(wip) |
(replaced logic with a module lookup) |
||
Line 2: | Line 2: | ||
-->{{#vardefine: icon_size|{{{size|24px}}}}}<!-- | -->{{#vardefine: icon_size|{{{size|24px}}}}}<!-- | ||
-->{{# | -->{{#vardefine: icon_item_id|{{#invoke: Item|lookup_item_id_by_name|{{{1}}}}}<!--/vardefine-->}}<!-- | ||
| | -->{{#iferror: {{#var:icon_item_id}} | ||
| | |{{#var:icon_item_id}} | ||
{{#vardefine: icon_file| | |{{#vardefine: icon_file|{{#invoke: Item|lookup_item_image_by_id|{{#var:icon_item_id}}}}<!--/vardefine-->}}<!-- | ||
{{#vardefine: icon_label| | |||
-->{{#iferror: {{#var:icon_file}} | |||
|{{#var:icon_file}} | |||
|{{#vardefine: icon_label|{{#invoke: Item|lookup_item_name_by_id|{{#var:icon_item_id}}}}<!--/vardefine-->}}<!-- | |||
--><span class="item-icon"><!-- | |||
--><span class="item-icon-icon">[[File:{{#var:icon_file}}|{{#var: icon_size}}]]</span><!-- | |||
--><span class="item-icon-label">'''{{{label|{{{l|{{#var:icon_label}}}}}<!--/label-->}}}'''</span><!-- | |||
--></span> | |||
}} | |||
}}</includeonly><noinclude> | |||
--><span class="item-icon"><!-- | |||
--></span></includeonly><noinclude> | |||
{{docs}} | {{docs}} | ||
Line 67: | Line 26: | ||
"1": { | "1": { | ||
"label": "Item", | "label": "Item", | ||
"description": "What item are you looking for? | "description": "What item are you looking for? Any casing is allowed, including lowercase.", | ||
"type": "line", | "type": "line", | ||
" | "required": true, | ||
"example": "lv coil" | |||
}, | }, | ||
"size": { | "size": { |
Revision as of 20:58, 15 August 2024
Examples
{{item icon
↓
Script error: The function "lookup_item_id_by_name" does not exist.
A list of all items with icons
Contains all items with icons. Updates automatically.
Script error: The function "generate_item_icons_for_all_items_with_icons" does not exist.
Errors
Unknown item
{{item icon
↓
Script error: The function "lookup_item_id_by_name" does not exist.
No image defined for item
{{item icon
↓
Script error: The function "lookup_item_id_by_name" does not exist.
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Item | 1 | What item are you looking for? Any casing is allowed, including lowercase.
| Line | required |
Size | size | Icon size
| Line | suggested |
Label | label l | Label override. | Line | suggested |