Weapon dumping (waiting for IW4OF support)

This commit is contained in:
Louvenarde 2023-10-21 19:37:39 +02:00
parent 01a1567173
commit cc895c766e
2 changed files with 23 additions and 0 deletions

View File

@ -782,4 +782,26 @@ namespace Assets
buffer->popBlock();
}
IWeapon::IWeapon()
{
Components::Command::Add("dumpweapon", [](const Components::Command::Params* params)
{
if (params->size() < 2) return;
std::string weapon = params->get(1);
const auto header = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_WEAPON, weapon.data());
if (header.data)
{
Components::ZoneBuilder::RefreshExporterWorkDirectory();
Components::ZoneBuilder::GetExporter()->write(Game::XAssetType::ASSET_TYPE_WEAPON, header.data);
}
else
{
Components::Logger::Print("Could not find weapon {}!\n", weapon);
}
}
);
}
}

View File

@ -6,6 +6,7 @@ namespace Assets
{
public:
Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_WEAPON; }
IWeapon();
void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;