mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 18:39:46 +00:00
fix docs typos and other trash
This commit is contained in:
parent
9744407599
commit
ef61e28f50
88 changed files with 359 additions and 358 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
2D text displayed in 3D space.
|
||||
|
||||
The appearance of 3D text, is configured via a table, like [particles](particles.md). All fields are optional.
|
||||
The appearance of 3D text is configured via a table, like [particles](particles.md). All fields are optional.
|
||||
|
||||
| Field | Description | Default |
|
||||
| --------------- | ---------------------------------------- | ---------------- |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Assets preloading (*preload.json* file)
|
||||
|
||||
`preload.json` in content-pack folder is used for specifying additional assets should be loaded, like sounds.
|
||||
`preload.json` in content-pack folder is used for specifying additional assets that should be loaded, like sounds.
|
||||
|
||||
The file contains following categories available:
|
||||
- animation
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Channels are controlled by the engine and currently are not available in scripts
|
|||
|
||||
### Speaker
|
||||
|
||||
One-time use playing audio controller for sound or stream. Speaker is destroying after stop (**stop** method call or audio track end if not looped)
|
||||
One-time use playing audio controller for sound or stream. Speaker is destroyed after stop (**stop** method call or audio track end if not looped)
|
||||
|
||||
> [!NOTE]
|
||||
> Speaker access is performed using 64 bit integer identifiers that **will not be reused** after speaker destruction. You should avoid storing direct references and pointers instead of ID.
|
||||
|
|
@ -40,7 +40,7 @@ Stream used by an audio stream as an audio data source. Implementation depends o
|
|||
|
||||
### Stream
|
||||
|
||||
Streaming audio. Not fully loading to the memory. Cannot be played via multiple speakers simultaneously.
|
||||
Streaming audio. Not fully loaded into memory. Cannot be played via multiple speakers simultaneously.
|
||||
|
||||
## Formats support
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ Streaming audio. Not fully loading to the memory. Cannot be played via multiple
|
|||
## Additional information
|
||||
|
||||
> [!WARNING]
|
||||
> **Stereo** audio played with OpenAL will ignore 3D position relative to the listener. Sounds that supposed to be played at specific world position must be **mono**
|
||||
> **Stereo** audio played with OpenAL will ignore 3D position relative to the listener. Sounds that are supposed to be played at specific world position must be **mono**
|
||||
|
||||
## Scripting Audio API
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ Plays streaming audio from the specified file. Returns speaker ID.
|
|||
```lua
|
||||
audio.play_sound(
|
||||
-- name of a loaded sound without pack prefix, "sounds/", variant number and extension
|
||||
-- example: "steps/stone" to play sound loaded from "sounds/steps/stone.ogg" or any of its variant
|
||||
-- example: "steps/stone" to play sound loaded from "sounds/steps/stone.ogg" or any of its variants
|
||||
-- variant will be randomly chosen
|
||||
name: string,
|
||||
-- audio source world position
|
||||
|
|
@ -119,7 +119,7 @@ Plays the specified sound on the specified position in world. Returns speaker ID
|
|||
```lua
|
||||
audio.play_sound_2d(
|
||||
-- name of a loaded sound without pack prefix, "sounds/", variant number and extension
|
||||
-- example: "steps/stone" to play sound loaded from "sounds/steps/stone.ogg" or any of its variant
|
||||
-- example: "steps/stone" to play sound loaded from "sounds/steps/stone.ogg" or any of its variants
|
||||
-- variant will be randomly chosen
|
||||
name: string,
|
||||
-- audio gain (0.0 - 1.0)
|
||||
|
|
@ -153,34 +153,34 @@ audio.resume(speakerid: integer)
|
|||
-- set audio loop
|
||||
audio.set_loop(speakerid: integer, state: bool)
|
||||
|
||||
-- check if audio is in loop (false if does not exists)
|
||||
-- check if audio is in loop (false if does not exist)
|
||||
audio.is_loop(speakerid: integer) -> bool
|
||||
|
||||
-- get audio gain value (0.0 if does not exists)
|
||||
-- get audio gain value (0.0 if does not exist)
|
||||
audio.get_volume(speakerid: integer) -> number
|
||||
|
||||
-- set audio gain value
|
||||
audio.set_volume(speakerid: integer, volume: number)
|
||||
|
||||
-- get audio playback speed (1.0 if does not exists)
|
||||
-- get audio playback speed (1.0 if does not exist)
|
||||
audio.get_pitch(speakerid: integer) -> number
|
||||
|
||||
-- set audio playback speed
|
||||
audio.set_pitch(speakerid: integer, pitch: number)
|
||||
|
||||
-- get current audio playback time in seconds (0.0 if does not exists)
|
||||
-- get current audio playback time in seconds (0.0 if does not exist)
|
||||
audio.get_time(speakerid: integer) -> number
|
||||
|
||||
-- set audio playback time position in seconds
|
||||
audio.set_time(speakerid: integer, time: number)
|
||||
|
||||
-- get audio source world position (nil if does not exists)
|
||||
-- get audio source world position (nil if does not exist)
|
||||
audio.get_position(speakerid: integer) -> number, number, number
|
||||
|
||||
-- set audio source world position
|
||||
audio.set_position(speakerid: integer, x: number, y: number, z: number)
|
||||
|
||||
-- get audio source movement speed in world (nil if does not exists)
|
||||
-- get audio source movement speed in world (nil if does not exist)
|
||||
-- (OpenAL uses it for Doppler effect simulation)
|
||||
audio.get_velocity(speakerid: integer) -> number, number, number
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ audio.get_velocity(speakerid: integer) -> number, number, number
|
|||
audio.set_velocity(speakerid: integer, x: number, y: number, z: number)
|
||||
|
||||
-- get audio duration
|
||||
-- returns 0, if does not exists
|
||||
-- returns 0, if does not exist
|
||||
-- also returns 0, if duration is unknown (example: radio)
|
||||
audio.get_duration(speakerid: integer) -> number
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Block Models (deprecated)
|
||||
|
||||
> ![WARNING]
|
||||
> [!WARNING]
|
||||
> The `model-primitives` property is deprecated. Use the [VCM format](vcm.md) for a textual description of the model's primitives.
|
||||
|
||||
Block model may be created with following properties:
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Block model type from list:
|
|||
- "block" - default block model
|
||||
- "none" - invisible block (air)
|
||||
- "X" - grass model (two crossed sprites)
|
||||
- "aabb" - model based of block hitbox (complex hitbox will be combined into one). Examples: pipes, bulbs, panels.
|
||||
- "aabb" - model based on block hitbox (complex hitbox will be combined into one). Examples: pipes, bulbs, panels.
|
||||
- "custom" - used when specifying custom models via *model-name*
|
||||
|
||||
### *model-name*
|
||||
|
|
@ -187,7 +187,7 @@ Block is not a physical obstacle if **false**
|
|||
|
||||
### *hitbox*
|
||||
|
||||
An array of 6 numbers describing an offset an size of a block hitbox.
|
||||
An array of 6 numbers describing an offset and size of a block hitbox.
|
||||
|
||||
The numbers are specified in the range [0.0, 1.0] - i.e. within the block (in the case of an extended block, the hitbox can be larger than one, but must not go beyond the "size" property).
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ For composite hitboxes, the *hitboxes* property is used - an array of hitboxes,
|
|||
|
||||
### *grounded*
|
||||
|
||||
Is block may only be set on a solid block and destructs on below block destruction.
|
||||
Block may only be placed on a solid block and is destroyed when the block below is destroyed.
|
||||
|
||||
### *selectable*
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ Block fields are declared in the following format:
|
|||
In addition to `type` and `length`, the `convert-strategy` parameter determines the value conversion strategy when narrowing the data type.
|
||||
|
||||
The parameter takes one of two values:
|
||||
- `reset` - a value that does not exists in the new range will be reset to 0
|
||||
- `reset` - a value that does not exist in the new range will be reset to 0
|
||||
- `clamp` - the value will be reduced to the closest one in the new range
|
||||
|
||||
Example: the number 231 when changing the field type from int16 to int8:
|
||||
|
|
@ -362,7 +362,7 @@ Adds elements to the end of the list instead of completely overwriting it.
|
|||
## Tags
|
||||
|
||||
Tags allow you to designate general properties of blocks. Names should be formatted as `prefix:tag_name`.
|
||||
The prefix is optional, but helps avoid unwanted logical collisions. Example:
|
||||
The prefix is optional, but helps avoid unwanted logical collisions. Example:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ Example:
|
|||
x:num~pos.x
|
||||
```
|
||||
|
||||
Variables may be specified as default values using the `$` prefix:
|
||||
Variables may be specified as default values using the `$` prefix:
|
||||
|
||||
```python
|
||||
t:int=$time
|
||||
|
|
@ -110,7 +110,7 @@ console.add_command(
|
|||
)
|
||||
```
|
||||
|
||||
- Checked values of positional arguments are passed to **args**.
|
||||
- A table of keyword argument values is passed to **kwargs**.
|
||||
- Checked values of positional arguments are passed to **args**.
|
||||
- A table of keyword argument values is passed to **kwargs**.
|
||||
|
||||
The command interpreter performs type checking and casting automatically.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Content-packs
|
||||
|
||||
Every content pack must have an ID following requirements:
|
||||
- name can consist of Capital letters A-Z, lowercase letters a-z digits 0-9, and underscore '\_' signs.
|
||||
- name can consist of Capital letters A-Z, lowercase letters a-z, digits 0-9, and underscore '\_' signs.
|
||||
- the first character must not be a digit.
|
||||
- name length must be in range \[2, 24\]
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ If prefix is not specified, '!' level will be used.
|
|||
|
||||
Example: '~randutil' - weak dependency 'randutil'.
|
||||
|
||||
Dependency version is indicated after '@' symbol and have operators to restrict acceptable versions.
|
||||
Dependency version is indicated after '@' symbol and has operators to restrict acceptable versions.
|
||||
If version is not specified, '\*' (any) version will be used.
|
||||
|
||||
Example: 'randutil@>=1.0' - dependency 'randutil' which requires version 1.0 or newer.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
### Content packs ID
|
||||
|
||||
Content pack identifier requirements:
|
||||
- name can consist of Capital letters A-Z, lowercase letters a-z digits 0-9, and underscore '\_' signs.
|
||||
- name can consist of Capital letters A-Z, lowercase letters a-z, digits 0-9, and underscore '\_' signs.
|
||||
- the first character must not be a digit.
|
||||
- name length must be in range \[2, 24\]
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ Content pack identifier requirements:
|
|||
|
||||
### Content packs data
|
||||
|
||||
State that supposed to be saved with a world, must be stored in `world:data/pack_id/`. The path should be retrieved by calling a function:
|
||||
State that is supposed to be saved with a world, must be stored in `world:data/pack_id/`. The path should be retrieved by calling a function:
|
||||
|
||||
```lua
|
||||
local path = pack.data_file(PACK_ID, "file_name")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Example:
|
|||
]
|
||||
```
|
||||
|
||||
You can pass values in ARGS from the entity configuration.
|
||||
You can pass values in ARGS from the entity configuration.
|
||||
They will be passed both when creating a new entity and when loading a saved one.
|
||||
The `args` list is used for this:
|
||||
|
||||
|
|
@ -76,15 +76,15 @@ Applies to all uses of raycast without the include_non_selectable flag.
|
|||
|
||||
A sensor is an area attached to a physical body that detects the entry of other bodies into it.
|
||||
|
||||
- When a body enter, the *on_sensor_enter* event is triggered.
|
||||
- When a body exit, the *on_sensor_exit* event is called.
|
||||
- When a body enters, the *on_sensor_enter* event is triggered.
|
||||
- When a body exits, the *on_sensor_exit* event is called.
|
||||
|
||||
Sensors are indexed in the same order as they are presented in the list, starting from 0.
|
||||
|
||||
The following types (shapes) of sensors exist:
|
||||
- *radius* is the simplest sensor. Defines the area around the center of the hitbox. The following values are specified:
|
||||
- *radius* is the simplest sensor. Defines the area around the center of the hitbox. The following values are specified:
|
||||
- radius - number.
|
||||
- *aabb* - a rectangular area that changes position depending on the rotation of the entity. **The area itself does not rotate.** The following values are specified:
|
||||
- *aabb* - a rectangular area that changes position depending on the rotation of the entity. **The area itself does not rotate.** The following values are specified:
|
||||
- three numbers x, y, z of the minimal corner of the area.
|
||||
- three numbers x, y, z of the opposite corner of the area.
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ In addition to custom components, the engine automatically saves data from the b
|
|||
|
||||
There is a set of flags that allow you to specify which data will be saved and which will not.
|
||||
|
||||
(Boolean values are specified)
|
||||
(Boolean values are specified)
|
||||
|
||||
| Title | Target | Default |
|
||||
| ---------------------- | ---------------------------------------------------- | ------- |
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Icon type defines a source of an item image displayed in inventory.
|
||||
- **none** - invisible type, used for *core:empty* only (empty item, like the air block). May be removed in future updates.
|
||||
- **sprite** - default type. 2D image. Requires *icon* set to *atlas_name:texture_name*. Example: *blocks:notfound*.
|
||||
There's two atlases available:
|
||||
There are two atlases available:
|
||||
- **blocks** (generated from *png* files in *res/textures/blocks/*)
|
||||
- **items** (generated from *png* files in *res/textures/items/*)
|
||||
- **block** - block preview. Block ID must be specified in **icon** property. Example: *base:wood*.
|
||||
|
|
@ -22,7 +22,7 @@ If the model is not specified, an automatic one will be generated.
|
|||
`caption` - name of item in inventory
|
||||
`description` - item description in inventory
|
||||
|
||||
this props allow to use `md`
|
||||
These properties allow using `md`
|
||||
|
||||
*see [Text Styles](/doc/en/text-styles.md)*
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ this props allow to use `md`
|
|||
|
||||
Specifies what block will be placed on RMB click. Automatically specified in generated items.
|
||||
|
||||
Example: an items that places bazalt blocks:
|
||||
Example: an item that places bazalt blocks:
|
||||
|
||||
```json
|
||||
"placing-block": "base:bazalt"
|
||||
|
|
@ -75,7 +75,7 @@ Allows you to reuse a single script for multiple items.
|
|||
## Tags
|
||||
|
||||
Tags allow you to designate general properties of items. Names should be formatted as `prefix:tag_name`.
|
||||
The prefix is optional, but helps avoid unwanted logical collisions. Example:
|
||||
The prefix is optional, but helps avoid unwanted logical collisions. Example:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Entity skeletons are created via json files in the *skeletons* folder.
|
|||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> The skeleton is a non-indexable content unit. When loading it, the pack prefix is added to the name (example: *drop* in the base pack -> *base:drop*).
|
||||
> The skeleton is a non-indexable content unit. When loading it, the pack prefix is added to the name (example: *drop* in the base pack -> *base:drop*).
|
||||
|
||||
A skeletal element, or bone, consists of a transformation matrix defining its position, rotation and scale relative to the parent element (bone) or entity if the element is the root, a model and a list of sub-elements.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ The script/test name without the path and extension is available as `app.script`
|
|||
local filename = "script:"..app.script..".lua"
|
||||
```
|
||||
|
||||
Since the control script may not belong to any of the packs, it does not belongs to its own package and has its own global namespace in which all global functions and tables are available, as well as the `app` library.
|
||||
Since the control script may not belong to any of the packs, it does not belong to any package and has its own global namespace in which all global functions and tables are available, as well as the `app` library.
|
||||
|
||||
|
||||
## Common functions
|
||||
|
|
@ -67,7 +67,7 @@ app.reconfig_packs(
|
|||
remove_packs: table
|
||||
)
|
||||
|
||||
-- To remove all packs from the configuration,you can use `pack.get_installed()`:
|
||||
-- To remove all packs from the configuration, you can use `pack.get_installed()`:
|
||||
app.reconfig_packs({}, pack.get_installed())
|
||||
-- In this case, `base` will also be removed from the configuration.
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ block.get_variant(x: int, y: int, z: int) -> int
|
|||
-- Sets the block variant by index
|
||||
block.set_variant(x: int, y: int, z: int, index: int)
|
||||
|
||||
-- Checks if an block has specified tag
|
||||
-- Checks if a block has specified tag
|
||||
block.has_tag(id: int, tag: str) -> bool
|
||||
```
|
||||
|
||||
|
|
@ -150,15 +150,15 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: tab
|
|||
|
||||
Casts a ray from the start point in the direction of *dir*. Max_distance specifies the maximum ray length.
|
||||
|
||||
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatibility
|
||||
Argument `filter` can be used to tell ray what blocks can be skipped (passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value (can be nil), it's done for backwards compatibility
|
||||
|
||||
The `include_non_selectable` argument determines whether blocks that cannot be selected by the cursor will be included.
|
||||
Example - `base:water`
|
||||
|
||||
The function returns a table with the results or nil if the ray does not hit any block.
|
||||
|
||||
The result will use the destination table instead of creating a new one if the optional argument specified.
|
||||
The result will use the destination table instead of creating a new one if the optional argument is specified.
|
||||
|
||||
Use `world.raycast(...)` for more detailed configuration.
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Value characters describe the type and size.
|
|||
byteutil.unpack(format: str, bytes: table|Bytearray) -> ...
|
||||
```
|
||||
|
||||
Extracts values from a byte array based on a format string.
|
||||
Extracts values from a byte array based on a format string.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Read whole text file.
|
|||
file.read_bytes(path: str, [optional] usetable) -> array of integers
|
||||
```
|
||||
|
||||
Read file into bytes array. If usetable = false , returns Bytearray instead of table.
|
||||
Read file into bytes array. If usetable = false, returns Bytearray instead of table.
|
||||
|
||||
```lua
|
||||
file.is_writeable(path: str) -> bool
|
||||
|
|
@ -53,7 +53,7 @@ Get file length (bytes) or 0.
|
|||
file.exists(path: str) -> bool
|
||||
```
|
||||
|
||||
Check if file or directory exist.
|
||||
Check if file or directory exists.
|
||||
|
||||
```python
|
||||
file.isfile(path: str) -> bool
|
||||
|
|
@ -83,7 +83,7 @@ Create directories chain. Returns true if new directory created.
|
|||
file.list(path: str) -> array of strings
|
||||
```
|
||||
|
||||
Returns a list of files and directories in the specified.
|
||||
Returns a list of files and directories in the specified directory.
|
||||
|
||||
```python
|
||||
file.list_all_res(path: str) -> array of strings
|
||||
|
|
@ -151,7 +151,7 @@ file.name(path: str) --> str
|
|||
|
||||
Extracts the file name from the path. Example: `world:data/base/config.toml` -> `config.toml`.
|
||||
|
||||
``lua
|
||||
```lua
|
||||
file.stem(path: str) --> str
|
||||
```
|
||||
|
||||
|
|
@ -191,6 +191,6 @@ Removes the entry point (prefix) from the path. Example: `world:data/base/config
|
|||
file.join(directory: str, path: str) --> str
|
||||
```
|
||||
|
||||
Joins the path. Example: `file.join("world:data", "base/config.toml)` -> `world:data/base/config.toml`.
|
||||
Joins the path. Example: `file.join("world:data", "base/config.toml")` -> `world:data/base/config.toml`.
|
||||
|
||||
You should use this function instead of concatenating with `/`, since `prefix:/path` is not valid.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ hud.open_inventory()
|
|||
hud.close_inventory()
|
||||
|
||||
-- Open UI and inventory.
|
||||
-- Throws an exception if has UI layout does not exists.
|
||||
-- Throws an exception if the UI layout does not exist.
|
||||
-- If invid is not specified, a virtual (temporary) inventory is created.
|
||||
-- Returns the invid or id of the virtual inventory.
|
||||
hud.open(
|
||||
|
|
@ -34,12 +34,12 @@ hud.open_block(x: int, y: int, z: int) -> int, str
|
|||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Only one block may be open at same time
|
||||
> Only one block may be open at the same time
|
||||
|
||||
```lua
|
||||
-- Show overlay with layout specified.
|
||||
-- Shows player inventory also if playerinv is true.
|
||||
-- Using `args` you can specify an array of parameter values that will be passed
|
||||
-- Using `args` you can specify an array of parameter values that will be passed
|
||||
-- to on_open of the overlay being shown.
|
||||
hud.show_overlay(layoutid: str, playerinv: bool, [optional] args: table)
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ input.is_pressed(code: str) --> bool
|
|||
|
||||
Checks input activity using a code consisting of:
|
||||
- input type: *key* or *mouse*
|
||||
- input code: [key name](#key names) or mouse button name (left, middle, right)
|
||||
- input code: [key name](../user-input.md#key-names) or mouse button name (left, middle, right)
|
||||
|
||||
Example:
|
||||
```lua
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ inventory.has_data(
|
|||
inventory.size(invid: int) -> int
|
||||
|
||||
-- Add an item to the specified inventory.
|
||||
-- Returns remaining count if could not to add fully.
|
||||
-- Returns remaining count if it could not be added fully.
|
||||
inventory.add(invid: int, itemid: int, count: int) -> int
|
||||
|
||||
-- Returns the index of the first matching slot in the given range.
|
||||
|
|
@ -164,7 +164,7 @@ inventory.get_all_data(
|
|||
slot: int,
|
||||
) -> table | nil
|
||||
|
||||
-- Sets the values of all local item properties.
|
||||
-- Sets the values of all local item properties.
|
||||
inventory.set_all_data(
|
||||
-- inventory id
|
||||
invid: int,
|
||||
|
|
@ -186,8 +186,8 @@ inventory.clone(invid: int) -> int
|
|||
|
||||
-- Move an item from slotA of invA to slotB of invB.
|
||||
-- invA may be the same as invB.
|
||||
-- If slotB will be chosen automatically if argument is not specified.
|
||||
-- The move may be incomplete if the available slot has no enough stack space.
|
||||
-- slotB will be chosen automatically if argument is not specified.
|
||||
-- The move may be incomplete if the available slot does not have enough stack space.
|
||||
inventory.move(invA: int, slotA: int, invB: int, slotB: int)
|
||||
|
||||
-- Moves an item from slotA of inventory invA to a suitable slot(s)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ mat4.scale(m: matrix, scale: vec3, dst: matrix)
|
|||
The angle of rotation is indicated in degrees.
|
||||
|
||||
```lua
|
||||
-- creates a rotation matrix (angle - rotation angle) along a given axis (axis is an unit vector)
|
||||
-- creates a rotation matrix (angle - rotation angle) along a given axis (axis is a unit vector)
|
||||
mat4.rotate(axis: vec3, angle: number)
|
||||
-- returns the result of applying rotation to matrix m
|
||||
mat4.rotate(m: matrix, axis: vec3, angle: number)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Returns the ids of all content packs available but not installed in the world.
|
|||
pack.get_base_packs() -> strings array
|
||||
```
|
||||
|
||||
Returns the id of all base packages (non-removeable)
|
||||
Returns the ids of all base packages (non-removable)
|
||||
|
||||
```lua
|
||||
pack.get_info(packid: str) -> {
|
||||
|
|
@ -90,7 +90,7 @@ pack.get_info(packid: str) -> {
|
|||
```
|
||||
|
||||
Returns information about the pack (not necessarily installed).
|
||||
- icon - name of the preview texture (loading automatically)
|
||||
- icon - name of the preview texture (loaded automatically)
|
||||
- dependencies - strings following format `{lvl}{id}`, where lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
|
|
@ -98,7 +98,7 @@ Returns information about the pack (not necessarily installed).
|
|||
|
||||
for example `!teal`
|
||||
|
||||
To obtain information about multiple packs, use table of ids to avoid re-scanning:one
|
||||
To obtain information about multiple packs, use table of ids to avoid re-scanning:
|
||||
|
||||
```lua
|
||||
pack.get_info(packids: table) -> {id={...}, id2={...}, ...}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ quat.mul_vec3(a: quat, b: vec3, [optional] dst: vec3) -> vec3
|
|||
|
||||
## Spherical linear interpolation - *quat.slerp(...)*
|
||||
|
||||
The interpolation always take the short path and the rotation is performed at constant speed.
|
||||
The interpolation always takes the short path and the rotation is performed at constant speed.
|
||||
|
||||
```lua
|
||||
-- creates a quaternion as an interpolation between a and b,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
-- Checks if world is open
|
||||
world.is_open() -> bool
|
||||
|
||||
-- Returns worlds information.
|
||||
-- Returns world information.
|
||||
world.get_list() -> tables array {
|
||||
-- world name
|
||||
name: str,
|
||||
-- world icon/preview (loading automatically)
|
||||
-- world icon/preview (loaded automatically)
|
||||
icon: str
|
||||
-- engine version the world was saved on
|
||||
version: {int, int}
|
||||
|
|
@ -99,7 +99,7 @@ world.raycast(
|
|||
-- id of the block types used for filtering
|
||||
filter_blocks: table<string|number> = nil,
|
||||
-- exclusion filtering mode:
|
||||
-- if true, filter_blocks defines the list Ignored
|
||||
-- if true, filter_blocks defines the list of ignored block types
|
||||
blocks_exclusion: bool = true,
|
||||
-- include blocks with selectable=false
|
||||
nonselect_blocks: bool = false;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ entity:require_component(name: str) -> component
|
|||
-- Enables/disables the component
|
||||
entity:set_enabled(name: str, enable: bool)
|
||||
|
||||
-- Returns id of player the entity is bound, otherwise -1 is returned.
|
||||
-- Returns id of player the entity is bound to, otherwise -1 is returned.
|
||||
-- At components initialization -1 is also returned,
|
||||
-- since the binding occurs after initialization.
|
||||
entity:get_player() -> int or nil
|
||||
|
|
@ -240,7 +240,7 @@ Called before component data is saved. Here you can write the data you want to s
|
|||
function on_update(tps: int)
|
||||
```
|
||||
|
||||
Called every entities tick (currently 20 times per second).
|
||||
Called every entity tick (currently 20 times per second).
|
||||
|
||||
```lua
|
||||
function on_physics_update(delta: number)
|
||||
|
|
@ -289,7 +289,7 @@ Called when an entity is attacked (LMB on the entity). The first argument is the
|
|||
function on_used(playerid: int)
|
||||
```
|
||||
|
||||
Called when an entity is used (RMB by entity). The player ID is passed as an argument.
|
||||
Called when an entity is used (RMB on the entity). The player ID is passed as an argument.
|
||||
|
||||
```lua
|
||||
function on_player_set(playerid: int)
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ table.index(t: table, x: any) -> int
|
|||
-- Removes element x from t.
|
||||
table.remove_value(t: table, x: any)
|
||||
|
||||
-- Shuffles values in the table.
|
||||
-- Shuffles values in the table.
|
||||
table.shuffle(t: table) -> table
|
||||
|
||||
-- Adds values from table t2 to table t1. If table t2 contains a key from t1, the key's value will not be changed.
|
||||
-- Adds values from table t2 to table t1. If table t2 contains a key from t1, the key's value will not be changed.
|
||||
table.merge(t1: table, t2: table) -> table
|
||||
|
||||
-- Iterates through the table and applies a func to all its elements, returning the new value of the element.
|
||||
|
|
@ -180,7 +180,7 @@ math.sum(x: number, ... | t: table) -> number
|
|||
bit.compile(expr: string, args: table | nil, asFunction: boolean=true) -> function | string
|
||||
|
||||
-- Compiles the function to perform bitwise operations and executes it in place
|
||||
-- * ...: Values to be passed to the compiled function. bit.execute(expr: string, args: table | nil, ...) -> number
|
||||
-- * ...: Values to be passed to the compiled function. bit.execute(expr: string, args: table | nil, ...) -> number
|
||||
```
|
||||
## Additional Global Functions
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ parse_path(path: string) -> string, string
|
|||
sleep(timesec: number)
|
||||
|
||||
-- Waits for the passed coroutine to complete, returning the control flow. The function can only be used inside a coroutine.
|
||||
-- Returns values similar to those returned by pcall.
|
||||
-- Returns values similar to those returned by pcall.
|
||||
await(co: coroutine) -> result, error
|
||||
|
||||
-- A constant storing the PID of the current engine instance.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ The library contains functions for serializing and deserializing XML:
|
|||
|
||||
Further, XML as a data type denotes a Lua table with the following structure:
|
||||
- Element tag is accessible by the key `#`
|
||||
- XML attributes are accessible as key = value pairs
|
||||
- XML attributes are accessible as key = value pairs
|
||||
- Inner elements are accessible by index
|
||||
|
||||
The table is used both as a dictionary and an array.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Module core:bit_converter
|
||||
|
||||
## Converting values to bytes and back
|
||||
## Converting values to bytes and back
|
||||
|
||||
```lua
|
||||
function bit_converter.string_to_bytes(string: str) -> table
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ local worldsPanel = document["worlds-panel"]
|
|||
print(worldsPanel.pos)
|
||||
```
|
||||
|
||||
The IDs of the elements are global for the document, that is, *worlds-panel* can be located either in the root element,
|
||||
and in a nested container.
|
||||
The IDs of the elements are global for the document, that is, *worlds-panel* can be located either in the root element
|
||||
or in a nested container.
|
||||
|
||||
The element id cannot be changed from a script.
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ Here, *color* can be specified in the following ways:
|
|||
| data:unbind_texture() | unbinds the texture from the canvas |
|
||||
| data:mul(*color* or Canvas) | multiplies a color by the specified color or canvas |
|
||||
| data:add(*color* or Canvas) | adds a color or another canvas to a color |
|
||||
| data:sub(*color* or Canvas) | subtracts a color or another canvas to a color |
|
||||
| data:sub(*color* or Canvas) | subtracts a color or another canvas from a color |
|
||||
| data:encode(format: str) | encodes image to specified format and returns bytearray |
|
||||
|
||||
To decode a byte array into a Canvas, use the static method:
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Same structure in XML:
|
|||
|
||||
Unlike XML, the root can contain multiple elements.
|
||||
|
||||
Currently, there are three types of primitives: `tri`, `box`, `rect` and `part` (describes a part of a primitive, such as the side of a cube).
|
||||
Currently, there are three types of primitives: `tri`, `box` and `rect`, as well as `part` (describes a part of a primitive, such as the side of a cube).
|
||||
|
||||
> [!NOTE]
|
||||
> By default, texture coordinates are determined by the dimensions of the primitives.
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ The following variables are available in the generator script:
|
|||
|
||||
## Fragments
|
||||
|
||||
A fragment is a region of the world, like a chunk, saved for later use, limited by a certain width, height and length. A fragment can contain data not only blocks, but also the block inventories and entities. Unlike a chunk, the size of a fragment is arbitrary.
|
||||
A fragment is a region of the world, like a chunk, saved for later use, limited by a certain width, height and length. A fragment can contain not only block data, but also block inventories and entities. Unlike a chunk, the size of a fragment is arbitrary.
|
||||
|
||||
Fragment can be created using the `fragment.save` command, or the `generation.create_fragment` function.
|
||||
|
||||
Fragments used by the generator must present in the directory:
|
||||
Fragments used by the generator must be present in the directory:
|
||||
`generators/generator_name.files/fragments/`
|
||||
|
||||
## Structures
|
||||
|
|
@ -130,7 +130,7 @@ structures = [
|
|||
```
|
||||
|
||||
- key 'forest' - biome name
|
||||
- parameters - weights and central values of the parameters for the biome. See the [biome selection](#biome-selection) section. The number of entries must match the number of biome selection parameters.
|
||||
- parameters - weights and central values of the parameters for the biome. See the [biome selection](#biome-selection) section. The number of entries must match the number of biome selection parameters.
|
||||
- layers - block layers from top to bottom.
|
||||
- height - layer height in blocks. -1 is used to mark the filler layer, of which there can only be one. Its height is calculated automatically.
|
||||
- block - full block name
|
||||
|
|
@ -189,11 +189,11 @@ Where $V$ is the parameter value, $V_b$ is the central parameter value for the b
|
|||
The generator selects the biome with the **least** sum of parameter scores.
|
||||
|
||||
>[!WARNING]
|
||||
> If the parameter values and weights are not set up correctly, biomes may have an effect similar to the depth conflict in 3D graphics when two surfaces overlap.
|
||||
> If the parameter values and weights are not set up correctly, biomes may have an effect similar to the depth conflict in 3D graphics when two surfaces overlap.
|
||||
>
|
||||
In the case of biomes, the pattern looks random due to the distortion of these 'surfaces' by the noise used to generate the parameter maps.
|
||||
>
|
||||
To get rid of the effect, you can either adjust the weights or parameter values of the biomes, or increase the difference in the generation of the parameter maps.
|
||||
To get rid of the effect, you can either adjust the weights or parameter values of the biomes, or increase the difference in the generation of the parameter maps.
|
||||
|
||||
## Heightmap
|
||||
|
||||
|
|
@ -224,13 +224,13 @@ map:ceil()
|
|||
-- Round to the nearest integer
|
||||
map:round()
|
||||
|
||||
-- Sine of height values (in radians)
|
||||
-- Sine of height values (in radians)
|
||||
map:sin()
|
||||
|
||||
-- Cosine of height values (in radians)
|
||||
-- Cosine of height values (in radians)
|
||||
map:cos()
|
||||
|
||||
-- Tangent of height values (in radians)
|
||||
-- Tangent of height values (in radians)
|
||||
map:tan()
|
||||
```
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ map:mixin(value: Heightmap|number, t: Heightmap|number)
|
|||
|
||||
### heightmap:dump(...)
|
||||
|
||||
A method used for debugging, creates an image based on a heightmap by converting values from the range `[-1.0, 1.0]` to brightness values `[0, 255]`, saving it to the specified file.
|
||||
A method used for debugging, creates an image based on a heightmap by converting values from the range `[-1.0, 1.0]` to brightness values `[0, 255]`, saving it to the specified file.
|
||||
|
||||
```lua
|
||||
map:dump('export:test.png')
|
||||
|
|
@ -541,5 +541,5 @@ fragment_name = {}
|
|||
{"struct": "fragment_name", "rarity": rarity}
|
||||
]
|
||||
```
|
||||
The higher the rarity value, the less ore generation chance.
|
||||
The higher the rarity value, the lower the ore generation chance.
|
||||
You can rely on the rarity of coal ore: 4400.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Examples:
|
|||
|
||||
# Template attributes
|
||||
|
||||
- `if` with values ('', 'false', 'nil') the element will be ignored, including sub-elements.
|
||||
- `if` with values ('', 'false', 'nil') the element will be ignored, including sub-elements.
|
||||
- `ifnot` is the same as `if`, but with the opposite condition.
|
||||
|
||||
# Common *container* attributes
|
||||
|
|
@ -162,17 +162,17 @@ The key code for comparison can be obtained via `input.keycode("key_name")`
|
|||
- `min` - minimal value. Type: number. Default: 0
|
||||
- `max` - maximal value. Type: number. Default: 1
|
||||
- `value` - initial value. Type: number. Default: 0
|
||||
- `step` - track step size. Type: number: Default: 1
|
||||
- `track-width` track pointer width (in steps). Type: number. Default: 1
|
||||
- `step` - track step size. Type: number. Default: 1
|
||||
- `track-width` - track pointer width (in steps). Type: number. Default: 1
|
||||
- `track-color` - the color of the pointer when hovering over the cursor. Type: RGBA color.
|
||||
- `consumer` - Lua function - new value consumer
|
||||
- `sub-consumer` - Lua function that receives intermediate values (use to update text when `change-on-release="true"`)
|
||||
- `sub-consumer` - Lua function that receives intermediate values (use to update text when `change-on-release="true"`)
|
||||
- `supplier` - Lua function - value supplier
|
||||
- `change-on-release` - Call consumer on trackbar release only. Type: boolean. Default: false
|
||||
|
||||
## Inline frame - *iframe*
|
||||
|
||||
Container for embedding an external document. Content is scaling to the iframe size.
|
||||
Container for embedding an external document. Content is scaled to the iframe size.
|
||||
|
||||
- `src` - document id in the format `pack:name` (`pack/layouts/name.xml`)
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ Example of list description:
|
|||
- `onselect` - function to which the user-selected value is passed
|
||||
- `mode` - behaviour / display mode:
|
||||
- `select` - default mode.
|
||||
- `button` - button mode: the text is not replaced with the selected option; the element rendered as a regular button.
|
||||
- `button` - button mode: the text is not replaced with the selected option; the element is rendered as a regular button.
|
||||
|
||||
## *bindbox*
|
||||
|
||||
|
|
@ -213,18 +213,18 @@ An element for displaying and editing key or mouse button bindings.
|
|||
Element is a container. Does not have specific attributes.
|
||||
|
||||
> [!WARNING]
|
||||
> Inventories position is controlled by the engine and can not be changed by attributes *pos* and *margin*
|
||||
> Inventory position is controlled by the engine and can not be changed by attributes *pos* and *margin*
|
||||
|
||||
> [!WARNING]
|
||||
> Slots not linked to an inventory will not be displayed. "Linked to an inventory" refers to the association between an inventory UI element and an inventory via an ID. This link can be explicitly established using `inventory_ui.inventory = inventory_id`. [(see ui.md)](scripting/ui.md#inventory)
|
||||
|
||||
## *slot*
|
||||
|
||||
Element must be in direct sub-element of *inventory*.
|
||||
Element must be a direct sub-element of *inventory*.
|
||||
- `index` - inventory slot index (starting from 0). Type: integer
|
||||
- `item-source` - content access panel behaviour (infinite source of an item). Type: boolean
|
||||
- `sharefunc` - Lua event called on <btn>LMB</btn> + <btn>Shift</btn>. Inventory id and slot index passed as arguments.
|
||||
- `updatefunc` - Lua event called on slot content update.Inventory id and slot index passed as arguments.
|
||||
- `updatefunc` - Lua event called on slot content update. Inventory id and slot index passed as arguments.
|
||||
- `onrightclick` - Lua event called on <btn>RMB</btn> click. Inventory id and slot index passed as arguments.
|
||||
- `taking` - the ability to take an item from a slot.
|
||||
- `placing` - the ability to put an item in a slot.
|
||||
|
|
@ -235,12 +235,12 @@ Element must be in direct sub-element of *inventory*.
|
|||
- `interval` - visual slots interval. Type: number
|
||||
- `padding` - grid padding (not slots interval). Type: number. (*deprecated*)
|
||||
- `sharefunc` - Lua event called on <btn>LMB</btn> + <btn>Shift</btn>. Inventory id and slot index passed as arguments.
|
||||
- `updatefunc` - Lua event called on slot content update.Inventory id and slot index passed as arguments.
|
||||
- `updatefunc` - Lua event called on slot content update. Inventory id and slot index passed as arguments.
|
||||
- `onrightclick` - Lua event called on <btn>RMB</btn> click. Inventory id and slot index passed as arguments.
|
||||
- `taking` - the ability to take an item from a slot.
|
||||
- `placing` - the ability to put an item in a slot.
|
||||
|
||||
Slots configuration (just specify two attributes):
|
||||
- `rows` - number of rows. Type: integer
|
||||
- `rows` - number of rows. Type: integer
|
||||
- `cols` - number of columns. Type: integer
|
||||
- `count` - total number of slots. Type: integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue