1
0
Fork 0

Compare commits

...

1 Commits

Author SHA1 Message Date
Mikita Wiśniewski daa485e17a Fix some typos in the API documentation 2024-08-17 19:57:17 +07:00
12 changed files with 69 additions and 56 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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,32 +39,33 @@ 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.
It will be called whenever a player changes between dimensions.\
The void counts as dimension.
* player: player, the player who changed of 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")

View File

@ -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().

View File

@ -32,4 +32,5 @@ mcl_inventory.register_survival_inventory_tab({
-- Returns true by default
access = function(player)
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).
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)
```
```

View File

@ -1,13 +1,14 @@
# 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:
Register a new liquid.
Accepts 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
* 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)
@ -19,7 +20,7 @@ Accept folowing params:
* groups: optional list of item groups
**Usage exemple:**
**Usage example:**
```lua
mcl_buckets.register_liquid({
bucketname = "dummy:bucket_dummy",
@ -39,7 +40,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 +52,4 @@ mcl_buckets.register_liquid({
end,
groups = { dummy_group = 123 },
})
```
```

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