Jump to content

Extension:Tilesheets

From mediawiki.org
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

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

[edit]
  • 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

[edit]

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

[edit]

#icon

[edit]

Outputs the HTML to produce a single tile icon.

Parameters
[edit]
  • 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

[edit]

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
[edit]
  • 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

[edit]

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

action=addtiles

[edit]

Adds a set of tiles to a given tilesheet.

Parameters

[edit]
  • 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]
  • edit
    • addtiles
      • Tile name => The new entry ID for the tile

Possible errors

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

action=deletesheet

[edit]

Deletes tilesheets by the mod abbreviations specified.

Parameters

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

Returns

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

Possible errors

[edit]
  • permissiondenied: User does not have the edittilesheets permission.

action=createsheet

[edit]

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

Parameters

[edit]
  • 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]
  • edit
    • createsheet
      • Provided mod abbreviation => Whether it was successfully created (boolean).

Possible errors

[edit]
  • permissiondenied: User does not have the edittilesheets permission.

action=deletetiles

[edit]

Deletes individual tile entries from the database.

Parameters

[edit]
  • 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]
  • edit
    • deletetiles
      • Entry ID => Whether it was successfully deleted (boolean)
      • ...

Possible errors

[edit]
  • permissiondenied: User does not have the edittilesheets permission.

action=editsheet

[edit]

Edits a sheet's data.

Parameters

[edit]
  • 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]
  • edit
    • editsheet
      • Old mod abbreviation => New mod abbreviation (identical if no change)
      • Old sheet sizes => New sheet sizes (identical if no change)

Possible errors

[edit]
  • 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

[edit]

Edits a tile entry's data.

Parameters

[edit]
  • 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]
  • edit
    • edittile
      • The entry's ID => true

Possible errors

[edit]
  • 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

[edit]

Deletes a translation for an entry ID.

Parameters

[edit]
  • 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]
  • edit
    • deletetranslation
      • id => The entry's ID
      • language => The language for which translation was deleted

Possible errors

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

action=translatetile

[edit]

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

Parameters

[edit]
  • 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]
  • 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

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

action=query&list=tilesheets

[edit]

Get all of the sheets.

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

Parameters

[edit]
  • 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

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

Possible errors

[edit]

This module does not make any errors.

action=query&list=tiles

[edit]

Get all of the tiles filtered by mod.

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

Parameters

[edit]
  • 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

[edit]
  • 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

[edit]

This module does not make any errors.

action=query&list=tiletranslations

[edit]

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

Parameters

[edit]
  • 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

[edit]
  • 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

[edit]

This module does not make any errors.

action=query&list=tileusages

[edit]

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

[edit]
  • 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

[edit]
  • 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

[edit]

This module does not make any errors.