From 40e2814f9e830b114cb091ecdb1b4e327ab1fc42 Mon Sep 17 00:00:00 2001 From: ostermine Date: Fri, 16 Oct 2026 14:06:08 +0300 Subject: [PATCH] docs: describe hotbar keys by topic and hotbar size from server side --- doc/en/content-packs.md | 3 --- doc/en/scripting/builtins/libplayer.md | 2 +- doc/en/xml-ui-layouts.md | 2 ++ doc/ru/content-packs.md | 3 --- doc/ru/scripting/builtins/libplayer.md | 8 +++++--- doc/ru/xml-ui-layouts.md | 2 ++ 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/en/content-packs.md b/doc/en/content-packs.md index 47a568379..48ec57e6d 100644 --- a/doc/en/content-packs.md +++ b/doc/en/content-packs.md @@ -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 diff --git a/doc/en/scripting/builtins/libplayer.md b/doc/en/scripting/builtins/libplayer.md index c1b9b9745..8005e1713 100644 --- a/doc/en/scripting/builtins/libplayer.md +++ b/doc/en/scripting/builtins/libplayer.md @@ -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 diff --git a/doc/en/xml-ui-layouts.md b/doc/en/xml-ui-layouts.md index 8d04ff4ec..0c7e92576 100644 --- a/doc/en/xml-ui-layouts.md +++ b/doc/en/xml-ui-layouts.md @@ -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*. diff --git a/doc/ru/content-packs.md b/doc/ru/content-packs.md index ebd9ea236..4ab002104 100644 --- a/doc/ru/content-packs.md +++ b/doc/ru/content-packs.md @@ -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/` - вспомогательные файлы внутренних инструментов отладки diff --git a/doc/ru/scripting/builtins/libplayer.md b/doc/ru/scripting/builtins/libplayer.md index 096d8237a..425a1ed1d 100644 --- a/doc/ru/scripting/builtins/libplayer.md +++ b/doc/ru/scripting/builtins/libplayer.md @@ -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) diff --git a/doc/ru/xml-ui-layouts.md b/doc/ru/xml-ui-layouts.md index 94f396495..a3792052a 100644 --- a/doc/ru/xml-ui-layouts.md +++ b/doc/ru/xml-ui-layouts.md @@ -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` элемента, без посредников.