improve README and api documentation

stable-5.2
mckaygerhard 2022-02-28 20:06:40 -04:00
parent e7b5ffbc47
commit 239e7287c6
4 changed files with 1655 additions and 247 deletions

View File

@ -1,24 +1,83 @@
# Minetest5 Game Minetest5 Game
==============
The default game bundled in the Minetest5 engine. The default game for the Minetest5 engine.
For further information, check This is a fork from minetest default game, this
[this forum topic](https://forum.minetest.net/viewtopic.php?f=15&t=9724). are made from minenux project https://codeberg.org/minenux
Also see the [Minetest Wiki](https://wiki.minetest.net/Subgames/Minetest_Game) for minetest v5 and minetest v4 or 0.4.
for more information.
Introduction
------------
This is the branch `stable-5.2` of minetest game for minetest5 a version
that is focused in v5 of minetest but mainly in 5.2 release. There's
also a minetest4 game version too in `stable-4.0` branch.
This are focused to provide minimal default game featured for minetest5
to be playable, with an [api](game_api.md) for more aditions (in the form of mods)
For further information, check the [Minetest Wiki](https://wiki.minetest.net/Subgames/Minetest_Game)
## Download
Can be obtained from https://codeberg.org/minenux/minetest-game-minetest/tags
those like 5.2.X by example https://codeberg.org/minenux/minetest-game-minetest/releases/tag/5.2.1
It will download a tar.gz file, uncompress the content and a directory will be created,
the name of the directory does not matter, the contents will be used later to install.
When stable releases are made, Minetest Game and the Minetest engine is packaged
and made available at https://codeberg.org/minenux/minetest-engine/archive/stable-5.2.tar.gz
or generally at https://codeberg.org/minenux/minetest-engine/releases/tag/5.2.1 by example.
## Installation ## Installation
- Unzip the archive, rename the folder to minetest5_game and This game can be used in any version from 5.0 to 5.2, it may work with 5.3 but not with 5.5
place it in .. minetest5/games/
After download, rename the directory decompressed to `minetest_game` and put to the "games" directory:
- GNU/Linux: If you use a system-wide installation place - GNU/Linux: If you use a system-wide installation place
it in ~/.minetest5/games/. it in ~/.minetest5/games/.
- Others: `minetest/games/` or `games` directory from the path were the binary are.
The minetest5 engine can be found at [GitHub](https://github.com/minetest5/minetest5). For further information or help, see: https://wiki.minetest.net/Installing_Mods
For further information or help, see: ## Content
https://wiki.minetest.net/Installing_Mods
* api
* beds
* butterflies
* default
* doors
* dungeon_loot
* farming
* fire
* give_initial_stuff
* bucket
* map
* bones
* fireflies
* player_api
* stairs
* wool
* binoculars
* carts
* dye
* flowers
* screwdriver
* tnt
* xpanes
* boats
* creative
* env_sounds
* game_commands
* sethome
* sfinv
* spawn
* weather
* vessels
* walls
## Compatibility ## Compatibility
@ -27,10 +86,6 @@ from https://codeberg.org/minenux/minetest-engine/src/branch/stable-5.2
Additionally, when the Minetest5 engine is tagged to be a certain version (e.g. Additionally, when the Minetest5 engine is tagged to be a certain version (e.g.
5.2.1), Minetest Game is tagged with the version 5.2.1 too. 5.2.1), Minetest Game is tagged with the version 5.2.1 too.
When stable releases are made, Minetest Game and the Minetest engine is packaged
and made available at https://codeberg.org/minenux/minetest-engine/archive/stable-5.2.tar.gz
or generally at https://codeberg.org/minenux/minetest-engine/releases/tag/5.2.1 by example.
## Licensing ## Licensing
See `LICENSE.txt` See `LICENSE.txt`

1188
game_api.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,90 @@
Minetest Game API Minetest5 Game API
================= =================
GitHub Repo: https://github.com/minetest/minetest_game
This is a fork of the original one at https://github.com/minetest/minetest_game
For more information about fork check [Differences](#differences) section.
Introduction Introduction
------------ ------------
The Minetest Game game offers multiple new possibilities in addition to the Minetest engine's built-in API, The Minetest5 Game game offers multiple new possibilities in addition to the Minetest engine's built-in API,
allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes. allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
For information on the Minetest5 API, visit https://codeberg.org/minenux/minetest-engine-minetest/src/branch/stable-5.2/doc/lua_api.txt
Please note: Please note:
* [XYZ] refers to a section the Minetest API * [XYZ] refers to a section the Minetest API
* [#ABC] refers to a section in this document * [#ABC] refers to a section in this document
* [pos] refers to a position table `{x = -5, y = 0, z = 200}` * [pos] refers to a position table `{x = -5, y = 0, z = 200}`
## Table of Contents
Bucket API - [Differences](#differences)
- [Bucket API](#bucket-api)
- [Beds API](#beds-api)
- [Bed definition](#bed-definition)
- [Bones API](#bones-api)
- [Creative API](#creative-api)
- [Chests API](#chests-api)
- [Chest Definition](#chest-definition)
- [Doors API](#doors-api)
- [door ObjectRef Methods](#door-objectref-methods)
- [Door definition](#door-definition)
- [Trapdoor definition](#trapdoor-definition)
- [Fence gate definition](#fence-gate-definition)
- [Dungeon Loot API](#dungeon-loot-api)
- [Loot definition](#loot-definition)
- [Fence API](#fence-api)
- [fence definition](#fence-definition)
- [Walls API](#walls-api)
- [Farming API](#farming-api)
- [Hoe Definition](#hoe-definition)
- [Plant definition](#plant-definition)
- [Fire API](#fire-api)
- [Give Initial Stuff API](#give-initial-stuff-api)
- [Players API](#players-api)
- [Model Definition](#model-definition)
- [TNT API](#tnt-api)
- [Screwdriver API](#screwdriver-api)
- [Sethome API](#sethome-api)
- [Sfinv API](#sfinv-api)
- [sfinv Methods](#sfinv-methods)
- [sfinv Members](#sfinv-members)
- [Context](#context)
- [sfinv.register_page](#sfinvregister_page)
- [get formspec](#get-formspec)
- [Customising themes](#customising-themes)
- [Stairs API](#stairs-api)
- [Xpanes API](#xpanes-api)
- [Pane definition](#pane-definition)
- [Raillike definitions](#raillike-definitions)
- [Default sounds](#default-sounds)
- [Default constants](#default-constants)
- [GUI and formspecs](#gui-and-formspecs)
- [Leafdecay](#leafdecay)
- [Dyes](#dyes)
- [Trees](#trees)
- [Carts](#carts)
- [Key API](#key-api)
## Differences
This game api is the same.. just that format the document and progresivelly added new things,
this is cos this game sustitute some mods by improved versions:
* boats by the minetest-mod-boats forked from tenplus1
* creative by the minetest-mod-creative improved
* tnt by the minetest-mod-tnt forked and improved from tenplus1
* wool by the minetest-mod-wool forked and improved from tenplus1
* carts by the minetest-mod-carts forked and improved from tenplus1
* fire by the minetest-mod-fire forked and improved from templus1
* torch as sistution of `default:torch` by the minetest-mod-torchs
The original api from those remains but aditional (independient documented in each one)
are added.
## Bucket API
---------- ----------
The bucket API allows registering new types of buckets for non-default liquids. The bucket API allows registering new types of buckets for non-default liquids.
@ -37,7 +105,7 @@ The filled bucket item is returned to the player that uses an empty bucket point
When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered. When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered.
Beds API ## Beds API
-------- --------
beds.register_bed( beds.register_bed(
@ -45,10 +113,10 @@ Beds API
def -- See [#Bed definition] def -- See [#Bed definition]
) )
* `beds.can_dig(bed_pos)` Returns a boolean whether the bed at `bed_pos` may be dug * `beds.can_dig(bed_pos)` Returns a boolean whether the bed at `bed_pos` may be dug
* `beds.read_spawns() ` Returns a table containing players respawn positions * `beds.read_spawns() ` Returns a table containing players respawn positions
* `beds.kick_players()` Forces all players to leave bed * `beds.kick_players()` Forces all players to leave bed
* `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping * `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping
### Bed definition ### Bed definition
@ -72,7 +140,7 @@ Beds API
} }
Bones API ## Bones API
--------- ---------
An ordered list of listnames (default: "main", "craft") of the player inventory, An ordered list of listnames (default: "main", "craft") of the player inventory,
@ -82,7 +150,7 @@ in `bones.player_inventory_lists`.
e.g. `table.insert(bones.player_inventory_lists, "backpack")` e.g. `table.insert(bones.player_inventory_lists, "backpack")`
Creative API ## Creative API
------------ ------------
Use `creative.register_tab(name, title, items)` to add a tab with filtered items. Use `creative.register_tab(name, title, items)` to add a tab with filtered items.
@ -104,38 +172,38 @@ page. Mods can use it to add additional formspec elements onto the default
creative inventory formspec to be drawn after each update. creative inventory formspec to be drawn after each update.
Chests API ## Chests API
---------- ----------
The chests API allows the creation of chests, which have their own inventories for holding items. The chests API allows the creation of chests, which have their own inventories for holding items.
`default.chest.get_chest_formspec(pos)` `default.chest.get_chest_formspec(pos)`
* Returns a formspec for a specific chest. * Returns a formspec for a specific chest.
* `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}` * `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}`
`default.chest.chest_lid_obstructed(pos)` `default.chest.chest_lid_obstructed(pos)`
* Returns a boolean depending on whether or not a chest has its top obstructed by a solid node. * Returns a boolean depending on whether or not a chest has its top obstructed by a solid node.
* `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}` * `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}`
`default.chest.chest_lid_close(pn)` `default.chest.chest_lid_close(pn)`
* Closes the chest that a player is currently looking in. * Closes the chest that a player is currently looking in.
* `pn` The name of the player whose chest is going to be closed * `pn` The name of the player whose chest is going to be closed
`default.chest.open_chests` `default.chest.open_chests`
* A table indexed by player name to keep track of who opened what chest. * A table indexed by player name to keep track of who opened what chest.
* Key: The name of the player. * Key: The name of the player.
* Value: A table containing information about the chest the player is looking at. * 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 = "chest" }`
`default.chest.register_chest(name, def)` `default.chest.register_chest(name, def)`
* Registers new chest * Registers new chest
* `name` Name for chest * `name` Name for chest
* `def` See [#Chest Definition] * `def` See [#Chest Definition]
### Chest Definition ### Chest Definition
@ -155,59 +223,59 @@ The chests API allows the creation of chests, which have their own inventories f
protected = false, -- If true, only placer can modify chest. protected = false, -- If true, only placer can modify chest.
Doors API ## Doors API
--------- ---------
The doors mod allows modders to register custom doors and trapdoors. The doors mod allows modders to register custom doors and trapdoors.
`doors.registered_doors[name] = Door definition` `doors.registered_doors[name] = Door definition`
* Table of registered doors, indexed by door name * Table of registered doors, indexed by door name
`doors.registered_trapdoors[name] = Trapdoor definition` `doors.registered_trapdoors[name] = Trapdoor definition`
* Table of registered trap doors, indexed by trap door name * Table of registered trap doors, indexed by trap door name
`doors.register_door(name, def)` `doors.register_door(name, def)`
* Registers new door * Registers new door
* `name` Name for door * `name` Name for door
* `def` See [#Door definition] * `def` See [#Door definition]
`doors.register_trapdoor(name, def)` `doors.register_trapdoor(name, def)`
* Registers new trapdoor * Registers new trapdoor
* `name` Name for trapdoor * `name` Name for trapdoor
* `def` See [#Trapdoor definition] * `def` See [#Trapdoor definition]
`doors.register_fencegate(name, def)` `doors.register_fencegate(name, def)`
* Registers new fence gate * Registers new fence gate
* `name` Name for fence gate * `name` Name for fence gate
* `def` See [#Fence gate definition] * `def` See [#Fence gate definition]
`doors.get(pos)` `doors.get(pos)`
* `pos` A position as a table, e.g `{x = 1, y = 1, z = 1}` * `pos` A position as a table, e.g `{x = 1, y = 1, z = 1}`
* Returns an ObjectRef to a door, or nil if the position does not contain a door * Returns an ObjectRef to a door, or nil if the position does not contain a door
### Methods
:open(player) -- Open the door object, returns if door was opened
:close(player) -- Close the door object, returns if door was closed
:toggle(player) -- Toggle the door state, returns if state was toggled
:state() -- returns the door state, true = open, false = closed
the "player" parameter can be omitted in all methods. If passed then
the usual permission checks will be performed to make sure the player
has the permissions needed to open this door. If omitted then no
permission checks are performed.
`doors.door_toggle(pos, node, clicker)` `doors.door_toggle(pos, node, clicker)`
* Toggle door open or shut * Toggle door open or shut
* `pos` Position of the door * `pos` Position of the door
* `node` Node definition * `node` Node definition
* `clicker` Player definition for the player that clicked on the door * `clicker` Player definition for the player that clicked on the door
### door ObjectRef Methods
* `:open(player)` -- Open the door object, returns if door was opened
* `:close(player)` -- Close the door object, returns if door was closed
* `:toggle(player)` -- Toggle the door state, returns if state was toggled
* `:state()` -- returns the door state, true = open, false = closed
the "player" parameter can be omitted in all methods. If passed then
the usual permission checks will be performed to make sure the player
has the permissions needed to open this door. If omitted then no
permission checks are performed.
### Door definition ### Door definition
description = "Door description", description = "Door description",
@ -257,19 +325,19 @@ The doors mod allows modders to register custom doors and trapdoors.
-- function containing the on_rightclick callback -- function containing the on_rightclick callback
Dungeon Loot API ## Dungeon Loot API
---------------- ----------------
The mod that places chests with loot in dungeons provides an API to register additional loot. The mod that places chests with loot in dungeons provides an API to register additional loot.
`dungeon_loot.register(def)` `dungeon_loot.register(def)`
* Registers one or more loot items * Registers one or more loot items
* `def` Can be a single [#Loot definition] or a list of them * `def` Can be a single [#Loot definition] or a list of them
`dungeon_loot.registered_loot` `dungeon_loot.registered_loot`
* Table of all registered loot, not to be modified manually * Table of all registered loot, not to be modified manually
### Loot definition ### Loot definition
@ -291,7 +359,7 @@ The mod that places chests with loot in dungeons provides an API to register add
-- optional, defaults to no type restrictions -- optional, defaults to no type restrictions
Fence API ## Fence API
--------- ---------
Allows creation of new fences with "fencelike" drawtype. Allows creation of new fences with "fencelike" drawtype.
@ -313,7 +381,7 @@ Allows creation of new fences with "fencelike" drawtype.
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
Walls API ## Walls API
--------- ---------
The walls API allows easy addition of stone auto-connecting wall nodes. The walls API allows easy addition of stone auto-connecting wall nodes.
@ -326,19 +394,19 @@ walls.register(name, desc, texture, mat, sounds)
^ sounds = sounds: see [#Default sounds] ^ sounds = sounds: see [#Default sounds]
Farming API ## Farming API
----------- -----------
The farming API allows you to easily register plants and hoes. The farming API allows you to easily register plants and hoes.
`farming.register_hoe(name, hoe definition)` `farming.register_hoe(name, hoe definition)`
* Register a new hoe, see [#hoe definition] * Register a new hoe, see [#hoe definition]
`farming.register_plant(name, Plant definition)` `farming.register_plant(name, Plant definition)`
* Register a new growing plant, see [#Plant definition] * Register a new growing plant, see [#Plant definition]
`farming.registered_plants[name] = definition` `farming.registered_plants[name] = definition`
* Table of registered plants, indexed by plant name * Table of registered plants, indexed by plant name
### Hoe Definition ### Hoe Definition
@ -369,7 +437,7 @@ The farming API allows you to easily register plants and hoes.
} }
Fire API ## Fire API
-------- --------
Add group flammable when registering a node to make fire seek for it. Add group flammable when registering a node to make fire seek for it.
@ -378,18 +446,18 @@ New node def property:
`on_burn(pos)` `on_burn(pos)`
* Called when fire attempts to remove a burning node. * Called when fire attempts to remove a burning node.
* `pos` Position of the burning node. * `pos` Position of the burning node.
`on_ignite(pos, igniter)` `on_ignite(pos, igniter)`
* Called when Flint and steel (or a mod defined ignitor) is used on a node. * Called when Flint and steel (or a mod defined ignitor) is used on a node.
Defining it may prevent the default action (spawning flames) from triggering. Defining it may prevent the default action (spawning flames) from triggering.
* `pos` Position of the ignited node. * `pos` Position of the ignited node.
* `igniter` Player that used the tool, when available. * `igniter` Player that used the tool, when available.
Give Initial Stuff API ## Give Initial Stuff API
---------------------- ----------------------
`give_initial_stuff.give(player)` `give_initial_stuff.give(player)`
@ -421,7 +489,7 @@ Give Initial Stuff API
^ Adds items to the list of items to be given ^ Adds items to the list of items to be given
Players API ## Players API
----------- -----------
The player API can register player models and update the player's appearance. The player API can register player models and update the player's appearance.
@ -430,7 +498,7 @@ The player API can register player models and update the player's appearance.
* Register a new model to be used by players * Register a new model to be used by players
* name: model filename such as "character.x", "foo.b3d", etc. * name: model filename such as "character.x", "foo.b3d", etc.
* def: See [#Model definition] * def: See [#Model definition]
* saved to player_api.registered_models * saved to player_api.registered_models
* `player_api.registered_player_models[name]` * `player_api.registered_player_models[name]`
* Get a model's definition * Get a model's definition
@ -481,22 +549,22 @@ The player API can register player models and update the player's appearance.
} }
TNT API ## TNT API
------- -------
`tnt.register_tnt(definition)` `tnt.register_tnt(definition)`
^ Register a new type of tnt. ^ Register a new type of tnt.
* `name` The name of the node. If no prefix is given `tnt` is used. * `name` The name of the node. If no prefix is given `tnt` is used.
* `description` A description for your TNT. * `description` A description for your TNT.
* `radius` The radius within which the TNT can destroy nodes. The default is 3. * `radius` The radius within which the TNT can destroy nodes. The default is 3.
* `damage_radius` The radius within which the TNT can damage players and mobs. By default it is twice the `radius`. * `damage_radius` The radius within which the TNT can damage players and mobs. By default it is twice the `radius`.
* `sound` The sound played when explosion occurs. By default it is `tnt_explode`. * `sound` The sound played when explosion occurs. By default it is `tnt_explode`.
* `disable_drops` Disable drops. By default it is set to false. * `disable_drops` Disable drops. By default it is set to false.
* `ignore_protection` Don't check `minetest.is_protected` before removing a node. * `ignore_protection` Don't check `minetest.is_protected` before removing a node.
* `ignore_on_blast` Don't call `on_blast` even if a node has one. * `ignore_on_blast` Don't call `on_blast` even if a node has one.
* `tiles` Textures for node * `tiles` Textures for node
* `side` Side tiles. By default the name of the tnt with a suffix of `_side.png`. * `side` Side tiles. By default the name of the tnt with a suffix of `_side.png`.
* `top` Top tile. By default the name of the tnt with a suffix of `_top.png`. * `top` Top tile. By default the name of the tnt with a suffix of `_top.png`.
* `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`. * `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`.
@ -508,7 +576,7 @@ TNT API
* `position` The center of explosion. * `position` The center of explosion.
* `definition` The TNT definion as passed to `tnt.register` with the following addition: * `definition` The TNT definion as passed to `tnt.register` with the following addition:
* `explode_center` false by default which removes TNT node on blast, when true will explode center node. * `explode_center` false by default which removes TNT node on blast, when true will explode center node.
`tnt.burn(position, [nodename])` `tnt.burn(position, [nodename])`
@ -555,7 +623,7 @@ Both nodedefs and entitydefs can provide an `on_blast()` callback
* `drops` - a list of drops, e.g. {"wool:red"} * `drops` - a list of drops, e.g. {"wool:red"}
Screwdriver API ## Screwdriver API
--------------- ---------------
The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it. The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it.
@ -563,18 +631,18 @@ To use it, add the `on_screwdriver` function to the node definition.
`on_rotate(pos, node, user, mode, new_param2)` `on_rotate(pos, node, user, mode, new_param2)`
* `pos` Position of the node that the screwdriver is being used on * `pos` Position of the node that the screwdriver is being used on
* `node` that node * `node` that node
* `user` The player who used the screwdriver * `user` The player who used the screwdriver
* `mode` screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS * `mode` screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS
* `new_param2` the new value of param2 that would have been set if on_rotate wasn't there * `new_param2` the new value of param2 that would have been set if on_rotate wasn't there
* return value: false to disallow rotation, nil to keep default behaviour, true to allow * return value: false to disallow rotation, nil to keep default behaviour, true to allow
it but to indicate that changed have already been made (so the screwdriver will wear out) it but to indicate that changed have already been made (so the screwdriver will wear out)
* use `on_rotate = false` to always disallow rotation * use `on_rotate = false` to always disallow rotation
* use `on_rotate = screwdriver.rotate_simple` to allow only face rotation * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
Sethome API ## Sethome API
----------- -----------
The sethome API adds three global functions to allow mods to read a players home position, The sethome API adds three global functions to allow mods to read a players home position,
@ -582,22 +650,22 @@ set a players home position and teleport a player to home position.
`sethome.get(name)` `sethome.get(name)`
* `name` Player who's home position you wish to get * `name` Player who's home position you wish to get
* return value: false if no player home coords exist, position table if true * return value: false if no player home coords exist, position table if true
`sethome.set(name, pos)` `sethome.set(name, pos)`
* `name` Player who's home position you wish to set * `name` Player who's home position you wish to set
* `pos` Position table containing coords of home position * `pos` Position table containing coords of home position
* return value: false if unable to set and save new home position, otherwise true * return value: false if unable to set and save new home position, otherwise true
`sethome.go(name)` `sethome.go(name)`
* `name` Player you wish to teleport to their home position * `name` Player you wish to teleport to their home position
* return value: false if player cannot be sent home, otherwise true * return value: false if player cannot be sent home, otherwise true
Sfinv API ## Sfinv API
--------- ---------
It is recommended that you read this link for a good introduction to the It is recommended that you read this link for a good introduction to the
@ -706,7 +774,7 @@ And override this function to change the layout:
end end
Stairs API ## Stairs API
---------- ----------
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
@ -714,67 +782,67 @@ delivered with Minetest Game, to keep them compatible with other mods.
`stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)` `stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
* Registers a stair * Registers a stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups] * `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition] * `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
* `sounds`: See [#Default sounds] * `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
`stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)` `stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
* Registers a slab * Registers a slab
* `subname`: Basically the material name (e.g. cobble) used for the slab name. Nodename pattern: "stairs:slab_subname" * `subname`: Basically the material name (e.g. cobble) used for the slab name. Nodename pattern: "stairs:slab_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
* `groups`: See [Known damage and digging time defining groups] * `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition] * `images`: See [Tile definition]
* `description`: Used for the description field in the slab's definition * `description`: Used for the description field in the slab's definition
* `sounds`: See [#Default sounds] * `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] * `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, full_description)` `stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
* Registers an inner corner stair * Registers an inner corner stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname" * `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` * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups] * `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition] * `images`: See [Tile definition]
* `description`: Used for the description field in the stair's definition with "Inner" prepended * `description`: Used for the description field in the stair's definition with "Inner" prepended
* `sounds`: See [#Default sounds] * `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] * `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) * `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, full_description)` `stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
* Registers an outer corner stair * Registers an outer corner stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname" * `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` * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups] * `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition] * `images`: See [Tile definition]
* `description`: Used for the description field in the stair's definition with "Outer" prepended * `description`: Used for the description field in the stair's definition with "Outer" prepended
* `sounds`: See [#Default sounds] * `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] * `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) * `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)` `stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)`
* A wrapper for stairs.register_stair, stairs.register_slab, stairs.register_stair_inner, stairs.register_stair_outer * A wrapper for stairs.register_stair, stairs.register_slab, stairs.register_stair_inner, stairs.register_stair_outer
* Uses almost the same arguments as stairs.register_stair * Uses almost the same arguments as stairs.register_stair
* `desc_stair`: Description for stair nodes. For corner stairs 'Inner' or 'Outer' will be prefixed * `desc_stair`: Description for stair nodes. For corner stairs 'Inner' or 'Outer' will be prefixed
* `desc_slab`: Description for slab node * `desc_slab`: Description for slab node
Xpanes API ## Xpanes API
---------- ----------
Creates panes that automatically connect to each other Creates panes that automatically connect to each other
`xpanes.register_pane(subname, def)` `xpanes.register_pane(subname, def)`
* `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}" * `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
* `def`: See [#Pane definition] * `def`: See [#Pane definition]
### Pane definition ### Pane definition
@ -791,7 +859,7 @@ Creates panes that automatically connect to each other
} }
Raillike definitions ## Raillike definitions
-------------------- --------------------
The following nodes use the group `connect_to_raillike` and will only connect to The following nodes use the group `connect_to_raillike` and will only connect to
@ -810,64 +878,64 @@ add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` tabl
of your node. of your node.
Default sounds ## Default sounds
-------------- --------------
Sounds inside the default table can be used within the sounds field of node definitions. Sounds inside the default table can be used within the sounds field of node definitions.
* `default.node_sound_defaults()` * `default.node_sound_defaults()`
* `default.node_sound_stone_defaults()` * `default.node_sound_stone_defaults()`
* `default.node_sound_dirt_defaults()` * `default.node_sound_dirt_defaults()`
* `default.node_sound_sand_defaults()` * `default.node_sound_sand_defaults()`
* `default.node_sound_wood_defaults()` * `default.node_sound_wood_defaults()`
* `default.node_sound_leaves_defaults()` * `default.node_sound_leaves_defaults()`
* `default.node_sound_glass_defaults()` * `default.node_sound_glass_defaults()`
* `default.node_sound_metal_defaults()` * `default.node_sound_metal_defaults()`
Default constants ## Default constants
----------------- -----------------
`default.LIGHT_MAX` The maximum light level (see [Node definition] light_source) `default.LIGHT_MAX` The maximum light level (see [Node definition] light_source)
GUI and formspecs ## GUI and formspecs
----------------- -----------------
`default.get_hotbar_bg(x, y)` `default.get_hotbar_bg(x, y)`
* Get the hotbar background as string, containing the formspec elements * Get the hotbar background as string, containing the formspec elements
* x: Horizontal position in the formspec * x: Horizontal position in the formspec
* y: Vertical position in the formspec * y: Vertical position in the formspec
`default.gui_bg` `default.gui_bg`
* Deprecated, remove from mods. * Deprecated, remove from mods.
`default.gui_bg_img` `default.gui_bg_img`
* Deprecated, remove from mods. * Deprecated, remove from mods.
`default.gui_slots` `default.gui_slots`
* Deprecated, remove from mods. * Deprecated, remove from mods.
`default.gui_survival_form` `default.gui_survival_form`
* Entire formspec for the survival inventory * Entire formspec for the survival inventory
`default.get_furnace_active_formspec(fuel_percent, item_percent)` `default.get_furnace_active_formspec(fuel_percent, item_percent)`
* Get the active furnace formspec using the defined GUI elements * Get the active furnace formspec using the defined GUI elements
* fuel_percent: Percent of how much the fuel is used * fuel_percent: Percent of how much the fuel is used
* item_percent: Percent of how much the item is cooked * item_percent: Percent of how much the item is cooked
`default.get_furnace_inactive_formspec()` `default.get_furnace_inactive_formspec()`
* Get the inactive furnace formspec using the defined GUI elements * Get the inactive furnace formspec using the defined GUI elements
Leafdecay ## Leafdecay
--------- ---------
To enable leaf decay for leaves when a tree is cut down by a player, To enable leaf decay for leaves when a tree is cut down by a player,
@ -901,7 +969,7 @@ callback overridden. All the nodes listed in `leaves` have their
`on_timer` callback overridden. `on_timer` callback overridden.
Dyes ## Dyes
---- ----
Minetest Game dyes are registered with: Minetest Game dyes are registered with:
@ -913,21 +981,21 @@ dye group and the color groups.
Dye color groups: Dye color groups:
* `color_white` * `color_white`
* `color_grey` * `color_grey`
* `color_dark_grey` * `color_dark_grey`
* `color_black` * `color_black`
* `color_red` * `color_red`
* `color_pink` * `color_pink`
* `color_orange` * `color_orange`
* `color_brown` * `color_brown`
* `color_yellow` * `color_yellow`
* `color_green` * `color_green`
* `color_dark_green` * `color_dark_green`
* `color_blue` * `color_blue`
* `color_cyan` * `color_cyan`
* `color_violet` * `color_violet`
* `color_magenta` * `color_magenta`
Example of one shapeless recipe using the dye group and a color group: Example of one shapeless recipe using the dye group and a color group:
@ -938,50 +1006,50 @@ Example of one shapeless recipe using the dye group and a color group:
}) })
Trees ## Trees
----- -----
* `default.grow_tree(pos, is_apple_tree)` * `default.grow_tree(pos, is_apple_tree)`
* Grows a mgv6 tree or apple tree at pos * Grows a mgv6 tree or apple tree at pos
* `default.grow_jungle_tree(pos)` * `default.grow_jungle_tree(pos)`
* Grows a mgv6 jungletree at pos * Grows a mgv6 jungletree at pos
* `default.grow_pine_tree(pos)` * `default.grow_pine_tree(pos)`
* Grows a mgv6 pinetree at pos * Grows a mgv6 pinetree at pos
* `default.grow_new_apple_tree(pos)` * `default.grow_new_apple_tree(pos)`
* Grows a new design apple tree at pos * Grows a new design apple tree at pos
* `default.grow_new_jungle_tree(pos)` * `default.grow_new_jungle_tree(pos)`
* Grows a new design jungle tree at pos * Grows a new design jungle tree at pos
* `default.grow_new_pine_tree(pos)` * `default.grow_new_pine_tree(pos)`
* Grows a new design pine tree at pos * Grows a new design pine tree at pos
* `default.grow_new_snowy_pine_tree(pos)` * `default.grow_new_snowy_pine_tree(pos)`
* Grows a new design snowy pine tree at pos * Grows a new design snowy pine tree at pos
* `default.grow_new_acacia_tree(pos)` * `default.grow_new_acacia_tree(pos)`
* Grows a new design acacia tree at pos * Grows a new design acacia tree at pos
* `default.grow_new_aspen_tree(pos)` * `default.grow_new_aspen_tree(pos)`
* Grows a new design aspen tree at pos * Grows a new design aspen tree at pos
* `default.grow_bush(pos)` * `default.grow_bush(pos)`
* Grows a bush at pos * Grows a bush at pos
* `default.grow_acacia_bush(pos)` * `default.grow_acacia_bush(pos)`
* Grows an acaia bush at pos * Grows an acaia bush at pos
* `default.grow_pine_bush(pos)` * `default.grow_pine_bush(pos)`
* Grows a pine bush at pos * Grows a pine bush at pos
* `default.grow_blueberry_bush(pos)` * `default.grow_blueberry_bush(pos)`
* Grows a blueberry bush at pos * Grows a blueberry bush at pos
Carts ## Carts
----- -----
carts.register_rail( carts.register_rail(
@ -1004,7 +1072,7 @@ Carts
to make sure that the event is handled properly. to make sure that the event is handled properly.
Key API ## Key API
------- -------
The key API allows mods to add key functionality to nodes that have The key API allows mods to add key functionality to nodes that have
@ -1019,11 +1087,11 @@ two callback functions in each nodedef:
`on_key_use(pos, player)` `on_key_use(pos, player)`
* Is called when a player right-clicks (uses) a normal key on your * Is called when a player right-clicks (uses) a normal key on your
* node. * node.
* `pos` - position of the node * `pos` - position of the node
* `player` - PlayerRef * `player` - PlayerRef
* return value: none, ignored * return value: none, ignored
The `on_key_use` callback should validate that the player is wielding The `on_key_use` callback should validate that the player is wielding
a key item with the right key meta secret. If needed the code should a key item with the right key meta secret. If needed the code should
@ -1035,15 +1103,15 @@ checks in the metadata callback functions.
`on_skeleton_key_use(pos, player, newsecret)` `on_skeleton_key_use(pos, player, newsecret)`
* Is called when a player right-clicks (uses) a skeleton key on your * Is called when a player right-clicks (uses) a skeleton key on your
* node. * node.
* `pos` - position of the node * `pos` - position of the node
* `player` - PlayerRef * `player` - PlayerRef
* `newsecret` - a secret value(string) * `newsecret` - a secret value(string)
* return values: * return values:
* `secret` - `nil` or the secret value that unlocks the door * `secret` - `nil` or the secret value that unlocks the door
* `name` - a string description of the node ("a locked chest") * `name` - a string description of the node ("a locked chest")
* `owner` - name of the node owner * `owner` - name of the node owner
The `on_skeleton_key_use` function should validate that the player has The `on_skeleton_key_use` function should validate that the player has
the right permissions to make a new key for the item. The newsecret the right permissions to make a new key for the item. The newsecret
@ -1063,9 +1131,58 @@ 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. permissions to create a key for this node, and no key is created.
`default.register_craft_metadata_copy(ingredient, result)` `default.register_craft_metadata_copy(ingredient, result)`
----------------------------------------------------------
This function registers a shapeless recipe that takes `ingredient` This function registers a shapeless recipe that takes `ingredient`
and `result` as input and outputs `result`. and `result` as input and outputs `result`.
The metadata of the input `result` is copied to the output `result`. The metadata of the input `result` is copied to the output `result`.
## Table of Contents
- [Bucket API](#bucket-api)
- [Beds API](#beds-api)
- [Bed definition](#bed-definition)
- [Bones API](#bones-api)
- [Creative API](#creative-api)
- [Chests API](#chests-api)
- [Chest Definition](#chest-definition)
- [Doors API](#doors-api)
- [door ObjectRef Methods](#door-objectref-methods)
- [Door definition](#door-definition)
- [Trapdoor definition](#trapdoor-definition)
- [Fence gate definition](#fence-gate-definition)
- [Dungeon Loot API](#dungeon-loot-api)
- [Loot definition](#loot-definition)
- [Fence API](#fence-api)
- [fence definition](#fence-definition)
- [Walls API](#walls-api)
- [Farming API](#farming-api)
- [Hoe Definition](#hoe-definition)
- [Plant definition](#plant-definition)
- [Fire API](#fire-api)
- [Give Initial Stuff API](#give-initial-stuff-api)
- [Players API](#players-api)
- [Model Definition](#model-definition)
- [TNT API](#tnt-api)
- [Screwdriver API](#screwdriver-api)
- [Sethome API](#sethome-api)
- [Sfinv API](#sfinv-api)
- [sfinv Methods](#sfinv-methods)
- [sfinv Members](#sfinv-members)
- [Context](#context)
- [sfinv.register_page](#sfinvregister_page)
- [get formspec](#get-formspec)
- [Customising themes](#customising-themes)
- [Stairs API](#stairs-api)
- [Xpanes API](#xpanes-api)
- [Pane definition](#pane-definition)
- [Raillike definitions](#raillike-definitions)
- [Default sounds](#default-sounds)
- [Default constants](#default-constants)
- [GUI and formspecs](#gui-and-formspecs)
- [Leafdecay](#leafdecay)
- [Dyes](#dyes)
- [Trees](#trees)
- [Carts](#carts)
- [Key API](#key-api)

48
mods/README.md Normal file
View File

@ -0,0 +1,48 @@
Default mods
------------
For information check [../README.md](../README.md)
## Content
* api
* beds
* butterflies
* default
* doors
* dungeon_loot
* farming
* fire
* give_initial_stuff
* bucket
* map
* bones
* fireflies
* player_api
* stairs
* wool
* binoculars
* carts
* dye
* flowers
* screwdriver
* tnt
* xpanes
* boats
* creative
* env_sounds
* game_commands
* sethome
* sfinv
* spawn
* weather
* vessels
* walls
## Compatibility
This source code and files are only compatible with matched minetest5 engine
from https://codeberg.org/minenux/minetest-engine/src/branch/stable-5.2
Additionally, when the Minetest5 engine is tagged to be a certain version (e.g.
5.2.1), Minetest Game is tagged with the version 5.2.1 too.