update doc/*/scripting/events.md

This commit is contained in:
MihailRis 2025-11-18 22:18:56 +03:00
parent f721731ecc
commit b1312c354d
2 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,10 @@
Callbacks specified in block script. Callbacks specified in block script.
> [!WARNING]
> events such as on_block_tick, on_block_present, and on_block_removed
> can cause performance issues if used carelessly or excessively.
```lua ```lua
function on_placed(x, y, z, playerid) function on_placed(x, y, z, playerid)
``` ```
@ -62,6 +66,12 @@ The call occurs within a time period that may depend on the event queue load.
Under light load, it occurs during the first tick interval of the block. Under light load, it occurs during the first tick interval of the block.
on_block_tick is not called until the event is called. on_block_tick is not called until the event is called.
```lua
function on_block_removed(x, y, z)
```
Called when chunk containing the block unloads.
```lua ```lua
function on_player_tick(playerid: int, tps: int) function on_player_tick(playerid: int, tps: int)
``` ```

View File

@ -4,6 +4,10 @@
Функции для обработки событий, прописываемые в скрипте блока. Функции для обработки событий, прописываемые в скрипте блока.
> [!WARNING]
> Mass events such as on_block_tick, on_block_present, and on_block_removed,
> if used carelessly or excessively, can lead to performance issues.
```lua ```lua
function on_placed(x, y, z, playerid) function on_placed(x, y, z, playerid)
``` ```
@ -62,6 +66,12 @@ function on_block_present(x, y, z)
При малой нагрузке происходит в течение первого такта блока (tick-interval). При малой нагрузке происходит в течение первого такта блока (tick-interval).
До вызова события on_block_tick не вызывается. До вызова события on_block_tick не вызывается.
```lua
function on_block_removed(x, y, z)
```
Вызывается при выгрузке чанка, в котором находится блок.
```lua ```lua
function on_player_tick(playerid: int, tps: int) function on_player_tick(playerid: int, tps: int)
``` ```