Extension:Tilesheets

From Linux Web Expert

MediaWiki extensions manual
Tilesheets
Release status: stable
Implementation Parser function , User rights , Special page , API , Database
Description Adds a parser function that looks up a table for an item and returns the requested image.
Author(s)
  • Telshin
  • Noahm
  • Cameron Chunn
  • Alexia E. Smith
Latest version 5.0.2 (2024-03-23)
MediaWiki
Tables ext_tilesheet_images
ext_tilesheet_items
ext_tilesheet_languages
ext_tilesehet_tilelinks
License MIT License
Download
README.md
CHANGELOG.md
edittilesheets
importtilesheets
translatetiles
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').

The Tilesheets extension adds a parser function to select a set item in an image of tiles, or sprites. It uses the OreDict extension, so that should typically be installed as well. Tilesheets can be any size, but they are typically "16, 32". The size indicates the size of the individual tiles (as in 16x16 and 32x32 in this case).

Special pages

  • CreateTileSheet - Create a new tilesheet by supplying a mod abbreviation, the sizes of the tilesheets separated by commas, and a list of tile coordinates with their according tile names.
  • SheetList – Lists all tilesheets on the wiki.
  • SheetManager – Used to edit a single tilesheet's data.
  • TileList – Lists all tiles on the wiki.
  • TileManager – Used to edit a single tile's data.
  • TileTranslator – Used to edit the translation data (name and description, in any language code) of a given tile.
  • ViewTile – Used to show a specific tile at all of its sizes. The tiles are displayed in a table. It provides no forms, so the tile entry ID must be supplied using subpage syntax (for example, Special:ViewTile/1 to show the tile at entry ID 1).
  • WhatUsesThisTile – Lists all uses of a given tile ID, essentially a version of Special:WhatLinksHere for tiles. Uses subpage syntax.

Usage

The Tilesheets extension has an API, so it can be used both on the wiki directly, and through MediaWiki's web API.

For non-API usage information, please read the Tilesheet update guide on the Feed The Beast Wiki.

Parser functions

#icon

Outputs the HTML to produce a single tile icon.

Parameters
  • item: The name of the item.
  • mod: The mod abbreviation of the item. Defaults to "undefined", which will produce an error.
  • size: The size of tile to retrieve. Defaults to "32".

#iconloc

Outputs the localized name or description for a single tile, in the specified language. If there is no localized name or description, it will fall back to the provided item's name.

Parameters
  • The name of the item (not localized).
  • The mod abbreviation.
  • The type of data to get. Must be either "name" or "description". Defaults to "name".
  • The language code to get the localized data for. Defaults to "en".

API

The Tilesheets extensions provides MediaWiki API action modules for interacting with the extension. The parameters are prefixed with ts.

action=addtiles

Adds a set of tiles to a given tilesheet.

Parameters

  • token (csrf)
  • summary (String): (Optional) An option edit summary.
  • mod (String): (Required) The tile name.
  • import (String, separate multiple values with "|"): (Required) A pipe separated list of entries formatted as X Y Item Name.

Returns

  • edit
    • addtiles
      • Tile name => The new entry ID for the tile

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.
  • nosheetfound: There is no tilesheet for the provided mod abbreviation.

action=deletesheet

Deletes tilesheets by the mod abbreviations specified.

Parameters

  • mods (String): (Required, separate values with "|") The mod abbreviations to delete.
  • summary (String): (Optional) An optional edit summary.
  • token (csrf)

Returns

  • edit
    • deletesheet
      • Mod abbreviation => Whether the deletion of this sheet was successful (boolean)
      • ...

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.

action=createsheet

Creates a new tilesheet with the given mod abbreviation and sizes.

Parameters

  • token (csrf)
  • summary (String): (Optional) An optional edit summary.
  • mod (String): (Required) The mod abbreviation.
  • sizes (String, separate multiple values with "|"): (Defaults to "16|32") Pipe separated list of tile sizes.

Returns

  • edit
    • createsheet
      • Provided mod abbreviation => Whether it was successfully created (boolean).

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.

action=deletetiles

Deletes individual tile entries from the database.

Parameters

  • token (csrf)
  • summary (String): (Optional) An optional edit summary.
  • ids (Integer, separate values with "|", minimum value is "1"): (Required) A list of entry IDs to delete.

Returns

  • edit
    • deletetiles
      • Entry ID => Whether it was successfully deleted (boolean)
      • ...

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.

action=editsheet

Edits a sheet's data.

Parameters

  • token (csrf)
  • summary (String): (Optional) An optional edit summary.
  • mod (String): (Required) The current mod abbreviation.
  • tomod (String): (Optional) The new mod abbreviation.
  • tosizes (Integer, separate multiple values with "|"): (Optional) A pipe separated list of new sizes.

Returns

  • edit
    • editsheet
      • Old mod abbreviation => New mod abbreviation (identical if no change)
      • Old sheet sizes => New sheet sizes (identical if no change)

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.
  • nochangeparams: None of tomod or tosizes are set.
  • noentry: The mod abbreviation does not exist.
  • nochange: Both tomod and tosizes are set to the existing mod abbreviation and sizes.
  • updateerror: Some database error has occurred in updating the table; this does not necessarily mean that the change was not made.

action=edittile

Edits a tile entry's data.

Parameters

  • token (csrf)
  • summary (String): (Optional) An optional edit summary.
  • id (Integer): (Required) The entry ID for the tile.
  • toname (String): The new item name.
  • tomod (String): The new mod abbreviation.
  • tox (Integer): The new X coordinate.
  • toy (Integer): The new Y coordinate.

Returns

  • edit
    • edittile
      • The entry's ID => true

Possible errors

  • permissiondenied: User does not have the edittilesheets permission.
  • nochangeparams: None of toname, tomod, tox, toy are set.
  • noentry: The entry for the provided ID does not already exist.
  • update: Either the entry does not exist, or the entry's values were not changed in any way.

action=deletetranslation

Deletes a translation for an entry ID.

Parameters

  • token (csrf)
  • id (Integer, minimum value is "1"): (Required) The entry ID to delete.
  • lang (String): (Required) The language of the entry to delete.

Returns

  • edit
    • deletetranslation
      • id => The entry's ID
      • language => The language for which translation was deleted

Possible errors

  • entrynotexists: The entry for the provided ID and language does not exist.
  • permissiondenied: User does not have the edittilesheets permission.

action=translatetile

Translates the given tile data, either updating or creating a new entry.

Parameters

  • token (csrf)
  • id (Integer, minimum value is "1"): (Required) The tile entry ID.
  • lang (String): (Required) The language code to translate to.
  • name (String): (Optional) The localized name.
  • description (String): (Optional) The localized description.

Returns

  • edit
    • One of...
    • newtranslation (if the translation is new)
      • entry_id => The entry ID
      • language => The language code being translated to
      • display_name => The display name for the entry and language
      • description => The description for the entry and language
    • translatetile (if the translation already existed, but is now being updated)
      • entry_id => The entry ID
      • language => The language code being translated to
      • display_name => The display name for the entry and language
      • description => The description for the entry and language

Possible errors

  • permissiondenied: User does not have the translatetiles permission.
  • nochangeparam: Neither the lang and description parameters were not specified.

action=query&list=tilesheets

Get all of the sheets.

This module uses the continuation API. The from parameter is used as the continuation parameter.

Parameters

  • limit (Limit, minimum value is "1", maximum value for users is "500", maximum value for bots is "500"): (Defaults to "10") The maximum number of sheets to list.
  • from (String): (Defaults to "") The abbreviation to start listing at.

Returns

  • query
    • tilesheets
      • mod => The mod abbreviation.
      • sizes => The sizes for the tilesheet.

Possible errors

This module does not make any errors.

action=query&list=tiles

Get all of the tiles filtered by mod.

This module uses the continuation API. The from parameter is used as the continuation parameter.

Parameters

  • limit (Limit, minimum value is "1", maximum value for users is "500", maximum value for bots is "5000"): (Defaults to "10") The maximum number of tiles to list.
  • from (Integer): (Defaults to "0") The tile ID to start listing at.
  • mod (String): (Defaults to "") The mod to filter by.

Returns

  • query
    • tiles
      • 0
        • id => The entry's ID
        • mod => The entry's mod abbreviation
        • name => The item name for the entry
        • x => The entry's X coordinate
        • y => The entry's Y coordinate
      • ...

Possible errors

This module does not make any errors.

action=query&list=tiletranslations

Get all of the translations for the given entry ID and/or language.

Parameters

  • id (Integer, minimum value is "1"): (Required) The entry ID to get translations for.
  • lang (String): (Defaults to "") The language to get translations for.

Returns

  • query
    • tiles
      • 0
        • entry_id => The entry's ID
        • description => The description for the entry in this language
        • display_name => The display name for the entry in this language
        • language => The language code for the language of the description and display_name

Possible errors

This module does not make any errors.

action=query&list=tileusages

Gets all of the pages that are used by a particular tile entry ID.

This module uses the continuation API. The from parameter is used as the continuation parameter.

Parameters

  • limit (Limit, minimum value is "1", maximum value for users is "500", maximum value for bots is "5000"): (Defaults to "10") The maximum number of pages to list.
  • from (Integer): (Defaults to "0"): The page ID (not entry ID) to start listing at.
  • tile (Integer): (Defaults to "0", cannot be less than "0"): The tile entry ID to get usages for.
  • namespace (Namespace, separate multiple values with "|"): The namespace to enumerate.

Returns

  • query
    • tileusages
      • 0
        • entryid => The entry's ID.
        • pageid => The page ID
        • ns => The namespace
        • title => The name of the page, including its namespace (unless it is main).
      • ...

Possible errors

This module does not make any errors.