Module:Item/doc: Difference between revisions
From Space Station 14 Wiki
(json files) |
(intro, faq) |
||
Line 9: | Line 9: | ||
Implements {{t|Item}}. | Implements {{t|Item}}. | ||
Known items are synced regularly from the upstream, but things like icons and links must be defined manually. See [[#JSON files]] to see what data files there are, and see [[#FAQ]] on specific instructions. | |||
== JSON files == | == JSON files == | ||
Line 21: | Line 23: | ||
* [[Module:Item/item image files by item id.json]] - a mapping for item IDs to image files for these items. Can be a simple 1 to 1 mapping of item name to file name, or can have a whole config that allows to define multiple images per single ID (see sections below for more info). Used to add icons to items. | * [[Module:Item/item image files by item id.json]] - a mapping for item IDs to image files for these items. Can be a simple 1 to 1 mapping of item name to file name, or can have a whole config that allows to define multiple images per single ID (see sections below for more info). Used to add icons to items. | ||
* [[Module:Item/item page links by item ids.json]] - a 1 to 1 mapping of item IDs to page names. Used to turn items into links to their pages (or any other page on the wiki). | * [[Module:Item/item page links by item ids.json]] - a 1 to 1 mapping of item IDs to page names. Used to turn items into links to their pages (or any other page on the wiki). | ||
== FAQ == | |||
=== How to add new item? === | |||
New items are added automatically. This doesn't include icons - for that, see [[#How to add icon to item?]]. | |||
=== Where to get item ID? === | |||
From [[Module:Item/item_names_by_item_ids.json]]. | |||
=== How to add icon to item? === | |||
1. Upload new icon to the wiki. | |||
2. Go to [[Module:Item/item_image_files_by_item_id.json]]. | |||
3. Add a new line before the first entry. Follow the format: {{c|"<item ID>": "<file name>",}} | |||
{{Callout|Example| | |||
{{c|"WeaponLaserCarbine": "laser rifle-East-35325.png",}} | |||
}} | |||
4. Save the file. It should now appear when using {{t|item}}. | |||
== TODO == | == TODO == |
Revision as of 12:00, 17 September 2024
Module documentation
|
---|
View or edit this documentation • (about module documentation) |
Implements {{Item}}.
Known items are synced regularly from the upstream, but things like icons and links must be defined manually. See #JSON files to see what data files there are, and see #FAQ on specific instructions.
JSON files
JSON files that are updated automatically, syncing with the upstream:
- Module:Item/item names by item ids.json - contains 1 to 1 mapping of item IDs to their names.
- Module:Item/item ids by item lowercase names.json - contains 1 to 1 mapping of item names (lowercase) to their IDs. If a name repeats for multiple items, only a single item ID will be defined here.
Warning
Do not make changes to the above JSON files - any changes made will be erased on next update.
JSON files that are filled manually:
- Module:Item/item ids by item lowercase names overrides.json - a 1 to 1 mapping of item names (lowercase) to their IDs. This one has a higher priority than the other one, so it can be used to override existing name → ID mappings or create new ones.
- Module:Item/item image files by item id.json - a mapping for item IDs to image files for these items. Can be a simple 1 to 1 mapping of item name to file name, or can have a whole config that allows to define multiple images per single ID (see sections below for more info). Used to add icons to items.
- Module:Item/item page links by item ids.json - a 1 to 1 mapping of item IDs to page names. Used to turn items into links to their pages (or any other page on the wiki).
FAQ
How to add new item?
New items are added automatically. This doesn't include icons - for that, see #How to add icon to item?.
Where to get item ID?
From Module:Item/item_names_by_item_ids.json.
How to add icon to item?
1. Upload new icon to the wiki.
2. Go to Module:Item/item_image_files_by_item_id.json.
3. Add a new line before the first entry. Follow the format: "<item ID>": "<file name>",
Example
"WeaponLaserCarbine": "laser rifle-East-35325.png",
4. Save the file. It should now appear when using {{item}}.
TODO
- Ores are currently hardcoded into names overrides. Figure out a way to pull them from game resources. This is for Module:Item recipe.