Merge branch 'MihailRis:main' into main
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
To work with the command interpreter, use the **console** library.
|
||||
|
||||
When sending a command via the standard console (core:console layout):
|
||||
1. the `allow-cheats` rule is checked
|
||||
2. the `player`, `pos.x|y|z`, `entity.id`, `entity.selected` variables are automatically set.
|
||||
3. the command handler is called - console.submit or the default one.
|
||||
|
||||
The default handler calls console.execute, passing the result to the console.log call.
|
||||
|
||||
## Commands creation
|
||||
|
||||
To create a console command, use the following function:
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
# Documentation
|
||||
|
||||
Documentation for in-development version 0.26.
|
||||
|
||||
[Documentation for stable release 0.25.x.](https://github.com/MihailRis/VoxelEngine-Cpp/blob/release-0.25/doc/en/main-page.md)
|
||||
Documentation for release 0.26.
|
||||
|
||||
## Sections
|
||||
|
||||
|
||||
@@ -62,6 +62,17 @@ gui.escape_markup(
|
||||
|
||||
Escapes markup in text.
|
||||
|
||||
```lua
|
||||
gui.alert(
|
||||
-- message (not automatically translated, use gui.str(...))
|
||||
message: str,
|
||||
-- function called on close
|
||||
on_ok: function() -> nil
|
||||
)
|
||||
```
|
||||
|
||||
Displays a message box. **Non-blocking**.
|
||||
|
||||
```lua
|
||||
gui.confirm(
|
||||
-- message (does not translate automatically, use gui.str(...))
|
||||
@@ -78,7 +89,7 @@ gui.confirm(
|
||||
)
|
||||
```
|
||||
|
||||
Requests confirmation from the user for an action. **Does not** stop code execution.
|
||||
Requests confirmation from the user for an action. **Non-blocking**.
|
||||
|
||||
```lua
|
||||
gui.load_document(
|
||||
|
||||
@@ -96,6 +96,15 @@ player.get_spawnpoint(playerid: int) -> number, number, number
|
||||
|
||||
Spawn point setter and getter
|
||||
|
||||
```lua
|
||||
player.is_suspended(pid: int) -> bool
|
||||
player.set_suspended(pid: int, suspended: bool)
|
||||
```
|
||||
|
||||
Setter and getter for the player's suspended status.
|
||||
|
||||
When suspended, the entity is deleted and the player is disabled from the world simulation.
|
||||
|
||||
```lua
|
||||
player.set_name(playerid: int, name: str)
|
||||
player.get_name(playerid: int) -> str
|
||||
|
||||
@@ -18,7 +18,7 @@ Creates a rule. If a handler is specified, returns the id for deletion.
|
||||
> Rules that have not been created can be used, but resetting via rules.reset will result in setting the value to nil.
|
||||
|
||||
```lua
|
||||
rules.listen(
|
||||
rules.listen(
|
||||
-- rule name
|
||||
name: str,
|
||||
-- value change handler function
|
||||
|
||||
@@ -49,10 +49,11 @@ world.is_night() -> bool
|
||||
world.count_chunks() -> int
|
||||
|
||||
-- Returns the compressed chunk data to send.
|
||||
-- If the chunk is not loaded, returns the saved data.
|
||||
-- Currently includes:
|
||||
-- 1. Voxel data (id and state)
|
||||
-- 2. Voxel metadata (fields)
|
||||
world.get_chunk_data(x: int, z: int) -> Bytearray
|
||||
world.get_chunk_data(x: int, z: int) -> Bytearray or nil
|
||||
|
||||
-- Modifies the chunk based on the compressed data.
|
||||
-- Returns true if the chunk exists.
|
||||
@@ -61,4 +62,12 @@ world.set_chunk_data(
|
||||
-- compressed chunk data
|
||||
data: Bytearray
|
||||
) -> bool
|
||||
|
||||
-- Saves chunk data to region.
|
||||
-- Changes will be written to file only on world save.
|
||||
world.save_chunk_data(
|
||||
x: int, z: int,
|
||||
-- compressed chunk data
|
||||
data: Bytearray
|
||||
)
|
||||
```
|
||||
|
||||
@@ -26,6 +26,9 @@ entity:get_uid() -> int
|
||||
entity:get_component(name: str) -> component or nil
|
||||
-- Checks for the presence of a component by name
|
||||
entity:has_component(name: str) -> bool
|
||||
|
||||
-- Enables/disables the component
|
||||
entity:set_enabled(name: str, enable: bool)
|
||||
```
|
||||
|
||||
## Built-in components
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
Для работы с командным интерпретатором предоставляется библиотека **console**.
|
||||
|
||||
При отправке команды через стандартную консоль (макет core:console):
|
||||
1. проверяется правило `allow-cheats`
|
||||
2. автоматически устанавливаются переменные `player`, `pos.x|y|z`, `entity.id`, `entity.selected`.
|
||||
3. вызывается обработчик команд - console.submit или по-умолчанию.
|
||||
|
||||
Обработчик по-умолчанию вызывает console.execute, передавая результат в вызов console.log.
|
||||
|
||||
## Создание команд
|
||||
|
||||
Для создания команды консоли используется следующая функция:
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
# Документация
|
||||
|
||||
Документация разрабатываемой версии 0.26.
|
||||
|
||||
[Документация стабильной версии 0.25.x.](https://github.com/MihailRis/VoxelEngine-Cpp/blob/release-0.25/doc/ru/main-page.md)
|
||||
Документация версии 0.26.
|
||||
|
||||
## Разделы
|
||||
|
||||
|
||||
@@ -59,6 +59,17 @@ gui.escape_markup(
|
||||
|
||||
Экранирует разметку в тексте.
|
||||
|
||||
```lua
|
||||
gui.alert(
|
||||
-- сообщение (не переводится автоматически, используйте gui.str(...))
|
||||
message: str,
|
||||
-- функция, вызываемая при закрытии
|
||||
on_ok: function() -> nil
|
||||
)
|
||||
```
|
||||
|
||||
Выводит окно с сообщением. **Не** останавливает выполнение кода.
|
||||
|
||||
```lua
|
||||
gui.confirm(
|
||||
-- сообщение (не переводится автоматически, используйте gui.str(...))
|
||||
|
||||
@@ -96,6 +96,15 @@ player.get_spawnpoint(playerid: int) -> number, number, number
|
||||
|
||||
Сеттер и геттер точки спавна игрока
|
||||
|
||||
```lua
|
||||
player.is_suspended(pid: int) -> bool
|
||||
player.set_suspended(pid: int, suspended: bool)
|
||||
```
|
||||
|
||||
Сеттер и геттер статуса "заморозки" игрока.
|
||||
|
||||
При "заморозке" удаляется сущность, а игрок выключается из симуляции мира.
|
||||
|
||||
```lua
|
||||
player.set_name(playerid: int, name: str)
|
||||
player.get_name(playerid: int) -> str
|
||||
|
||||
@@ -48,10 +48,11 @@ world.is_night() -> bool
|
||||
world.count_chunks() -> int
|
||||
|
||||
-- Возвращает сжатые данные чанка для отправки.
|
||||
-- Если чанк не загружен, возвращает сохранённые данные.
|
||||
-- На данный момент включает:
|
||||
-- 1. Данные вокселей (id и состояние)
|
||||
-- 2. Метаданные (поля) вокселей
|
||||
world.get_chunk_data(x: int, z: int) -> Bytearray
|
||||
world.get_chunk_data(x: int, z: int) -> Bytearray или nil
|
||||
|
||||
-- Изменяет чанк на основе сжатых данных.
|
||||
-- Возвращает true если чанк существует.
|
||||
@@ -60,4 +61,12 @@ world.set_chunk_data(
|
||||
-- сжатые данные чанка
|
||||
data: Bytearray
|
||||
) -> bool
|
||||
|
||||
-- Сохраняет данные чанка в регион.
|
||||
-- Изменения будет записаны в файл только после сохранения мира.
|
||||
world.save_chunk_data(
|
||||
x: int, z: int,
|
||||
-- сжатые данные чанка
|
||||
data: Bytearray
|
||||
)
|
||||
```
|
||||
|
||||
@@ -26,6 +26,9 @@ entity:get_uid() -> int
|
||||
entity:get_component(name: str) -> компонент или nil
|
||||
-- Проверяет наличие компонента по имени
|
||||
entity:has_component(name: str) -> bool
|
||||
|
||||
-- Включает/выключает компонент по имени
|
||||
entity:set_enabled(name: str, enable: bool)
|
||||
```
|
||||
|
||||
## Встроенные компоненты
|
||||
|
||||
Reference in New Issue
Block a user