update doc/*/scripting/events.md
This commit is contained in:
parent
90fc559234
commit
918cb8aa32
@ -126,6 +126,34 @@ function on_block_interact(blockid, x, y, z, playerid) -> bool
|
||||
|
||||
Called on block RMB click interaction. Prevents block placing if **true** returned.
|
||||
|
||||
### Chunk Events (world.lua)
|
||||
|
||||
```lua
|
||||
function on_chunk_present(x: int, z: int, loaded: bool)
|
||||
```
|
||||
|
||||
Called after a chunk is generated/loaded. If a previously saved chunk is loaded, `loaded` will be true.
|
||||
|
||||
```lua
|
||||
function on_chunk_remove(x: int, z: int)
|
||||
```
|
||||
|
||||
Called when a chunk is unloaded from the world.
|
||||
|
||||
### Inventory Events (world.lua)
|
||||
|
||||
```lua
|
||||
function on_inventory_open(invid: int, playerid: int)
|
||||
```
|
||||
|
||||
Called when the inventory is opened. If the inventory was not opened directly by the player, playerid will be -1.
|
||||
|
||||
```lua
|
||||
function on_inventory_closed(invid: int, playerid: int)
|
||||
```
|
||||
|
||||
Called when the inventory is closed.
|
||||
|
||||
## Layout events
|
||||
|
||||
Script *layouts/layout_name.xml.lua* events.
|
||||
|
||||
@ -126,6 +126,35 @@ function on_block_interact(blockid, x, y, z, playerid) -> bool
|
||||
|
||||
Вызывается при нажатии на блок ПКМ. Предотвращает установку блоков, если возвращает `true`
|
||||
|
||||
### События чанков (world.lua)
|
||||
|
||||
```lua
|
||||
function on_chunk_present(x: int, z: int, loaded: bool)
|
||||
```
|
||||
|
||||
Вызывается после генерации/загрузки чанка. В случае загрузки ранее сохраненного чанка `loaded` будет истинным.
|
||||
|
||||
```lua
|
||||
function on_chunk_remove(x: int, z: int)
|
||||
```
|
||||
|
||||
Вызывается при выгрузке чанка из мира.
|
||||
|
||||
### События инвентарей (world.lua)
|
||||
|
||||
```lua
|
||||
function on_inventory_open(invid: int, playerid: int)
|
||||
```
|
||||
|
||||
Вызывается при открытии инвентаря. Если инвентарь был открыт не напрямую игроком, playerid будет равен -1.
|
||||
|
||||
```lua
|
||||
function on_inventory_closed(invid: int, playerid: int)
|
||||
```
|
||||
|
||||
Вызывается при закрытии инвентаря.
|
||||
|
||||
|
||||
## События макета
|
||||
|
||||
События прописываются в файле `layouts/имя_макета.xml.lua`.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user