X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=game_api.txt;h=561387d2993e482be780d1472467172916f28562;hb=16c950f68808e8ebbeda5f71a9897ab8b54a3b21;hp=4f1ff9a2338f97c6e04dbe553849162c4c28c8a9;hpb=a81a7e0c7815f9118073a73c60fcb44fc65c486b;p=oweals%2Fminetest_game.git diff --git a/game_api.txt b/game_api.txt index 4f1ff9a2..561387d2 100644 --- a/game_api.txt +++ b/game_api.txt @@ -103,6 +103,13 @@ The contents of `creative.formspec_add` is appended to every creative inventory page. Mods can use it to add additional formspec elements onto the default creative inventory formspec to be drawn after each update. +Group overrides can be used for any registered item, node or tool. Use one of +the groups stated below to pick which category it will appear in. + + node = 1 -- Appears in the Nodes category + tool = 1 -- Appears in the Tools category + craftitem = 1 -- Appears in the Items category + Chests API ---------- @@ -129,12 +136,12 @@ The chests API allows the creation of chests, which have their own inventories f * A table indexed by player name to keep track of who opened what chest. * Key: The name of the player. * Value: A table containing information about the chest the player is looking at. - e.g `{ pos = {1, 1, 1}, sound = null, swap = "chest" }` + e.g `{ pos = {1, 1, 1}, sound = null, swap = "default:chest" }` `default.chest.register_chest(name, def)` * Registers new chest - * `name` Name for chest + * `name` Name for chest e.g. "default:chest" * `def` See [#Chest Definition] ### Chest Definition @@ -359,6 +366,8 @@ The farming API allows you to easily register plants and hoes. { description = "", -- Description of seed item + harvest_description = "", -- Description of harvest item + -- (optional, derived automatically if not provided) inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image steps = 8, -- How many steps the plant has to grow, until it can be harvested -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) @@ -422,7 +431,7 @@ Give Initial Stuff API Players API ----------- -The player API can register player models and update the player's appearence +The player API can register player models and update the player's appearance. * `player_api.register_model(name, def)` * Register a new model to be used by players @@ -455,6 +464,12 @@ The player API can register player models and update the player's appearence * Any of the fields of the returned table may be nil. * player: PlayerRef +* `player_api.player_attached` + * A table that maps a player name to a boolean. + * If the value for a given player is set to true, the default player + animations (walking, digging, ...) will no longer be updated. + Knockback from damage is also prevented for that player. + ### Model Definition { @@ -465,7 +480,7 @@ The player API can register player models and update the player's appearence -- = {x = , y = }, foo = {x = 0, y = 19}, bar = {x = 20, y = 39}, - -- ... + -- ... }, collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position stepheight = 0.6, -- In nodes @@ -726,27 +741,29 @@ delivered with Minetest Game, to keep them compatible with other mods. * `sounds`: See [#Default sounds] * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] -`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex)` +`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)` * Registers an inner corner stair * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` * `groups`: See [Known damage and digging time defining groups] * `images`: See [Tile definition] - * `description`: Used for the description field in the stair's definition + * `description`: Used for the description field in the stair's definition with "Inner" prepended * `sounds`: See [#Default sounds] * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] + * `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional) -`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex)` +`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)` * Registers an outer corner stair * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` * `groups`: See [Known damage and digging time defining groups] * `images`: See [Tile definition] - * `description`: Used for the description field in the stair's definition + * `description`: Used for the description field in the stair's definition with "Outer" prepended * `sounds`: See [#Default sounds] * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] + * `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional) `stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)` @@ -769,7 +786,11 @@ Creates panes that automatically connect to each other ### Pane definition { - textures = {"texture for sides", (unused), "texture for top and bottom"}, -- More tiles aren't supported + textures = { + "texture for front and back", + (unused), + "texture for the 4 edges" + }, -- More tiles aren't supported groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups] sounds = SoundSpec, -- See [#Default sounds] recipe = {{"","","","","","","","",""}}, -- Recipe field only @@ -1047,3 +1068,11 @@ for the wielded skeleton key. if `nil` is returned, it is assumed that the wielder did not have permissions to create a key for this node, and no key is created. + +`default.register_craft_metadata_copy(ingredient, result)` +---------------------------------------------------------- + +This function registers a shapeless recipe that takes `ingredient` +and `result` as input and outputs `result`. + +The metadata of the input `result` is copied to the output `result`.