docs: describe hotbar keys by topic and hotbar size from server side

This commit is contained in:
ostermine 2026-10-16 14:06:08 +03:00
parent aa670f3c9d
commit 40e2814f9e
6 changed files with 10 additions and 10 deletions

View file

@ -97,9 +97,6 @@ Don't be intimidated by the following text, as a minimal pack only requires `pac
- Configuration:
- `config/` - Configuration files
- `defaults.toml` - Overrides for standard content bindings, such as the player entity, default generator, etc.
- `hotbar-size` - number of hotbar slots, 10 by default (see `player.set_hotbar_size`)
- `hotbar-layout` - layout replacing the built-in hotbar, for example `"pack:hotbar"`. The root element must be `inventory`, it is bound to the player inventory. Without `position-func` the layout is placed at the bottom center of the screen
- `inventory-layout` - player inventory layout, `"core:inventory"` by default. The root element must be `inventory`
- `bindings.toml` - Keyboard/Mouse bindings
- `user-props.toml` - User properties for content definitions
- `devtools/` - Auxiliary files for internal debugging tools

View file

@ -149,7 +149,7 @@ player.get_hotbar_size(playerid: int) -> int
player.set_hotbar_size(playerid: int, size: int)
```
Hotbar size getter and setter: the number of first inventory slots selected with the mouse wheel and number keys. Default value is `hotbar-size` from `config/defaults.toml` (10). The value is not saved with the world.
Hotbar size getter and setter: the number of first player inventory slots that can be selected. `player.set_selected_slot` wraps the index by it, and the selected slot is moved into the range when the size decreases. Default value is `hotbar-size` from `config/defaults.toml` (10); the value is not saved with the world. On the client these slots are shown in the hotbar and selected with the mouse wheel and number keys.
```lua
player.get_selected_block(playerid: int) -> x,y,z

View file

@ -218,6 +218,8 @@ Element is a container. Does not have specific attributes.
> [!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)
A pack can replace the player inventory screen and the hotbar with its own layouts using `inventory-layout` (`"core:inventory"` by default) and `hotbar-layout` in `config/defaults.toml`. The root element of such a layout must be `inventory`, it is bound to the player inventory. The hotbar layout is placed at the bottom center of the screen unless it has `position-func`.
## *slot*
Element must be in direct sub-element of *inventory*.

View file

@ -99,9 +99,6 @@ print(file.read("пак:package.json")) -- выведет содержимое p
- Конфигурация:
- `config/` - файлы конфигурации
- `defaults.toml` - переопределения стандартных привязок к контенту, такие как сущность игрока, генератор по-умолчанию и т.д.
- `hotbar-size` - число слотов хотбара, по умолчанию 10 (см. `player.set_hotbar_size`)
- `hotbar-layout` - макет, заменяющий встроенный хотбар, например `"pack:hotbar"`. Корневой элемент - `inventory`, он привязывается к инвентарю игрока. Без `position-func` макет ставится внизу по центру экрана
- `inventory-layout` - макет инвентаря игрока, по умолчанию `"core:inventory"`. Корневой элемент - `inventory`
- `bindings.toml` - привязки к клавишам / мыши
- `user-props.toml` - пользовательские свойства определений контента
- `devtools/` - вспомогательные файлы внутренних инструментов отладки

View file

@ -98,9 +98,11 @@ player.get_inventory(playerid: int) -> int, int
-- Устанавливает выбранный слот (индекс берётся по модулю размера хотбара)
player.set_selected_slot(playerid: int, slotid: int)
-- Возвращает / устанавливает размер хотбара - число первых слотов инвентаря,
-- выбираемых колесом мыши и цифровыми клавишами. По умолчанию - `hotbar-size`
-- из `config/defaults.toml` (10). Не сохраняется в мире.
-- Возвращает / устанавливает размер хотбара - число первых слотов инвентаря игрока,
-- доступных для выбора. player.set_selected_slot берёт индекс по модулю этого числа,
-- а при уменьшении размера выбранный слот сдвигается в допустимый диапазон.
-- По умолчанию - `hotbar-size` из `config/defaults.toml` (10), в мире не сохраняется.
-- На клиенте эти слоты показывает хотбар, они выбираются колесом мыши и цифровыми клавишами.
player.get_hotbar_size(playerid: int) -> int
player.set_hotbar_size(playerid: int, size: int)

View file

@ -219,6 +219,8 @@
> [!WARNING]
> Слоты без привязки к инвентарю не будут отображаться. Под приязкой к инвентарю понимается связь UI элемента inventory с инвентарём по id. Которая может быть явно создана через `inventory_ui.inventory = inventory_id`. [(см ui.md)](scripting/ui.md#инвентарь-inventory)
Пак может заменить экран инвентаря игрока и хотбар своими макетами через ключи `inventory-layout` (по умолчанию `"core:inventory"`) и `hotbar-layout` в `config/defaults.toml`. Корневой элемент такого макета - `inventory`, он привязывается к инвентарю игрока. Макет хотбара ставится внизу по центру экрана, если у него нет `position-func`.
## Одиночный слот - *slot*
Элемент должен находиться внутри `inventory` элемента, без посредников.