class CaveV6 {
public:
MapgenV6 *mg;
- ManualMapVoxelManipulator *vm;
+ MMVManip *vm;
INodeDefManager *ndef;
s16 min_tunnel_diameter;
s16 max_stone_y;
v3s16 node_min;
v3s16 node_max;
-
+
v3f orp; // starting point, relative to caved space
v3s16 of; // absolute coordinates of caved space
v3s16 ar; // allowed route area
s16 rs; // tunnel radius size
v3f main_direction;
-
+
s16 route_y_min;
s16 route_y_max;
-
+
PseudoRandom *ps;
PseudoRandom *ps2;
-
+
content_t c_water_source;
content_t c_lava_source;
-
+
int water_level;
CaveV6() {}
class CaveV7 {
public:
MapgenV7 *mg;
- ManualMapVoxelManipulator *vm;
+ MMVManip *vm;
INodeDefManager *ndef;
NoiseParams *np_caveliquids;
s16 max_stone_y;
v3s16 node_min;
v3s16 node_max;
-
+
v3f orp; // starting point, relative to caved space
v3s16 of; // absolute coordinates of caved space
v3s16 ar; // allowed route area
s16 rs; // tunnel radius size
v3f main_direction;
-
+
s16 route_y_min;
s16 route_y_max;
-
+
PseudoRandom *ps;
-
+
content_t c_water_source;
content_t c_lava_source;
content_t c_ice;
-
+
int water_level;
CaveV7() {}
#define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\
VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
-class ManualMapVoxelManipulator;
+class MMVManip;
class INodeDefManager;
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
class DungeonGen {
public:
- ManualMapVoxelManipulator *vm;
+ MMVManip *vm;
Mapgen *mg;
u32 blockseed;
PseudoRandom random;
class SchematicManager;
struct BlockMakeData {
- ManualMapVoxelManipulator *vmanip;
+ MMVManip *vmanip;
u64 seed;
v3s16 blockpos_min;
v3s16 blockpos_max;
v3s16 bigarea_blocks_min = blockpos_min - extra_borders;
v3s16 bigarea_blocks_max = blockpos_max + extra_borders;
- data->vmanip = new ManualMapVoxelManipulator(this);
+ data->vmanip = new MMVManip(this);
//data->vmanip->setMap(this);
// Add the area
if (!mg)
return;
- ManualMapVoxelManipulator *vm = mg->vm;
+ MMVManip *vm = mg->vm;
if (!vm)
return;
out<<"ServerMap: ";
}
-ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map):
+MMVManip::MMVManip(Map *map):
VoxelManipulator(),
m_is_dirty(false),
m_create_area(false),
{
}
-ManualMapVoxelManipulator::~ManualMapVoxelManipulator()
+MMVManip::~MMVManip()
{
}
-void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
- v3s16 blockpos_max, bool load_if_inexistent)
+void MMVManip::initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max,
+ bool load_if_inexistent)
{
TimeTaker timer1("initialEmerge", &emerge_time);
m_is_dirty = false;
}
-void ManualMapVoxelManipulator::blitBackAll(
- std::map<v3s16, MapBlock*> *modified_blocks,
- bool overwrite_generated)
+void MMVManip::blitBackAll(std::map<v3s16, MapBlock*> *modified_blocks,
+ bool overwrite_generated)
{
if(m_area.getExtent() == v3s16(0,0,0))
return;
#define VMANIP_BLOCK_DATA_INEXIST 1
#define VMANIP_BLOCK_CONTAINS_CIGNORE 2
-class ManualMapVoxelManipulator : public VoxelManipulator
+class MMVManip : public VoxelManipulator
{
public:
- ManualMapVoxelManipulator(Map *map);
- virtual ~ManualMapVoxelManipulator();
+ MMVManip(Map *map);
+ virtual ~MMVManip();
virtual void clear()
{
#define MG_LIGHT 0x10
class Settings;
-class ManualMapVoxelManipulator;
+class MMVManip;
class INodeDefManager;
extern FlagDesc flagdesc_mapgen[];
class Biome;
class EmergeManager;
class MapBlock;
-class ManualMapVoxelManipulator;
class VoxelManipulator;
struct BlockMakeData;
class VoxelArea;
bool generating;
int id;
- ManualMapVoxelManipulator *vm;
+ MMVManip *vm;
INodeDefManager *ndef;
u32 blockseed;
#include "mg_biome.h"
#include "gamedef.h"
#include "nodedef.h"
-#include "map.h" //for ManualMapVoxelManipulator
+#include "map.h" //for MMVManip
#include "log.h"
#include "util/numeric.h"
#include "main.h"
}
-bool DecoSimple::canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p)
+bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p)
{
// Don't bother if there aren't any decorations to place
if (c_decos.size() == 0)
}
-size_t DecoSimple::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
- s16 max_y, v3s16 p)
+size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
{
if (!canPlaceDecoration(vm, p))
return 0;
///////////////////////////////////////////////////////////////////////////////
-size_t DecoSchematic::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
- s16 max_y, v3s16 p)
+size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
{
if (flags & DECO_PLACE_CENTER_X)
p.X -= (schematic->size.X + 1) / 2;
struct NoiseParams;
class Mapgen;
-class ManualMapVoxelManipulator;
+class MMVManip;
class PseudoRandom;
class Schematic;
size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
//size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
- virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
- s16 max_y, v3s16 p) = 0;
+ virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) = 0;
virtual int getHeight() = 0;
};
virtual void resolveNodeNames(NodeResolveInfo *nri);
- bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p);
- virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
- s16 max_y, v3s16 p);
+ bool canPlaceDecoration(MMVManip *vm, v3s16 p);
+ virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p);
virtual int getHeight();
};
Schematic *schematic;
std::string filename;
- virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
- s16 max_y, v3s16 p);
+ virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p);
virtual int getHeight();
};
///////////////////////////////////////////////////////////////////////////////
-void OreScatter::generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax)
+void OreScatter::generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax)
{
PseudoRandom pr(blockseed);
MapNode n_ore(c_ore, 0, ore_param2);
///////////////////////////////////////////////////////////////////////////////
-void OreSheet::generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax)
+void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax)
{
PseudoRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2);
///////////////////////////////////////////////////////////////////////////////
-void OreBlob::generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax)
+void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax)
{
PseudoRandom pr(blockseed + 2404);
MapNode n_ore(c_ore, 0, ore_param2);
}
-void OreVein::generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax)
+void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax)
{
PseudoRandom pr(blockseed + 520);
MapNode n_ore(c_ore, 0, ore_param2);
struct NoiseParams;
class Noise;
class Mapgen;
-class ManualMapVoxelManipulator;
+class MMVManip;
/////////////////// Ore generation flags
virtual void resolveNodeNames(NodeResolveInfo *nri);
size_t placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
- virtual void generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax) = 0;
+ virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax) = 0;
};
class OreScatter : public Ore {
public:
static const bool NEEDS_NOISE = false;
- virtual void generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax);
+ virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax);
};
class OreSheet : public Ore {
public:
static const bool NEEDS_NOISE = true;
- virtual void generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax);
+ virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax);
};
class OreBlob : public Ore {
public:
static const bool NEEDS_NOISE = true;
- virtual void generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax);
+ virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax);
};
class OreVein : public Ore {
virtual ~OreVein();
- virtual void generate(ManualMapVoxelManipulator *vm, int mapseed,
- u32 blockseed, v3s16 nmin, v3s16 nmax);
+ virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
+ v3s16 nmin, v3s16 nmax);
};
class OreManager : public GenElementManager {
}
-void Schematic::blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
- Rotation rot, bool force_placement, INodeDefManager *ndef)
+void Schematic::blitToVManip(v3s16 p, MMVManip *vm, Rotation rot,
+ bool force_placement, INodeDefManager *ndef)
{
int xstride = 1;
int ystride = size.X;
}
-void Schematic::placeStructure(Map *map, v3s16 p, u32 flags,
- Rotation rot, bool force_placement, INodeDefManager *ndef)
+void Schematic::placeStructure(Map *map, v3s16 p, u32 flags, Rotation rot,
+ bool force_placement, INodeDefManager *ndef)
{
assert(schemdata != NULL);
- ManualMapVoxelManipulator *vm = new ManualMapVoxelManipulator(map);
+ MMVManip *vm = new MMVManip(map);
if (rot == ROTATE_RAND)
rot = (Rotation)myrand_range(ROTATE_0, ROTATE_270);
}
-bool Schematic::loadSchematicFromFile(const char *filename,
- INodeDefManager *ndef, std::map<std::string, std::string> &replace_names)
+bool Schematic::loadSchematicFromFile(const char *filename, INodeDefManager *ndef,
+ std::map<std::string, std::string> &replace_names)
{
content_t cignore = CONTENT_IGNORE;
bool have_cignore = false;
bool Schematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2)
{
- ManualMapVoxelManipulator *vm = new ManualMapVoxelManipulator(map);
+ MMVManip *vm = new MMVManip(map);
v3s16 bp1 = getNodeBlockPos(p1);
v3s16 bp2 = getNodeBlockPos(p2);
class Map;
class Mapgen;
-class ManualMapVoxelManipulator;
+class MMVManip;
class PseudoRandom;
class NodeResolver;
void updateContentIds();
- void blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
+ void blitToVManip(v3s16 p, MMVManip *vm,
Rotation rot, bool force_placement, INodeDefManager *ndef);
bool loadSchematicFromFile(const char *filename, INodeDefManager *ndef,
switch (mgobj) {
case MGOBJ_VMANIP: {
- ManualMapVoxelManipulator *vm = mg->vm;
+ MMVManip *vm = mg->vm;
// VoxelManip object
LuaVoxelManip *o = new LuaVoxelManip(vm, true);
int LuaVoxelManip::l_read_from_map(lua_State *L)
{
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
v3s16 bp1 = getNodeBlockPos(read_v3s16(L, 2));
v3s16 bp2 = getNodeBlockPos(read_v3s16(L, 3));
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume();
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
if (!lua_istable(L, 2))
return 0;
int LuaVoxelManip::l_write_to_map(lua_State *L)
{
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
vm->blitBackAll(&o->modified_blocks);
Map *map = &(env->getMap());
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
Mapgen mg;
mg.vm = vm;
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
EmergeManager *emerge = getServer(L)->getEmergeManager();
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE;
v3s16 fpmin = vm->m_area.MinEdge;
light = (getintfield_default(L, 2, "day", 0) & 0x0F);
light |= (getintfield_default(L, 2, "night", 0) & 0x0F) << 4;
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE;
v3s16 pmin = lua_istable(L, 3) ? read_v3s16(L, 3) : vm->m_area.MinEdge + yblock;
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume();
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
if (!lua_istable(L, 2))
return 0;
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume();
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
if (!lua_istable(L, 2))
return 0;
NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- ManualMapVoxelManipulator *vm = o->vm;
+ MMVManip *vm = o->vm;
lua_pushboolean(L, vm->m_is_dirty);
return 2;
}
-LuaVoxelManip::LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool is_mg_vm)
+LuaVoxelManip::LuaVoxelManip(MMVManip *mmvm, bool is_mg_vm)
{
this->vm = mmvm;
this->is_mapgen_vm = is_mg_vm;
LuaVoxelManip::LuaVoxelManip(Map *map)
{
- this->vm = new ManualMapVoxelManipulator(map);
+ this->vm = new MMVManip(map);
this->is_mapgen_vm = false;
}
LuaVoxelManip::LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2)
{
- this->vm = new ManualMapVoxelManipulator(map);
+ this->vm = new MMVManip(map);
this->is_mapgen_vm = false;
v3s16 bp1 = getNodeBlockPos(p1);
class Map;
class MapBlock;
-class ManualMapVoxelManipulator;
+class MMVManip;
/*
VoxelManip
static int l_get_emerged_area(lua_State *L);
public:
- ManualMapVoxelManipulator *vm;
+ MMVManip *vm;
- LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool is_mapgen_vm);
+ LuaVoxelManip(MMVManip *mmvm, bool is_mapgen_vm);
LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2);
LuaVoxelManip(Map *map);
~LuaVoxelManip();
namespace treegen
{
-void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
+void make_tree(MMVManip &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef, int seed)
{
/*
{
ServerMap *map = &env->getServerMap();
std::map<v3s16, MapBlock*> modified_blocks;
- ManualMapVoxelManipulator vmanip(map);
+ MMVManip vmanip(map);
v3s16 tree_blockp = getNodeBlockPos(p0);
treegen::error e;
}
//L-System tree generator
-treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef,
+treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition)
{
MapNode dirtnode(ndef->getId("mapgen_dirt"));
return SUCCESS;
}
-void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+void tree_node_placement(MMVManip &vmanip, v3f p0,
MapNode node)
{
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
vmanip.m_data[vmanip.m_area.index(p1)] = node;
}
-void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode;
}
-void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+void tree_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps ,TreeDef &tree_definition)
{
MapNode leavesnode=tree_definition.leavesnode;
u32 vi = vmanip.m_area.index(p1);
if(vmanip.m_data[vi].getContent() != CONTENT_AIR
&& vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
- return;
+ return;
if (tree_definition.fruit_chance>0)
{
if (ps.range(1,100) > 100-tree_definition.fruit_chance)
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
}
-void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+void tree_single_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition)
{
MapNode leavesnode=tree_definition.leavesnode;
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
}
-void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+void tree_fruit_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
v3s16 p2 = p0 + v3s16(x,-1,z);
u32 vi1 = vmanip.m_area.index(p1);
u32 vi2 = vmanip.m_area.index(p2);
-
+
if (vmanip.m_area.contains(p2) &&
vmanip.m_data[vi2].getContent() == CONTENT_AIR)
vmanip.m_data[vi2] = treenode;
#include <matrix4.h>
#include "noise.h"
-class ManualMapVoxelManipulator;
+class MMVManip;
class INodeDefManager;
class ServerEnvironment;
};
// Add default tree
- void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
+ void make_tree(MMVManip &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef, int seed);
// Add jungle tree
void make_jungletree(VoxelManipulator &vmanip, v3s16 p0,
INodeDefManager *ndef, int seed);
// Add L-Systems tree (used by engine)
- treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef,
+ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition);
// Spawn L-systems tree from LUA
treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition);
// L-System tree gen helper functions
- void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+ void tree_node_placement(MMVManip &vmanip, v3f p0,
MapNode node);
- void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+ void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition);
- void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+ void tree_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition);
- void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+ void tree_single_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition);
- void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
+ void tree_fruit_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition);
irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle, v3f axis);