Fix some typos in the API documentation (#4630)

Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4630
Reviewed-by: teknomunk <teknomunk@protonmail.com>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
This commit is contained in:
Mikita Wiśniewski 2024-09-12 18:13:52 +02:00 committed by the-real-herowl
parent 2be54212b7
commit 19d662dee4
15 changed files with 92 additions and 77 deletions

View file

@ -2,33 +2,33 @@
Simple flow functions. Simple flow functions.
## flowlib.is_touching(realpos, nodepos, radius) ## flowlib.is_touching(realpos, nodepos, radius)
Return true if a sphere of <radius> at <realpos> collide with node at <nodepos>. Return true if a sphere of `radius` at `realpos` collide with node at `nodepos`.
* realpos: position * realpos: position
* nodepos: position * nodepos: position
* radius: number * radius: number
## flowlib.is_water(pos) ## flowlib.is_water(pos)
Return true if node at <pos> is water, false overwise. Return true if node at `pos` is water, false otherwise.
* pos: position * pos: position
## flowlib.node_is_water(node) ## flowlib.node_is_water(node)
Return true if <node> is water, false overwise. Return true if `node` is water, false otherwise.
* node: node * node: node
## flowlib.is_lava(pos) ## flowlib.is_lava(pos)
Return true if node at <pos> is lava, false overwise. Return true if node at `pos` is lava, false otherwise.
* pos: position * pos: position
## flowlib.node_is_lava(node) ## flowlib.node_is_lava(node)
Return true if <node> is lava, false overwise. Return true if `node` is lava, false otherwise.
* node: node * node: node
## flowlib.is_liquid(pos) ## flowlib.is_liquid(pos)
Return true if node at <pos> is liquid, false overwise. Return true if node at `pos` is liquid, false otherwise.
* pos: position * pos: position
## flowlib.node_is_liquid(node) ## flowlib.node_is_liquid(node)
Return true if <node> is liquid, false overwise. Return true if `node` is liquid, false otherwise.
* node: node * node: node
## flowlib.quick_flow(pos, node) ## flowlib.quick_flow(pos, node)
@ -37,8 +37,8 @@ Return direction where the water is flowing (to be use to push mobs, items...).
* node: node * node: node
## flowlib.move_centre(pos, realpos, node, radius) ## flowlib.move_centre(pos, realpos, node, radius)
Return the pos of the nearest not water block near from <pos> in a sphere of <radius> at <realpos>. Return the pos of the nearest not water block near from `pos` in a sphere of `radius` at `realpos`.
WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong. WARNING: This function is never used in VL, use at your own risk. The informations described here may be wrong.
* pos: position * pos: position
* realpos: position, position of the entity * realpos: position, position of the entity
* node: node * node: node

View file

@ -1,8 +1,8 @@
# mcl_autogroup # mcl_autogroup
This mod emulate digging times from mc. This mod emulates digging times from MC.
## mcl_autogroup.can_harvest(nodename, toolname, player) ## mcl_autogroup.can_harvest(nodename, toolname, player)
Return true if <nodename> can be dig with <toolname> by <player>. Return true if `nodename` can be dig with `toolname` by <player>.
* nodename: string, valid nodename * nodename: string, valid nodename
* toolname: (optional) string, valid toolname * toolname: (optional) string, valid toolname
* player: (optinal) ObjectRef, valid player * player: (optinal) ObjectRef, valid player
@ -14,7 +14,7 @@ WARNING: This function can only be called after mod initialization.
* efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0) * efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0)
## mcl_autogroup.get_wear(toolname, diggroup) ## mcl_autogroup.get_wear(toolname, diggroup)
Return the max wear of <toolname> with <diggroup> Return the max wear of `toolname` with `diggroup`
WARNING: This function can only be called after mod initialization. WARNING: This function can only be called after mod initialization.
* toolname: string, name of the tool used * toolname: string, name of the tool used
* diggroup: string, the name of the diggroup the tool is used on * diggroup: string, the name of the diggroup the tool is used on

View file

@ -1,5 +1,5 @@
# mcl_colors # mcl_colors
Mod providing global table containing legacity minecraft colors to be used in mods. Mod providing global table containing legacy Minecraft colors to be used in mods.
## mcl_colors.* ## mcl_colors.*
Colors by upper name, in hex value. Colors by upper name, in hex value.

View file

@ -6,7 +6,7 @@ WARNING: Not using it inside your mods may cause strange bugs (using the native
## Callbacks ## Callbacks
To modify the amount of damage made by something: To modify the amount of damage dealt by something:
```lua ```lua
--obj: an ObjectRef --obj: an ObjectRef

View file

@ -1,8 +1,12 @@
## mcl_events # mcl_events
### Registering Events
`mlc_events.register_event("name",def)`
#### Event Definition ## Registering Events
`mcl_events.register_event("name", def)`
### Event Definition
```
{ {
stage = 0, stage = 0,
max_stage = 1, max_stage = 1,
@ -22,6 +26,8 @@
cond_complete = function(event) end, cond_complete = function(event) end,
--return true if event finished successfully --return true if event finished successfully
} }
```
### Debugging ## Debugging
* /event_start <event> -- starts the given event at the current player coordinates
* /event_start `event` -- starts the given event at the current player coordinates

View file

@ -3,13 +3,13 @@ This mod provide helper functions to create explosions.
## mcl_explosions.explode(pos, strength, info, puncher) ## mcl_explosions.explode(pos, strength, info, puncher)
* pos: position, initial position of the explosion * pos: position, initial position of the explosion
* strenght: number, radius of the explosion * strength: number, radius of the explosion
* info: table, explosion informations: * info: table, explosion informations:
* drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength) * drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength)
* max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value * max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value
* sound: bool, if true, the explosion will play a sound (default: true) * sound: bool, if true, the explosion will play a sound (default: true)
* particles: bool, if true, the explosion will create particles (default: true) * particles: bool, if true, the explosion will create particles (default: true)
* fire: bool, if true, 1/3 nodes become fire (default: false) * fire: bool, if true, 1/3 of nodes become fire (default: false)
* griefing: bool, if true, the explosion will destroy nodes (default: true) * griefing: bool, if true, the explosion will destroy nodes (default: true)
* grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false) * grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false)
* puncher: (optional) entity, will be used as source for damage done by the explosion * puncher: (optional) entity, will be used as source for damage done by the explosion

View file

@ -5,20 +5,21 @@ This mod provides utility functions about positions and dimensions.
This function returns: This function returns:
* true, true: if pos is in deep void (deadly) * true, true: if pos is in deep void (deadly)
* true, false: if the pos is in void (non deadly) * true, false: if the pos is in void (non-deadly)
* false, false: owerwise * false, false: otherwise
Params: Params:
* pos: position * pos: position
## mcl_worlds.y_to_layer(y) ## mcl_worlds.y_to_layer(y)
This function is used to calculate the minetest y layer and dimension of the given <y> minecraft layer. This function is used to calculate the Minetest y layer and dimension of the given y Minecraft layer.
Mainly used for ore generation. Mainly used for ore generation.
Takes an Y coordinate as input and returns: Takes a Y coordinate as input and returns:
* The corresponding Minecraft layer (can be `nil` if void)
* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if y is in the void
* The corresponding Minecraft layer (can be nil if void)
* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if <y> is in the void
If the Y coordinate is not located in any dimension, it will return: nil, "void" If the Y coordinate is not located in any dimension, it will return: nil, "void"
Params: Params:
@ -26,7 +27,7 @@ Params:
* y: int * y: int
## mcl_worlds.pos_to_dimension(pos) ## mcl_worlds.pos_to_dimension(pos)
This function return the Minecraft dimension of <pos> ("overworld", "nether" or "end") or "void" if <y> is in the void. This function return the Minecraft dimension of pos ("overworld", "nether" or "end") or "void" if y is in the void.
* pos: position * pos: position
@ -38,31 +39,32 @@ mc_dimension can be "overworld", "nether", "end" (default: "overworld").
* mc_dimension: string * mc_dimension: string
## mcl_worlds.has_weather(pos) ## mcl_worlds.has_weather(pos)
Returns true if <pos> can have weather, false owerwise. Returns true if pos can have weather, false otherwise.
Weather can be only in the overworld. Weather can be only in the overworld.
* pos: position * pos: position
## mcl_worlds.has_dust(pos) ## mcl_worlds.has_dust(pos)
Returns true if <pos> can have nether dust, false owerwise. Returns true if pos can have nether dust, false otherwise.
Nether dust can be only in the nether. Nether dust can be only in the nether.
* pos: position * pos: position
## mcl_worlds.compass_works(pos) ## mcl_worlds.compass_works(pos)
Returns true if compasses are working at <pos>, false owerwise. Returns true if compasses are working at pos, false otherwise.
In mc, you cant use compass in the nether and the end. In MC, you cant use compass in the nether and the end.
* pos: position * pos: position
## mcl_worlds.compass_works(pos) ## mcl_worlds.compass_works(pos)
Returns true if clock are working at <pos>, false owerwise. Returns true if clock are working at pos, false otherwise.
In mc, you cant use clock in the nether and the end. In MC, you cant use clock in the nether and the end.
* pos: position * pos: position
## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension)) ## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension))
Register a callback function func(player, dimension). Register a callback function func(player, dimension).
It will be called whenever a player changes between dimensions. It will be called whenever a player changes between dimensions.
The void counts as dimension. The void counts as dimension.
@ -75,7 +77,7 @@ The void counts as dimension.
Table containing all function registered with mcl_worlds.register_on_dimension_change() Table containing all function registered with mcl_worlds.register_on_dimension_change()
## mcl_worlds.dimension_change(player, dimension) ## mcl_worlds.dimension_change(player, dimension)
Notify this mod of a dimension change of <player> to <dimension> Notify this mod of a dimension change of player to dimension
* player: player, player who changed the dimension * player: player, player who changed the dimension
* dimension: string, new dimension ("overworld", "nether", "end", "void") * dimension: string, new dimension ("overworld", "nether", "end", "void")

View file

@ -1,8 +1,10 @@
## mcl_info ## mcl_info
An api to make custom entries in the mcl2 debug hud. An API to make custom entries in the VL debug hud.
### mcl_info.register_debug_field(name,defintion) ### mcl_info.register_debug_field(name,defintion)
Debug field defintion example: Debug field defintion example:
```
{ {
level = 3, level = 3,
--show with debug level 3 and upwards --show with debug level 3 and upwards
@ -13,6 +15,7 @@ Debug field defintion example:
-- It should output a string and determines -- It should output a string and determines
-- the content of the debug field. -- the content of the debug field.
} }
```
### mcl_info.registered_debug_fields ### mcl_info.registered_debug_fields
Table the debug definitions are stored in. Do not modify this directly. If you need to overwrite a field just set it again with mcl_info.register_debug_field(). Table the debug definitions are stored in. Do not modify this directly. If you need to overwrite a field just set it again with mcl_info.register_debug_field().

View file

@ -32,4 +32,5 @@ mcl_inventory.register_survival_inventory_tab({
-- Returns true by default -- Returns true by default
access = function(player) access = function(player)
end, end,
})
``` ```

View file

@ -8,7 +8,7 @@ Show a hud message of `type` to player `player` with `data` as params.
The element will stay for the per-player param `stay` or `data.stay` (in gametick which is 1/20 second). The element will stay for the per-player param `stay` or `data.stay` (in gametick which is 1/20 second).
Here is a usage exemple: Here is a usage example:
```lua ```lua
--show a title in the HUD with minecraft color "gold" --show a title in the HUD with minecraft color "gold"
@ -35,7 +35,7 @@ Basicaly run `mcl_title.remove(player, type)` for every type.
## mcl_title.params_set(player, params) ## mcl_title.params_set(player, params)
Allow mods to set `stay` and upcomming `fadeIn`/`fadeOut` params. Allow mods to set `stay` and upcoming `fadeIn`/`fadeOut` params.
```lua ```lua
mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field will stay during 30s (600/20) mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field will stay during 30s (600/20)
@ -43,7 +43,7 @@ mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field
## mcl_title.params_get(player) ## mcl_title.params_get(player)
Get `stay` and upcomming `fadeIn` and `fadeOut` params of a player as a table. Get `stay` and upcoming `fadeIn` and `fadeOut` params of a player as a table.
```lua ```lua
mcl_title.params_get(player) mcl_title.params_get(player)

View file

@ -119,7 +119,7 @@ mcl_armor.register_set({
end, end,
}, },
--this is used to generate automaticaly armor crafts based on each element type folowing the regular minecraft pattern --this is used to generate automaticaly armor crafts based on each element type following the regular minecraft pattern
--if set to nil no craft will be added --if set to nil no craft will be added
craft_material = "mcl_mobitems:leather", craft_material = "mcl_mobitems:leather",

View file

@ -1,25 +1,28 @@
# mcl_buckets # mcl_buckets
Add an API to register buckets to mcl Adds an API to register buckets to VL
## mcl_buckets.register_liquid(def) ## mcl_buckets.register_liquid(def)
Register a new liquid Register a new liquid.
Accept folowing params:
* source_place: a string or function. Accepts the following parameters:
* string: name of the node to place
* function(pos): will returns name of the node to place with pos being the placement position * `source_place`: a string or a function
* source_take: table of liquid source node names to take * `string`: name of the node to place
* bucketname: itemstring of the new bucket item * `function(pos)`: will return name of the node to place with pos being the placement position
* inventory_image: texture of the new bucket item (ignored if itemname == nil) * `source_take`: table of liquid source node names to take
* name: user-visible bucket description * `bucketname`: itemstring of the new bucket item
* longdesc: long explanatory description (for help) * `inventory_image`: texture of the new bucket item (ignored if itemname == nil)
* usagehelp: short usage explanation (for help) * `name`: user-visible bucket description
* tt_help: very short tooltip help * `longdesc`: long explanatory description (for help)
* extra_check(pos, placer): (optional) function(pos) * `usagehelp`: short usage explanation (for help)
* groups: optional list of item groups * `tt_help`: very short tooltip help
* `extra_check(pos, placer)`: (optional) additional check before liquid placement (return 2 booleans: (1) whether to place the liquid source and (2) whether to empty the bucket)
* `groups`: optional list of item groups
**Usage exemple:** **Usage example:**
```lua ```lua
mcl_buckets.register_liquid({ mcl_buckets.register_liquid({
bucketname = "dummy:bucket_dummy", bucketname = "dummy:bucket_dummy",
@ -39,7 +42,7 @@ mcl_buckets.register_liquid({
tt_help = S("Places a dummy liquid source"), tt_help = S("Places a dummy liquid source"),
extra_check = function(pos, placer) extra_check = function(pos, placer)
--pos = pos where the liquid should be placed --pos = pos where the liquid should be placed
--placer people who tried to place the bucket (can be nil) --placer who tried to place the bucket (can be nil)
--no liquid node will be placed --no liquid node will be placed
--the bucket will not be emptied --the bucket will not be emptied

View file

@ -5,9 +5,9 @@ animations are achieved by giving each chest node an entity, as Minetest (as of
5.8.1) doesn't support giving nodes animated meshes, only static ones. 5.8.1) doesn't support giving nodes animated meshes, only static ones.
Because of that, a lot of parameters passed through the exposed functions are Because of that, a lot of parameters passed through the exposed functions are
be related to nodes and entities. related to nodes and entities.
Please refer to [Minetest documentation](http://api.minetest.net/) and the code Please refer to the [Minetest documentation](http://api.minetest.net/) and code
comments in `api.lua`. comments in `api.lua`.

View file

@ -25,7 +25,7 @@ end
-- Registers a door -- Registers a door
-- name: The name of the door -- name: The name of the door
-- def: a table with the folowing fields: -- def: a table with the following fields:
-- description -- description
-- inventory_image -- inventory_image
-- groups -- groups

View file

@ -1,16 +1,16 @@
# mcl_wip # mcl_wip
Used to mark items or nodes as WIP. Used to mark items or nodes as WIP.
## mcl_wip.register_wip_item(itemname) ## `mcl_wip.register_wip_item(itemname)`
Register <itemname> as a WIP item. Register `itemname` as a WIP item.
If <itemname> isn't a valid itemname, an error will be shown after mods loaded. If `itemname` isn't a valid itemname, an error will be shown after mods loaded.
## mcl_wip.register_experimental_item(itemname) ## `mcl_wip.register_experimental_item(itemname)`
Register <itemname> as a experimental item. Register `itemname` as a experimental item.
If <itemname> isn't a valid itemname, an error will be shown after mods loaded. If `itemname` isn't a valid itemname, an error will be shown after mods loaded.
## mcl_wip.registered_wip_items ## `mcl_wip.registered_wip_items`
Table containing WIP items names. Table containing WIP items names.
## mcl_wip.registered_experimental_items ## `mcl_wip.registered_experimental_items`
Table containing experimental items names. Table containing experimental items names.