Merge branch 'main' into release-0.26

This commit is contained in:
MihailRis
2025-01-19 20:17:58 +03:00
81 changed files with 950 additions and 269 deletions
+3 -1
View File
@@ -77,12 +77,14 @@ Checks if content is loaded.
```lua
app.new_world(
-- world name
-- world name, empty string will create a nameless world
name: str,
-- generation seed
seed: str,
-- generator name
generator: str
-- local player id
[optional] local_player: int=0
)
```
+3
View File
@@ -62,4 +62,7 @@ hud.is_paused() -> bool
-- Returns true if inventory is open or overlay is shown.
hud.is_inventory_open() -> bool
-- Sets whether to allow pausing. If false, the pause menu will not pause the game.
hud.set_allow_pause(flag: bool)
```
+2 -2
View File
@@ -37,10 +37,10 @@ player.set_vel(playerid: int, x: number, y: number, z: number)
Sets x, y, z player linear velocity
```lua
player.get_rot(playerid: int) -> number, number, number
player.get_rot(playerid: int, interpolated: bool) -> number, number, number
```
Returns x, y, z of camera rotation (radians)
Returns x, y, z of camera rotation (radians). Interpolation is relevant in cases where the rotation refresh rate is lower than the frame rate.
```lua
player.set_rot(playerid: int, x: number, y: number, z: number)
+1
View File
@@ -56,6 +56,7 @@ Common element methods:
| ------------------- | ----------------------------------------------------------------------------------- |
| moveInto(container) | moves the element to the specified container (the element is specified, not the id) |
| destruct() | removes element |
| reposition() | updates the element position based on the `positionfunc` |
## Containers
+31
View File
@@ -19,3 +19,34 @@ Styles can be combined. Example:
Output:
***<ins>Message</ins>*** using *~~combed~~ combined* styles<ins>~~.~~</ins>
# Colors
Text color can be set using a color code: [#RRGGBB]
| Component | Purpose |
| --------- | --------------------------------- |
| R | Represents the intensity of red |
| G | Represents the intensity of green |
| B | Represents the intensity of blue |
### Example:
<span style="color: #ff0000">
<span style="color:rgb(105, 105, 105)">
[#ff0000]
</span>Red Text
</span>
<span style="color: #00ff00">
<span style="color:rgb(105, 105, 105)">
[#00ff00]
</span>Green Text
</span>
<span style="color: #0000ff">
<span style="color:rgb(105, 105, 105)">
[#0000ff]
</span>Blue Text
</span>
+2
View File
@@ -35,6 +35,7 @@ Examples:
- `margin` - element margin. Type: 4D vector
*left, top, right, bottom*
- `visible` - element visibility. Type: boolean (true/false)
- `min-size` - minimal element size. Type: 2D vector.
- `position-func` - position supplier for an element (two numbers), called on every parent container size update or on element adding on a container. May be called before *on_hud_open*
- `size-func` - element size provider (two numbers), called when the size of the container in which the element is located changes, or when an element is added to the container. Can be called before on_hud_open is called.
- `onclick` - lua function called when an element is clicked.
@@ -65,6 +66,7 @@ Buttons and panels are also containers.
Buttons are also panels.
- `max-length` - maximal length of panel stretching before scrolling (if scrollable = true). Type: number
- `min-length` - minimal length of panel. Type: number
- `orientation` - panel orientation: horizontal/vertical.
# Common elements
+3 -1
View File
@@ -77,12 +77,14 @@ app.is_content_loaded() -> bool
```lua
app.new_world(
-- название мира
-- название мира, пустая строка приведёт к созданию безымянного мира
name: str,
-- зерно генерации
seed: str,
-- название генератора
generator: str
-- id локального игрока
[опционально] local_player: int=0
)
```
+3
View File
@@ -65,4 +65,7 @@ hud.is_paused() -> bool
-- Возвращает true если открыт инвентарь или оверлей.
hud.is_inventory_open() -> bool
-- Устанавливает разрешение на паузу. При значении false меню паузы не приостанавливает игру.
hud.set_allow_pause(flag: bool)
```
+2 -2
View File
@@ -37,10 +37,10 @@ player.set_vel(playerid: int, x: number, y: number, z: number)
Устанавливает x, y, z линейной скорости игрока
```lua
player.get_rot(playerid: int) -> number, number, number
player.get_rot(playerid: int, interpolated: bool=false) -> number, number, number
```
Возвращает x, y, z вращения камеры (в радианах)
Возвращает x, y, z вращения камеры (в радианах). Интерполяция актуальна в случаях, когда частота обновления вращения ниже частоты кадров.
```lua
player.set_rot(playerid: int, x: number, y: number, z: number)
+1
View File
@@ -56,6 +56,7 @@ document["worlds-panel"]:clear()
| ------------------- | ----------------------------------------------------------------------- |
| moveInto(container) | перемещает элемент в указанный контейнер (указывается элемент, а не id) |
| destruct() | удаляет элемент |
| reposition() | обновляет позицию элемента на основе функции позиционирования |
## Контейнеры
+30
View File
@@ -19,3 +19,33 @@
Вывод:
***<ins>Сообщение</ins>***, демонстрирующее *~~обедненные~~ объединенные* стили<ins>~~.~~</ins>
## Цвета
Цвет текста задается при помощи цветового кода: [#RRGGBB]
| Компонент | Назначение |
| ------------ | ------------------------- |
| R | Используется для интенсивности красного |
| G | Используется для интенсивности зеленого |
| B | Используется для интенсивности синего |
### Например:
<span style="color: #ff0000">
<span style="color:rgb(105, 105, 105)">
[#ff0000]
</span>Красный Текст
</span>
<span style="color: #00ff00">
<span style="color:rgb(105, 105, 105)">
[#00ff00]
</span>Зеленый Текст
</span>
<span style="color: #0000ff">
<span style="color:rgb(105, 105, 105)">
[#0000ff]
</span>Синий Текст
</span>
+2
View File
@@ -39,6 +39,7 @@
- `margin` - внешний отступ элемента. Тип: 4D вектор.
Порядок: `"left,top,right,bottom"`
- `visible` - видимость элемента. Тип: логический ("true"/"false").
- `min-size` - минимальный размер элемента. Тип: 2D вектор.
- `position-func` - поставщик позиции элемента (два числа), вызываемый при изменении размера контейнера, в котором находится элемент, либо при добавлении элемента в контейнер. Может быть вызван до вызова on_hud_open.
- `size-func` - поставщик размера элемента (два числа), вызываемый при изменении размера контейнера, в котором находится элемент, либо при добавлении элемента в контейнер. Может быть вызван до вызова on_hud_open.
- `onclick` - lua функция вызываемая при нажатии на элемент.
@@ -67,6 +68,7 @@
В число панелей также входят кнопки.
- `max-length` - максимальная длина, на которую растягивается панель до начала скроллинга (если scrollable = true). Тип: число
- `min-length` - минимальная длина панели. Тип: число
- `orientation` - ориентация панели: horizontal/vertical.
# Основные элементы