mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-13 19:58:21 +00:00
Fix some models not disassembling into bricks (#1041)
This commit is contained in:
parent
801ca69778
commit
a26f29baf6
@ -390,19 +390,22 @@ void Item::DisassembleModel() {
|
|||||||
const auto componentId = table->GetByIDAndType(GetLot(), eReplicaComponentType::RENDER);
|
const auto componentId = table->GetByIDAndType(GetLot(), eReplicaComponentType::RENDER);
|
||||||
|
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||||
"SELECT render_asset FROM RenderComponent WHERE id = ?;");
|
"SELECT render_asset, LXFMLFolder FROM RenderComponent WHERE id = ?;");
|
||||||
query.bind(1, (int)componentId);
|
query.bind(1, (int)componentId);
|
||||||
|
|
||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
if (result.eof()) {
|
if (result.eof() || result.fieldIsNull(0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string renderAsset = result.fieldIsNull(0) ? "" : std::string(result.getStringField(0));
|
std::string renderAsset = std::string(result.getStringField(0));
|
||||||
std::vector<std::string> renderAssetSplit = GeneralUtils::SplitString(renderAsset, '\\');
|
std::string lxfmlFolderName = std::string(result.getStringField(1));
|
||||||
|
|
||||||
std::string lxfmlPath = "BrickModels/" + GeneralUtils::SplitString(renderAssetSplit.back(), '.').at(0) + ".lxfml";
|
std::vector<std::string> renderAssetSplit = GeneralUtils::SplitString(renderAsset, '\\');
|
||||||
|
if (renderAssetSplit.size() == 0) return;
|
||||||
|
|
||||||
|
std::string lxfmlPath = "BrickModels/" + lxfmlFolderName + "/" + GeneralUtils::SplitString(renderAssetSplit.back(), '.').at(0) + ".lxfml";
|
||||||
auto buffer = Game::assetManager->GetFileAsBuffer(lxfmlPath.c_str());
|
auto buffer = Game::assetManager->GetFileAsBuffer(lxfmlPath.c_str());
|
||||||
|
|
||||||
if (!buffer.m_Success) {
|
if (!buffer.m_Success) {
|
||||||
|
Loading…
Reference in New Issue
Block a user