Merge branch 'main' into dev
This commit is contained in:
@@ -98,6 +98,32 @@ Properties available for variance:
|
||||
|
||||
Variants are managed via `block.set_variant(x, y, z, index)`.
|
||||
|
||||
### Custom model variants (geometry switching)
|
||||
|
||||
You can use different custom models for different variants. Provide a separate `model-name` for each variant that needs different geometry. The renderer caches geometry per (block id, variant).
|
||||
|
||||
The base model (specified in root) becomes variant 0. The variants array maps to indices 1+.
|
||||
|
||||
Example (default + two custom variants):
|
||||
```json
|
||||
{
|
||||
"model": "custom",
|
||||
"model-name": "stairs_middle",
|
||||
"state-based": {
|
||||
"bits": 4,
|
||||
"variants": [
|
||||
{ "model": "custom", "model-name": "stairs_left" },
|
||||
{ "model": "custom", "model-name": "stairs_right" }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this example:
|
||||
- Variant 0 = `stairs_middle` (from root)
|
||||
- Variant 1 = `stairs_left` (from variants[0])
|
||||
- Variant 2 = `stairs_right` (from variants[1])
|
||||
|
||||
## Lighting
|
||||
|
||||
### *emission*
|
||||
|
||||
@@ -119,6 +119,18 @@ player.get_name(playerid: int) -> str
|
||||
|
||||
Player name setter and getter
|
||||
|
||||
```lua
|
||||
player.get_camera(playerid: int) -> int
|
||||
```
|
||||
|
||||
Returns the index of the player's current camera.
|
||||
|
||||
```lua
|
||||
player.set_camera(playerid: int, camera_index: int)
|
||||
```
|
||||
|
||||
Switches the player's camera. See [cameras](libcameras.md).
|
||||
|
||||
```lua
|
||||
player.set_selected_slot(playerid: int, slotid: int)
|
||||
```
|
||||
|
||||
@@ -190,6 +190,12 @@ function on_hud_open(playerid: int)
|
||||
|
||||
Called after world open.
|
||||
|
||||
```lua
|
||||
function on_hud_render()
|
||||
```
|
||||
|
||||
Called every frame. Used for client-side tasks such as animation and camera control.
|
||||
|
||||
```lua
|
||||
function on_hud_close(playerid: int)
|
||||
```
|
||||
|
||||
@@ -106,6 +106,32 @@
|
||||
|
||||
Управление состоянием производится через `block.set_variant(x, y, z, index)`.
|
||||
|
||||
### Кастомные модели по вариантам (переключение геометрии)
|
||||
|
||||
Для custom-моделей можно переключать геометрию по варианту. Укажите отдельный `model-name` в нужных вариантах — рендерер кэширует геометрию по паре (id блока, вариант).
|
||||
|
||||
Базовая модель (из корня) становится вариантом 0. Массив variants соответствует индексам 1+.
|
||||
|
||||
Пример (база + два кастомных варианта):
|
||||
```json
|
||||
{
|
||||
"model": "custom",
|
||||
"model-name": "stairs_middle",
|
||||
"state-based": {
|
||||
"bits": 4,
|
||||
"variants": [
|
||||
{ "model": "custom", "model-name": "stairs_left" },
|
||||
{ "model": "custom", "model-name": "stairs_right" }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
В этом примере:
|
||||
- Вариант 0 = `stairs_middle` (из корня)
|
||||
- Вариант 1 = `stairs_left` (из variants[0])
|
||||
- Вариант 2 = `stairs_right` (из variants[1])
|
||||
|
||||
## Освещение
|
||||
|
||||
### Излучение - *emission*:
|
||||
|
||||
@@ -119,6 +119,18 @@ player.get_name(playerid: int) -> str
|
||||
|
||||
Сеттер и геттер имени игрока
|
||||
|
||||
```lua
|
||||
player.get_camera(playerid: int) -> int
|
||||
```
|
||||
|
||||
Возвращает индекс текущей камеры игрока
|
||||
|
||||
```lua
|
||||
player.set_camera(playerid: int, camera_index: int)
|
||||
```
|
||||
|
||||
Переключает камеру игрока. См. [камеры](libcameras.md).
|
||||
|
||||
```lua
|
||||
player.set_selected_slot(playerid: int, slotid: int)
|
||||
```
|
||||
|
||||
@@ -190,6 +190,12 @@ function on_hud_open(playerid: int)
|
||||
|
||||
Вызывается после входа в мир, когда становится доступна библиотека hud. Здесь на экран добавляются постоянные элементы.
|
||||
|
||||
```lua
|
||||
function on_hud_render()
|
||||
```
|
||||
|
||||
Вызывается каждый кадр. Используется для клиентских задач, таких как анимация, управление камерой.
|
||||
|
||||
```lua
|
||||
function on_hud_close(playerid: int)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user