update doc/*/scripting/events.md
This commit is contained in:
parent
f721731ecc
commit
b1312c354d
@ -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)
|
||||||
```
|
```
|
||||||
|
|||||||
@ -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)
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user