mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add Generator Element Management framework
Add BiomeManager, OreManager, DecorationManager, and SchematicManager
This commit is contained in:
parent
f25cc0dbae
commit
7616537bc0
22 changed files with 620 additions and 464 deletions
|
@ -30,11 +30,8 @@ class ManualMapVoxelManipulator;
|
|||
class PseudoRandom;
|
||||
class NodeResolver;
|
||||
|
||||
/////////////////// Decoration flags
|
||||
#define DECO_PLACE_CENTER_X 1
|
||||
#define DECO_PLACE_CENTER_Y 2
|
||||
#define DECO_PLACE_CENTER_Z 4
|
||||
#define DECO_SCHEM_CIDS_UPDATED 8
|
||||
/////////////////// Schematic flags
|
||||
#define SCHEM_CIDS_UPDATED 0x08
|
||||
|
||||
|
||||
#define MTSCHEM_FILE_SIGNATURE 0x4d54534d // 'MTSM'
|
||||
|
@ -44,42 +41,50 @@ class NodeResolver;
|
|||
#define MTSCHEM_PROB_NEVER 0x00
|
||||
#define MTSCHEM_PROB_ALWAYS 0xFF
|
||||
|
||||
extern FlagDesc flagdesc_deco_schematic[];
|
||||
|
||||
class DecoSchematic : public Decoration {
|
||||
class Schematic : public GenElement {
|
||||
public:
|
||||
std::string filename;
|
||||
|
||||
std::vector<content_t> c_nodes;
|
||||
|
||||
u32 flags;
|
||||
Rotation rotation;
|
||||
v3s16 size;
|
||||
MapNode *schematic;
|
||||
MapNode *schemdata;
|
||||
u8 *slice_probs;
|
||||
|
||||
DecoSchematic();
|
||||
~DecoSchematic();
|
||||
Schematic();
|
||||
~Schematic();
|
||||
|
||||
void updateContentIds();
|
||||
virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
|
||||
virtual int getHeight();
|
||||
virtual std::string getName();
|
||||
|
||||
void blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
|
||||
Rotation rot, bool force_placement);
|
||||
Rotation rot, bool force_placement, INodeDefManager *ndef);
|
||||
|
||||
bool loadSchematicFile(NodeResolver *resolver,
|
||||
bool loadSchematicFromFile(const char *filename, NodeResolver *resolver,
|
||||
std::map<std::string, std::string> &replace_names);
|
||||
void saveSchematicFile(INodeDefManager *ndef);
|
||||
|
||||
void saveSchematicToFile(const char *filename, INodeDefManager *ndef);
|
||||
bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2);
|
||||
void placeStructure(Map *map, v3s16 p, bool force_placement);
|
||||
|
||||
void placeStructure(Map *map, v3s16 p, u32 flags,
|
||||
Rotation rot, bool force_placement, INodeDefManager *nef);
|
||||
void applyProbabilities(v3s16 p0,
|
||||
std::vector<std::pair<v3s16, u8> > *plist,
|
||||
std::vector<std::pair<s16, u8> > *splist);
|
||||
};
|
||||
|
||||
class SchematicManager : public GenElementManager {
|
||||
public:
|
||||
static const char *ELEMENT_TITLE;
|
||||
static const size_t ELEMENT_LIMIT = 0x10000;
|
||||
|
||||
SchematicManager(IGameDef *gamedef) {}
|
||||
~SchematicManager() {}
|
||||
|
||||
Schematic *create(int type)
|
||||
{
|
||||
return new Schematic;
|
||||
}
|
||||
};
|
||||
|
||||
void build_nnlist_and_update_ids(MapNode *nodes, u32 nodecount,
|
||||
std::vector<content_t> *usednodes);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue