add GeneratorDef
This commit is contained in:
parent
cae314bc36
commit
5fa6b14f05
@ -10,6 +10,7 @@
|
|||||||
#include "objects/EntityDef.hpp"
|
#include "objects/EntityDef.hpp"
|
||||||
#include "objects/rigging.hpp"
|
#include "objects/rigging.hpp"
|
||||||
#include "voxels/Block.hpp"
|
#include "voxels/Block.hpp"
|
||||||
|
#include "world/generator/GeneratorDef.hpp"
|
||||||
#include "ContentPack.hpp"
|
#include "ContentPack.hpp"
|
||||||
|
|
||||||
ContentIndices::ContentIndices(
|
ContentIndices::ContentIndices(
|
||||||
@ -28,6 +29,7 @@ Content::Content(
|
|||||||
ContentUnitDefs<Block> blocks,
|
ContentUnitDefs<Block> blocks,
|
||||||
ContentUnitDefs<ItemDef> items,
|
ContentUnitDefs<ItemDef> items,
|
||||||
ContentUnitDefs<EntityDef> entities,
|
ContentUnitDefs<EntityDef> entities,
|
||||||
|
ContentUnitDefs<GeneratorDef> generators,
|
||||||
UptrsMap<std::string, ContentPackRuntime> packs,
|
UptrsMap<std::string, ContentPackRuntime> packs,
|
||||||
UptrsMap<std::string, BlockMaterial> blockMaterials,
|
UptrsMap<std::string, BlockMaterial> blockMaterials,
|
||||||
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
|
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
|
||||||
@ -40,6 +42,7 @@ Content::Content(
|
|||||||
blocks(std::move(blocks)),
|
blocks(std::move(blocks)),
|
||||||
items(std::move(items)),
|
items(std::move(items)),
|
||||||
entities(std::move(entities)),
|
entities(std::move(entities)),
|
||||||
|
generators(std::move(generators)),
|
||||||
drawGroups(std::move(drawGroups)) {
|
drawGroups(std::move(drawGroups)) {
|
||||||
for (size_t i = 0; i < RESOURCE_TYPES_COUNT; i++) {
|
for (size_t i = 0; i < RESOURCE_TYPES_COUNT; i++) {
|
||||||
this->resourceIndices[i] = std::move(resourceIndices[i]);
|
this->resourceIndices[i] = std::move(resourceIndices[i]);
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class Block;
|
|||||||
struct BlockMaterial;
|
struct BlockMaterial;
|
||||||
struct ItemDef;
|
struct ItemDef;
|
||||||
struct EntityDef;
|
struct EntityDef;
|
||||||
|
struct GeneratorDef;
|
||||||
|
|
||||||
namespace rigging {
|
namespace rigging {
|
||||||
class SkeletonConfig;
|
class SkeletonConfig;
|
||||||
@ -34,6 +35,8 @@ constexpr const char* ContentType_name(ContentType type) {
|
|||||||
return "item";
|
return "item";
|
||||||
case ContentType::ENTITY:
|
case ContentType::ENTITY:
|
||||||
return "entity";
|
return "entity";
|
||||||
|
case ContentType::GENERATOR:
|
||||||
|
return "generator";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
@ -65,14 +68,6 @@ public:
|
|||||||
return defs[id];
|
return defs[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[deprecated]]
|
|
||||||
inline T* getWriteable(blockid_t id) const { // TODO: remove
|
|
||||||
if (id >= defs.size()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return defs[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const T& require(blockid_t id) const {
|
inline const T& require(blockid_t id) const {
|
||||||
return *defs.at(id);
|
return *defs.at(id);
|
||||||
}
|
}
|
||||||
@ -197,6 +192,7 @@ public:
|
|||||||
ContentUnitDefs<Block> blocks;
|
ContentUnitDefs<Block> blocks;
|
||||||
ContentUnitDefs<ItemDef> items;
|
ContentUnitDefs<ItemDef> items;
|
||||||
ContentUnitDefs<EntityDef> entities;
|
ContentUnitDefs<EntityDef> entities;
|
||||||
|
ContentUnitDefs<GeneratorDef> generators;
|
||||||
std::unique_ptr<DrawGroups> const drawGroups;
|
std::unique_ptr<DrawGroups> const drawGroups;
|
||||||
ResourceIndicesSet resourceIndices {};
|
ResourceIndicesSet resourceIndices {};
|
||||||
|
|
||||||
@ -206,6 +202,7 @@ public:
|
|||||||
ContentUnitDefs<Block> blocks,
|
ContentUnitDefs<Block> blocks,
|
||||||
ContentUnitDefs<ItemDef> items,
|
ContentUnitDefs<ItemDef> items,
|
||||||
ContentUnitDefs<EntityDef> entities,
|
ContentUnitDefs<EntityDef> entities,
|
||||||
|
ContentUnitDefs<GeneratorDef> generators,
|
||||||
UptrsMap<std::string, ContentPackRuntime> packs,
|
UptrsMap<std::string, ContentPackRuntime> packs,
|
||||||
UptrsMap<std::string, BlockMaterial> blockMaterials,
|
UptrsMap<std::string, BlockMaterial> blockMaterials,
|
||||||
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
|
UptrsMap<std::string, rigging::SkeletonConfig> skeletons,
|
||||||
|
|||||||
@ -72,6 +72,7 @@ std::unique_ptr<Content> ContentBuilder::build() {
|
|||||||
blocks.build(),
|
blocks.build(),
|
||||||
items.build(),
|
items.build(),
|
||||||
entities.build(),
|
entities.build(),
|
||||||
|
generators.build(),
|
||||||
std::move(packs),
|
std::move(packs),
|
||||||
std::move(blockMaterials),
|
std::move(blockMaterials),
|
||||||
std::move(skeletons),
|
std::move(skeletons),
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "ContentPack.hpp"
|
#include "ContentPack.hpp"
|
||||||
#include "items/ItemDef.hpp"
|
#include "items/ItemDef.hpp"
|
||||||
#include "objects/EntityDef.hpp"
|
#include "objects/EntityDef.hpp"
|
||||||
|
#include "world/generator/GeneratorDef.hpp"
|
||||||
#include "voxels/Block.hpp"
|
#include "voxels/Block.hpp"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -59,6 +60,7 @@ public:
|
|||||||
ContentUnitBuilder<Block> blocks {allNames, ContentType::BLOCK};
|
ContentUnitBuilder<Block> blocks {allNames, ContentType::BLOCK};
|
||||||
ContentUnitBuilder<ItemDef> items {allNames, ContentType::ITEM};
|
ContentUnitBuilder<ItemDef> items {allNames, ContentType::ITEM};
|
||||||
ContentUnitBuilder<EntityDef> entities {allNames, ContentType::ENTITY};
|
ContentUnitBuilder<EntityDef> entities {allNames, ContentType::ENTITY};
|
||||||
|
ContentUnitBuilder<GeneratorDef> generators {allNames, ContentType::GENERATOR};
|
||||||
ResourceIndicesSet resourceIndices {};
|
ResourceIndicesSet resourceIndices {};
|
||||||
|
|
||||||
~ContentBuilder();
|
~ContentBuilder();
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
class Content;
|
class Content;
|
||||||
class ContentPackRuntime;
|
class ContentPackRuntime;
|
||||||
|
|
||||||
enum class ContentType { NONE, BLOCK, ITEM, ENTITY };
|
enum class ContentType { NONE, BLOCK, ITEM, ENTITY, GENERATOR };
|
||||||
|
|
||||||
enum class ResourceType : size_t { CAMERA, LAST = CAMERA };
|
enum class ResourceType : size_t { CAMERA, LAST = CAMERA };
|
||||||
|
|
||||||
|
|||||||
10
src/world/generator/GeneratorDef.hpp
Normal file
10
src/world/generator/GeneratorDef.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "typedefs.hpp"
|
||||||
|
|
||||||
|
struct GeneratorDef {
|
||||||
|
std::string name;
|
||||||
|
scriptenv env;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user