mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
Merge branch 'main' into animation
This commit is contained in:
commit
49e7f2c631
89 changed files with 1050 additions and 687 deletions
|
|
@ -69,6 +69,7 @@ Rotation profile (set of available block rotations and behaviour of placing bloc
|
|||
- "pipe" - wood logs, pipes, pillars
|
||||
- "pane" - panels, doors, signs
|
||||
- "stairs" - "pane" + flipped variants
|
||||
- "ladder" - like a "pipe", but on horizontal surfaces it is installed like "pane"
|
||||
|
||||
### *particles*
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ gui.confirm(
|
|||
## Documents and templates
|
||||
|
||||
```lua
|
||||
-- Loads a UI document with its script, returns the name of the document if successfully loaded.
|
||||
-- Loads a UI document with its script. Returns document environment table
|
||||
gui.load_document(
|
||||
-- Path to the xml file of the page. Example: `core:layouts/pages/main.xml`
|
||||
path: str,
|
||||
|
|
@ -147,7 +147,7 @@ gui.load_document(
|
|||
name: str
|
||||
-- Table of parameters passed to the on_open event
|
||||
args: table
|
||||
) -> str
|
||||
) -> table
|
||||
|
||||
-- Loads and processes layout template from file
|
||||
gui.template(
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ hud.get_block_inventory() -> int
|
|||
-- Gives the ID of the second open inventory (block, virtual inventory...) or 0.
|
||||
hud.get_second_inventory() -> int
|
||||
|
||||
-- Get the inventory ID of exchange item (grabbed item in inventory) or 0.
|
||||
-- It has only one slot - 0
|
||||
hud.get_exchange_inventory() -> int
|
||||
|
||||
-- Gives the ID of the player that the UI is bound to.
|
||||
hud.get_player() -> int
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Called on block broken by player
|
|||
function on_replaced(x, y, z, playerid)
|
||||
```
|
||||
|
||||
Called on block replaced with other by player
|
||||
Called before a player replaces a block
|
||||
|
||||
```lua
|
||||
function on_interact(x, y, z, playerid) -> bool
|
||||
|
|
|
|||
|
|
@ -212,10 +212,27 @@ local map = Heightmap(width, height)
|
|||
Operations apply to all height values.
|
||||
|
||||
```lua
|
||||
-- Convert to absolute values
|
||||
map:abs()
|
||||
```
|
||||
|
||||
Casts height values to absolute.
|
||||
-- Round down
|
||||
map:floor()
|
||||
|
||||
-- Round up
|
||||
map:ceil()
|
||||
|
||||
-- Round to the nearest integer
|
||||
map:round()
|
||||
|
||||
-- Sine of height values (in radians)
|
||||
map:sin()
|
||||
|
||||
-- Cosine of height values (in radians)
|
||||
map:cos()
|
||||
|
||||
-- Tangent of height values (in radians)
|
||||
map:tan()
|
||||
```
|
||||
|
||||
### Binary Operations
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ Examples:
|
|||
- `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.
|
||||
- `onrightclick` - lua function called when the right mouse button is pressed on an element.
|
||||
- `onmiddleclick` - lua function called when the middle mouse button is pressed on an element.
|
||||
- `ondoubleclick` - lua function called when you double click on an element.
|
||||
- `onfocus` - lua function called when focusing on an element.
|
||||
- `ondefocus` - lua function called when the element loses focus.
|
||||
|
|
@ -192,6 +194,9 @@ Example of list description:
|
|||
- `width` - minimum content width. Default: 100.
|
||||
- `selected` - initially selected value. Default: "".
|
||||
- `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.
|
||||
|
||||
## *bindbox*
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
- "pipe" - профиль "труба". Примеры блоков: бревно, труба, лампочка
|
||||
- "pane" - профиль "панель". Примеры блоков: панель, дверь, табличка
|
||||
- "stairs" - профиль "ступеньки" ("pane" + перевернутые варианты)
|
||||
- "ladder" - профиль "лестница" (как "pipe", но на горизонтальных поверхностях как "pane")
|
||||
|
||||
### Испускаемые частицы - *particles*
|
||||
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ gui.confirm(
|
|||
## Документы и шаблоны
|
||||
|
||||
```lua
|
||||
-- Загружает UI документ и его скрипт. Возвращает имя документа.
|
||||
-- Загружает UI документ и его скрипт. Возвращает пространство имён документа
|
||||
gui.load_document(
|
||||
path: string, -- путь к xml файлу, например: core:layouts/pages/main.xml
|
||||
name: string, -- id документа, например: core:pages/main
|
||||
args: table -- параметры для события on_open
|
||||
) -> string
|
||||
) -> table
|
||||
|
||||
-- Обрабатывает xml шаблон макета из файла
|
||||
gui.template(
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@ hud.get_block_inventory() -> int
|
|||
-- Дает ID второго открытого инвентаря (блок, виртуальный инвентарь...) или 0.
|
||||
hud.get_second_inventory() -> int
|
||||
|
||||
-- Получить ID инвентаря, в котором находится предмет во время
|
||||
-- его перемещения в инвентаре, или 0 если его не существует.
|
||||
-- Имеет единственный слот - 0
|
||||
hud.get_exchange_inventory() -> int
|
||||
|
||||
-- Дает ID игрока, к которому привязан пользовательский интерфейс.
|
||||
hud.get_player() -> int
|
||||
|
||||
|
|
@ -81,4 +86,4 @@ hud.set_allow_pause(flag: boolean)
|
|||
|
||||
-- Функция, управляющая именованным скелетом 'hand' (см. gfx.skeletons)
|
||||
hud.hand_controller: function()
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ function on_broken(x, y, z, playerid)
|
|||
function on_replaced(x, y, z, playerid)
|
||||
```
|
||||
|
||||
Вызывается после замены блока игроком
|
||||
Вызывается перед заменой блока игроком
|
||||
|
||||
```lua
|
||||
function on_interact(x, y, z, playerid) -> bool
|
||||
|
|
|
|||
|
|
@ -215,12 +215,28 @@ local map = Heightmap(ширина, высота)
|
|||
Операции применяются ко всем значениям высоты.
|
||||
|
||||
```lua
|
||||
-- Приведение значений высот к абсолютным
|
||||
map:abs()
|
||||
|
||||
-- Округление к меньшему целому
|
||||
map:floor()
|
||||
|
||||
-- Округление к большему целому
|
||||
map:ceil()
|
||||
|
||||
-- Округление к ближайшему целому
|
||||
map:round()
|
||||
|
||||
-- Синус от значений высот (в радианах)
|
||||
map:sin()
|
||||
|
||||
-- Косинус от значений высот (в радианах)
|
||||
map:cos()
|
||||
|
||||
-- Тангенс от значений высот (в радианах)
|
||||
map:tan()
|
||||
```
|
||||
|
||||
Приводит значения высот к абсолютным.
|
||||
|
||||
|
||||
### Бинарные операции
|
||||
|
||||
Операции с применением второй карты или скаляра.
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@
|
|||
- `position-func` - поставщик позиции элемента (два числа), вызываемый при изменении размера контейнера, в котором находится элемент, либо при добавлении элемента в контейнер. Может быть вызван до вызова on_hud_open.
|
||||
- `size-func` - поставщик размера элемента (два числа), вызываемый при изменении размера контейнера, в котором находится элемент, либо при добавлении элемента в контейнер. Может быть вызван до вызова on_hud_open.
|
||||
- `onclick` - lua функция вызываемая при нажатии на элемент.
|
||||
- `onrightclick` - lua функция вызываемая при нажатии правой кнопки мыши на элемент.
|
||||
- `onmiddleclick` - lua функция вызываемая при нажатии средней кнопки мыши на элемент.
|
||||
- `ondoubleclick` - lua функция вызываемая при двойном нажатии на элемент.
|
||||
- `onfocus` - lua функция вызываемая при фокусировке на элемент.
|
||||
- `ondefocus` - lua функция вызываемая при потере фокуса элеметом.
|
||||
|
|
@ -193,6 +195,9 @@
|
|||
- `width` - минимальная ширина содержимого. По-умолчанию: 100.
|
||||
- `selected` - изначально выбранное значение. По-умолчанию: "".
|
||||
- `onselect` - функция, в которую передаётся выбранное пользователем значение
|
||||
- `mode` - режим работы:
|
||||
- `select` - режим по-умолчанию.
|
||||
- `button` - режим кнопки: текст не заменяется на выбранную опцию, а элемент выглядит как обычная кнопка.
|
||||
|
||||
## Привязка ввода - *bindbox*
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue