Merge branch 'main' into worldwide-refactor

This commit is contained in:
MihailRis 2024-04-15 02:19:47 +03:00
commit 4a32b33bf3
2 changed files with 47 additions and 0 deletions

View File

@ -13,6 +13,30 @@ load_script("packid:scripts/script_name.lua") -- load Lua script if not loaded y
load_script("packid:scripts/script_name.lua", true) -- load Lua script anyway
```
## *pack* library
```python
pack.is_installed(packid: str) -> bool
```
Check if specified pack is installed in the world
```python
pack.data_file(packid: str, filename: str) -> str
```
Returns data file path like `world:data/packid/filename`
and creates missing directories.
Use this function when saving pack settings or other data to the world.
Example:
```lua
file.write(pack.data_file(PACK_ID, "example.txt"), text)
```
For pack *containermod* will write text to the file `world:data/containermod/example.txt`
## *player* library

View File

@ -10,6 +10,29 @@ load_script("контентпак:scripts/имя_скрипта.lua", true) --
require "контентпак:имя_модуля" -- загружает lua модуль из папки modules (расширение не указывается)
```
## Библиотека pack
```python
pack.is_installed(packid: str) -> bool
```
Проверяет наличие установленного пака в мире
```python
pack.data_file(packid: str, filename: str) -> str
```
Возвращает путь к файлу данных по типу: `world:data/packid/filename`
и создает недостающие директории в пути.
Используйте эту функцию при сохранении настроек пака или иных данных в мире.
Пример:
```lua
file.write(pack.data_file(PACK_ID, "example.txt"), text)
```
Для пака *containermod* запишет текст в файл `world:data/containermod/example.txt`
## Библиотека player
```python
player.get_pos(playerid: int) -> number, number, number