add 'player-entity' to defaults.toml

This commit is contained in:
MihailRis
2025-02-12 16:32:21 +03:00
parent f0c7bc6377
commit 3430e5cd6f
10 changed files with 34 additions and 11 deletions
+3 -1
View File
@@ -34,12 +34,14 @@ Content::Content(
UptrsMap<std::string, ContentPackRuntime> packs,
UptrsMap<std::string, BlockMaterial> blockMaterials,
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
ResourceIndicesSet resourceIndices
ResourceIndicesSet resourceIndices,
dv::value defaults
)
: indices(std::move(indices)),
packs(std::move(packs)),
blockMaterials(std::move(blockMaterials)),
skeletons(std::move(skeletons)),
defaults(std::move(defaults)),
blocks(std::move(blocks)),
items(std::move(items)),
entities(std::move(entities)),
+7 -1
View File
@@ -201,6 +201,7 @@ class Content {
UptrsMap<std::string, ContentPackRuntime> packs;
UptrsMap<std::string, BlockMaterial> blockMaterials;
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
dv::value defaults = nullptr;
public:
ContentUnitDefs<Block> blocks;
ContentUnitDefs<ItemDef> items;
@@ -219,7 +220,8 @@ public:
UptrsMap<std::string, ContentPackRuntime> packs,
UptrsMap<std::string, BlockMaterial> blockMaterials,
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
ResourceIndicesSet resourceIndices
ResourceIndicesSet resourceIndices,
dv::value defaults
);
~Content();
@@ -231,6 +233,10 @@ public:
return resourceIndices[static_cast<size_t>(type)];
}
inline const dv::value& getDefaults() const {
return defaults;
}
const rigging::SkeletonConfig* getSkeleton(const std::string& id) const;
const BlockMaterial* findBlockMaterial(const std::string& id) const;
const ContentPackRuntime* getPackRuntime(const std::string& id) const;
+2 -1
View File
@@ -84,7 +84,8 @@ std::unique_ptr<Content> ContentBuilder::build() {
std::move(packs),
std::move(blockMaterials),
std::move(skeletons),
std::move(resourceIndices)
std::move(resourceIndices),
std::move(defaults)
);
// Now, it's time to resolve foreign keys
+1
View File
@@ -73,6 +73,7 @@ public:
ContentUnitBuilder<EntityDef> entities {allNames, ContentType::ENTITY};
ContentUnitBuilder<GeneratorDef> generators {allNames, ContentType::GENERATOR};
ResourceIndicesSet resourceIndices {};
dv::value defaults = nullptr;
~ContentBuilder();
+5
View File
@@ -23,6 +23,7 @@
#include "data/dv_util.hpp"
#include "data/StructLayout.hpp"
#include "presets/ParticlesPreset.hpp"
#include "io/engine_paths.hpp"
namespace fs = std::filesystem;
using namespace data;
@@ -760,6 +761,10 @@ void ContentLoader::load() {
auto folder = pack->folder;
builder.defaults = paths.readCombinedObject(
EnginePaths::CONFIG_DEFAULTS.string()
);
// Load world generators
io::path generatorsDir = folder / "generators";
foreach_file(generatorsDir, [this](const io::path& file) {