mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
Content menu, content-pack dependencies
This commit is contained in:
parent
abc3e47feb
commit
c57b2d0de3
25 changed files with 230 additions and 21 deletions
|
|
@ -453,13 +453,18 @@ void WorldFiles::write(const World* world, const Content* content) {
|
|||
}
|
||||
|
||||
void WorldFiles::writePacks(const World* world) {
|
||||
auto packsFile = getPacksFile();
|
||||
if (fs::is_regular_file(packsFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& packs = world->getPacks();
|
||||
std::stringstream ss;
|
||||
ss << "# autogenerated; do not modify\n";
|
||||
for (const auto& pack : packs) {
|
||||
ss << pack.id << "\n";
|
||||
}
|
||||
files::write_string(getPacksFile(), ss.str());
|
||||
files::write_string(packsFile, ss.str());
|
||||
}
|
||||
|
||||
void WorldFiles::writeIndices(const ContentIndices* indices) {
|
||||
|
|
@ -574,3 +579,15 @@ bool WorldFiles::readPlayer(Player* player) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldFiles::addPack(const std::string& id) {
|
||||
auto packs = files::read_list(getPacksFile());
|
||||
packs.push_back(id);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "# autogenerated; do not modify\n";
|
||||
for (const auto& pack : packs) {
|
||||
ss << pack << "\n";
|
||||
}
|
||||
files::write_string(getPacksFile(), ss.str());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue