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 forum topic](https://forum.minetest.net/viewtopic.php?f=15&t=9724).
Also see the [Minetest Wiki](https://wiki.minetest.net/Subgames/Minetest_Game)
for more information.
This is a fork from minetest default game, this
are made from minenux project https://codeberg.org/minenux
for minetest v5 and minetest v4 or 0.4.
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
- Unzip the archive, rename the folder to minetest5_game and
place it in .. minetest5/games/
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
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
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:
https://wiki.minetest.net/Installing_Mods
## 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
@ -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.
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
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
------------
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.
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:
* [XYZ] refers to a section the Minetest API
* [#ABC] refers to a section in this document
* [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.
@ -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.
Beds API
## Beds API
--------
beds.register_bed(
@ -72,7 +140,7 @@ Beds API
}
Bones API
## Bones API
---------
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")`
Creative API
## Creative API
------------
Use `creative.register_tab(name, title, items)` to add a tab with filtered items.
@ -104,7 +172,7 @@ page. Mods can use it to add additional formspec elements onto the default
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.
@ -155,7 +223,7 @@ The chests API allows the creation of chests, which have their own inventories f
protected = false, -- If true, only placer can modify chest.
Doors API
## Doors API
---------
The doors mod allows modders to register custom doors and trapdoors.
@ -189,18 +257,6 @@ The doors mod allows modders to register custom doors and trapdoors.
* `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
### 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)`
* Toggle door open or shut
@ -208,6 +264,18 @@ The doors mod allows modders to register custom doors and trapdoors.
* `node` Node definition
* `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
description = "Door description",
@ -257,7 +325,7 @@ The doors mod allows modders to register custom doors and trapdoors.
-- 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.
@ -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
Fence API
## Fence API
---------
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(),
Walls API
## Walls API
---------
The walls API allows easy addition of stone auto-connecting wall nodes.
@ -326,7 +394,7 @@ walls.register(name, desc, texture, mat, sounds)
^ sounds = sounds: see [#Default sounds]
Farming API
## Farming API
-----------
The farming API allows you to easily register plants and hoes.
@ -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.
@ -389,7 +457,7 @@ New node def property:
* `igniter` Player that used the tool, when available.
Give Initial Stuff API
## Give Initial Stuff API
----------------------
`give_initial_stuff.give(player)`
@ -421,7 +489,7 @@ Give Initial Stuff API
^ 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.
@ -481,7 +549,7 @@ The player API can register player models and update the player's appearance.
}
TNT API
## TNT API
-------
`tnt.register_tnt(definition)`
@ -555,7 +623,7 @@ Both nodedefs and entitydefs can provide an `on_blast()` callback
* `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.
@ -574,7 +642,7 @@ To use it, add the `on_screwdriver` function to the node definition.
* 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,
@ -597,7 +665,7 @@ set a players home position and teleport a player to home position.
* 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
@ -706,7 +774,7 @@ And override this function to change the layout:
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
@ -766,7 +834,7 @@ delivered with Minetest Game, to keep them compatible with other mods.
* `desc_slab`: Description for slab node
Xpanes API
## Xpanes API
----------
Creates panes that automatically connect to each other
@ -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
@ -810,7 +878,7 @@ add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` tabl
of your node.
Default sounds
## Default sounds
--------------
Sounds inside the default table can be used within the sounds field of node definitions.
@ -825,13 +893,13 @@ Sounds inside the default table can be used within the sounds field of node defi
* `default.node_sound_metal_defaults()`
Default constants
## Default constants
-----------------
`default.LIGHT_MAX` The maximum light level (see [Node definition] light_source)
GUI and formspecs
## GUI and formspecs
-----------------
`default.get_hotbar_bg(x, y)`
@ -867,7 +935,7 @@ GUI and formspecs
* 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,
@ -901,7 +969,7 @@ callback overridden. All the nodes listed in `leaves` have their
`on_timer` callback overridden.
Dyes
## Dyes
----
Minetest Game dyes are registered with:
@ -938,7 +1006,7 @@ Example of one shapeless recipe using the dye group and a color group:
})
Trees
## Trees
-----
* `default.grow_tree(pos, is_apple_tree)`
@ -981,7 +1049,7 @@ Trees
* Grows a blueberry bush at pos
Carts
## Carts
-----
carts.register_rail(
@ -1004,7 +1072,7 @@ Carts
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
@ -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.
`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`.
## 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.