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

@ -2,33 +2,33 @@
Simple flow functions.
## 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
* nodepos: position
* radius: number
## 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
## flowlib.node_is_water(node)
Return true if <node> is water, false overwise.
Return true if `node` is water, false otherwise.
* node: node
## 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
## flowlib.node_is_lava(node)
Return true if <node> is lava, false overwise.
Return true if `node` is lava, false otherwise.
* node: node
## 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
## flowlib.node_is_liquid(node)
Return true if <node> is liquid, false overwise.
Return true if `node` is liquid, false otherwise.
* node: node
## flowlib.quick_flow(pos, node)
@ -37,9 +37,9 @@ Return direction where the water is flowing (to be use to push mobs, items...).
* node: node
## 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>.
WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong.
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 VL, use at your own risk. The informations described here may be wrong.
* pos: position
* realpos: position, position of the entity
* node: node
* radius: number
* radius: number

@ -1,8 +1,8 @@
# mcl_autogroup
This mod emulate digging times from mc.
This mod emulates digging times from MC.
## 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
* toolname: (optional) string, valid toolname
* 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)
## 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.
* toolname: string, name of the tool used
* diggroup: string, the name of the diggroup the tool is used on
@ -25,4 +25,4 @@ WARNING: This function can only be called after mod initialization.
* level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
## mcl_autogroup.registered_diggroups
List of registered diggroups, indexed by name.
List of registered diggroups, indexed by name.

@ -1,5 +1,5 @@
# 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.*
Colors by upper name, in hex value.

@ -6,10 +6,10 @@ WARNING: Not using it inside your mods may cause strange bugs (using the native
## Callbacks
To modify the amount of damage made by something:
To modify the amount of damage dealt by something:
```lua
--obj: an ObjectRef
mcl_damage.register_modifier(function(obj, damage, reason)
end, 0)
```
```

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

@ -3,13 +3,13 @@ This mod provide helper functions to create explosions.
## mcl_explosions.explode(pos, strength, info, puncher)
* pos: position, initial position of the explosion
* strenght: number, radius of the explosion
* strength: number, radius of the explosion
* info: table, explosion informations:
* 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
* sound: bool, if true, the explosion will play a sound (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)
* 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

@ -5,20 +5,21 @@ This mod provides utility functions about positions and dimensions.
This function returns:
* true, true: if pos is in deep void (deadly)
* true, false: if the pos is in void (non deadly)
* false, false: owerwise
* true, false: if the pos is in void (non-deadly)
* false, false: otherwise
Params:
* pos: position
## 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.
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"
Params:
@ -26,7 +27,7 @@ Params:
* y: int
## 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
@ -38,31 +39,32 @@ mc_dimension can be "overworld", "nether", "end" (default: "overworld").
* mc_dimension: string
## 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.
* pos: position
## 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.
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if compasses are working at <pos>, false owerwise.
In mc, you cant use compass in the nether and the end.
Returns true if compasses are working at pos, false otherwise.
In MC, you cant use compass in the nether and the end.
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if clock are working at <pos>, false owerwise.
In mc, you cant use clock in the nether and the end.
Returns true if clock are working at pos, false otherwise.
In MC, you cant use clock in the nether and the end.
* pos: position
## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension))
Register a callback function func(player, dimension).
It will be called whenever a player changes between dimensions.
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()
## 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
* dimension: string, new dimension ("overworld", "nether", "end", "void")

@ -1,8 +1,10 @@
## 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)
Debug field defintion example:
```
{
level = 3,
--show with debug level 3 and upwards
@ -13,6 +15,7 @@ Debug field defintion example:
-- It should output a string and determines
-- the content of the debug field.
}
```
### 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().

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

@ -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).
Here is a usage exemple:
Here is a usage example:
```lua
--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)
Allow mods to set `stay` and upcomming `fadeIn`/`fadeOut` params.
Allow mods to set `stay` and upcoming `fadeIn`/`fadeOut` params.
```lua
mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field will stay during 30s (600/20)
@ -43,8 +43,8 @@ mcl_title.params_set(player, {stay = 600}) --elements with no 'data.stay' field
## 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
mcl_title.params_get(player)
```
```

@ -119,7 +119,7 @@ mcl_armor.register_set({
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
craft_material = "mcl_mobitems:leather",

@ -1,25 +1,28 @@
# mcl_buckets
Add an API to register buckets to mcl
Adds an API to register buckets to VL
## mcl_buckets.register_liquid(def)
Register a new liquid
Accept folowing params:
* source_place: a string or function.
* string: name of the node to place
* function(pos): will returns name of the node to place with pos being the placement position
* source_take: table of liquid source node names to take
* bucketname: itemstring of the new bucket item
* inventory_image: texture of the new bucket item (ignored if itemname == nil)
* name: user-visible bucket description
* longdesc: long explanatory description (for help)
* usagehelp: short usage explanation (for help)
* tt_help: very short tooltip help
* extra_check(pos, placer): (optional) function(pos)
* groups: optional list of item groups
Register a new liquid.
Accepts the following parameters:
* `source_place`: a string or a function
* `string`: name of the node to place
* `function(pos)`: will return name of the node to place with pos being the placement position
* `source_take`: table of liquid source node names to take
* `bucketname`: itemstring of the new bucket item
* `inventory_image`: texture of the new bucket item (ignored if itemname == nil)
* `name`: user-visible bucket description
* `longdesc`: long explanatory description (for help)
* `usagehelp`: short usage explanation (for help)
* `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
mcl_buckets.register_liquid({
bucketname = "dummy:bucket_dummy",
@ -39,7 +42,7 @@ mcl_buckets.register_liquid({
tt_help = S("Places a dummy liquid source"),
extra_check = function(pos, placer)
--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
--the bucket will not be emptied
@ -51,4 +54,4 @@ mcl_buckets.register_liquid({
end,
groups = { dummy_group = 123 },
})
```
```

@ -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.
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`.

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

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