Fixes + add a gsc func
This commit is contained in:
parent
3c4c239cfe
commit
aa8e030ed2
@ -146,7 +146,10 @@ namespace fastfiles
|
||||
{
|
||||
if (priority == mods::zone_priority::post_common)
|
||||
{
|
||||
try_add_zone(zones, allocator, "mod", true);
|
||||
if (mods::get_mod().has_value())
|
||||
{
|
||||
try_add_zone(zones, allocator, "mod", true);
|
||||
}
|
||||
}
|
||||
|
||||
const auto mod_zones = mods::get_mod_zones();
|
||||
|
@ -484,6 +484,31 @@ namespace gsc
|
||||
table.clear();
|
||||
});
|
||||
});
|
||||
|
||||
add_function("assetexists", []()
|
||||
{
|
||||
const std::string type = game::Scr_GetString(0);
|
||||
const auto name = game::Scr_GetString(1);
|
||||
|
||||
game::XAssetType type_index = game::ASSET_TYPE_COUNT;
|
||||
|
||||
for (auto i = 0; i < ::game::XAssetType::ASSET_TYPE_COUNT; i++)
|
||||
{
|
||||
if (type == ::game::g_assetNames[i])
|
||||
{
|
||||
type_index = static_cast<game::XAssetType>(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (type_index == game::ASSET_TYPE_COUNT)
|
||||
{
|
||||
return scr_error(true, "invalid asset type %s", type.data());
|
||||
}
|
||||
|
||||
const auto result = game::DB_XAssetExists(type_index, name) &&
|
||||
!game::DB_IsXAssetDefault(type_index, name);
|
||||
game::Scr_AddInt(result);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user