Merge branch 'main' into vec3-models-loader

This commit is contained in:
MihailRis
2024-10-26 12:55:10 +03:00
15 changed files with 181 additions and 27 deletions
+1
View File
@@ -21,6 +21,7 @@ Subsections:
- [player](scripting/builtins/libplayer.md)
- [quat](scripting/builtins/libquat.md)
- [time](scripting/builtins/libtime.md)
- [utf8](scripting/builtins/libutf8.md)
- [vec2, vec3, vec4](scripting/builtins/libvecn.md)
- [world](scripting/builtins/libworld.md)
- [Module core:bit_converter](scripting/modules/core_bit_converter.md)
+21
View File
@@ -0,0 +1,21 @@
# *utf8* library
The library provides functions for working with UTF-8.
```lua
-- Converts a UTF-8 string to a Bytearray or an array of numbers if
-- the second argument is true
utf8.tobytes(text: str, [optional] usetable=false) -> Bytearray|table
-- Converts a Bytearray or an array of numbers to a UTF-8 string
utf8.tostring(bytes: Bytearray|table) -> str
-- Returns the length of a Unicode string
utf8.length(text: str) -> int
-- Returns the code of the first character of the string
utf8.codepoint(chars: str) -> int
-- Returns a substring from position startchar to endchar inclusive
utf8.sub(text: str, startchar: int, [optional] endchar: int) -> str
```
+8 -10
View File
@@ -72,15 +72,13 @@ Fragments used by the generator must present in the directory:
## Structures
A structure is a set of rules for inserting a fragment into the world by the generator. It currently has no properties, being created as empty objects in the `generators/generator_name.files/structures.json` file. Example:
```lua
{
"tree0": {},
"tree1": {},
"tree2": {},
"tower": {},
"coal_ore0": {}
}
A structure is a set of rules for inserting a fragment into the world by the generator. It currently has no properties, being created as empty objects in the `generators/generator_name.files/structures.toml` file. Example:
```toml
tree0 = {}
tree1 = {}
tree2 = {}
tower = {}
coal_ore0 = {}
```
Currently, the name of the structure must match the name of the fragment used.
@@ -136,7 +134,7 @@ structures = [
- block - plant block
- structure-chance - probability of generating a small structure on a surface block.
- structures - structures randomly placed on the surface.
- name - name of the structure declared in `structures.json`.
- name - name of the structure declared in `structures.toml`.
- weight - weight directly affecting the chance of choosing a specific structure.
### Biome Parameters
+1
View File
@@ -21,6 +21,7 @@
- [player](scripting/builtins/libplayer.md)
- [quat](scripting/builtins/libquat.md)
- [time](scripting/builtins/libtime.md)
- [utf8](scripting/builtins/libutf8.md)
- [vec2, vec3, vec4](scripting/builtins/libvecn.md)
- [world](scripting/builtins/libworld.md)
- [Модуль core:bit_converter](scripting/modules/core_bit_converter.md)
+1 -1
View File
@@ -31,7 +31,7 @@ file.write(pack.shared_file(PACK_ID, "example.txt"), text)
```
Для пака *containermod* запишет текст в файл `config:containermod/example.txt`
Используйте для хранения данныхm общих для всех миров.
Используйте для хранения данных общих для всех миров.
```python
pack.get_folder(packid: str) -> str
+21
View File
@@ -0,0 +1,21 @@
# Библиотека *utf8*
Библиотека предоставляет функции для работы с UTF-8.
```lua
-- Конвертирует UTF-8 строку в Bytearray или массив чисел если
-- второй аргумент - true
utf8.tobytes(text: str, [опционально] usetable=false) -> Bytearray|table
-- Конвертирует Bytearray или массив чисел в UTF-8 строку
utf8.tostring(bytes: Bytearray|table) -> str
-- Возвращает длину юникод-строки
utf8.length(text: str) -> int
-- Возвращает код первого символа строки
utf8.codepoint(chars: str) -> int
-- Возвращает подстроку от позиции startchar до endchar включительно
utf8.sub(text: str, startchar: int, [опционально] endchar: int) -> str
```
+8 -10
View File
@@ -72,15 +72,13 @@
## Структуры
Структура - набор правил по вставке фрагмента в мир генератором. На данный момент не имеет свойств, создаваясь в виде пустых объектов в файле `generators/имя_генератора.files/structures.json`. Пример:
```lua
{
"tree0": {},
"tree1": {},
"tree2": {},
"tower": {},
"coal_ore0": {}
}
Структура - набор правил по вставке фрагмента в мир генератором. На данный момент не имеет свойств, создаваясь в виде пустых объектов в файле `generators/имя_генератора.files/structures.toml`. Пример:
```toml
tree0 = {}
tree1 = {}
tree2 = {}
tower = {}
coal_ore0 = {}
```
На данный момент, имя структуры должно совпадать с именем использованного фрагмента.
@@ -136,7 +134,7 @@ structures = [
- block - блок растения
- structure-chance - вероятность генерации малой структуры на блоке поверхности.
- structures - структуры, случайно расставляемые на поверхности.
- name - имя структуры, объявленной в `structures.json`.
- name - имя структуры, объявленной в `structures.toml`.
- weight - вес, напрямую влияющий на шанс выбора конкретной структуры.
### Параметры биомов