update pack.get_info
This commit is contained in:
parent
e976b2078e
commit
e2f6c263e7
@ -76,14 +76,14 @@ pack.get_base_packs() -> strings array
|
||||
|
||||
Returns the id of all base packages (non-removeable)
|
||||
|
||||
```python
|
||||
```lua
|
||||
pack.get_info(packid: str) -> {
|
||||
id: str,
|
||||
title: str,
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
icon: str, -- not available in headless mode
|
||||
dependencies: optional strings array
|
||||
}
|
||||
```
|
||||
|
||||
@ -70,7 +70,7 @@ pack.get_info(packid: str) -> {
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
icon: str, -- отсутствует в headless режиме
|
||||
dependencies: опциональный массив строк
|
||||
}
|
||||
```
|
||||
|
||||
@ -81,25 +81,18 @@ static int l_pack_get_info(
|
||||
lua::pushstring(L, pack.version);
|
||||
lua::setfield(L, "version");
|
||||
|
||||
auto assets = engine->getAssets();
|
||||
std::string icon = pack.id + ".icon";
|
||||
if (engine->isHeadless()) {
|
||||
if (fs::exists(pack.folder / fs::path("icon.png"))) {
|
||||
icon = pack.folder.u8string() + "/icon.png";
|
||||
} else {
|
||||
icon = "gui/no_icon";
|
||||
}
|
||||
} else {
|
||||
if (!engine->isHeadless()) {
|
||||
auto assets = engine->getAssets();
|
||||
std::string icon = pack.id + ".icon";
|
||||
if (!AssetsLoader::loadExternalTexture(
|
||||
assets, icon, {pack.folder / fs::path("icon.png")}
|
||||
)) {
|
||||
icon = "gui/no_icon";
|
||||
}
|
||||
lua::pushstring(L, icon);
|
||||
lua::setfield(L, "icon");
|
||||
}
|
||||
|
||||
lua::pushstring(L, icon);
|
||||
lua::setfield(L, "icon");
|
||||
|
||||
if (!pack.dependencies.empty()) {
|
||||
lua::createtable(L, pack.dependencies.size(), 0);
|
||||
for (size_t i = 0; i < pack.dependencies.size(); i++) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user