///////////////////////////////////////////////////////////////////////////////
-MapgenSinglenode::MapgenSinglenode(int mapgenid, MapgenParams *params) {
+MapgenSinglenode::MapgenSinglenode(int mapgenid,
+ MapgenParams *params, EmergeManager *emerge)
+{
flags = params->flags;
+
+ INodeDefManager *ndef = emerge->ndef;
+
+ c_node = ndef->getId("mapgen_singlenode");
+ if (c_node == CONTENT_IGNORE)
+ c_node = CONTENT_AIR;
}
// Area of central chunk
v3s16 node_min = blockpos_min*MAP_BLOCKSIZE;
v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
-
- content_t c_node = ndef->getId("mapgen_singlenode");
- if (c_node == CONTENT_IGNORE)
- c_node = CONTENT_AIR;
MapNode n_node(c_node);
class MapgenSinglenode : public Mapgen {
public:
u32 flags;
+ content_t c_node;
- MapgenSinglenode(int mapgenid, MapgenParams *params);
+ MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge);
~MapgenSinglenode();
void makeChunk(BlockMakeData *data);
struct MapgenFactorySinglenode : public MapgenFactory {
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
- return new MapgenSinglenode(mgid, params);
+ return new MapgenSinglenode(mgid, params, emerge);
};
MapgenSpecificParams *createMapgenParams() {
np_trees = &sp->np_trees;
np_apple_trees = &sp->np_apple_trees;
+ //// Create noise objects
noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Y);
noise_terrain_higher = new Noise(&sp->np_terrain_higher, seed, csize.X, csize.Y);
noise_steepness = new Noise(&sp->np_steepness, seed, csize.X, csize.Y);
noise_mud = new Noise(&sp->np_mud, seed, csize.X, csize.Y);
noise_beach = new Noise(&sp->np_beach, seed, csize.X, csize.Y);
noise_biome = new Noise(&sp->np_biome, seed, csize.X, csize.Y);
+
+ //// Resolve nodes to be used
+ INodeDefManager *ndef = emerge->ndef;
+
+ c_stone = ndef->getId("mapgen_stone");
+ c_dirt = ndef->getId("mapgen_dirt");
+ c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass");
+ c_sand = ndef->getId("mapgen_sand");
+ c_water_source = ndef->getId("mapgen_water_source");
+ c_lava_source = ndef->getId("mapgen_lava_source");
+ c_gravel = ndef->getId("mapgen_gravel");
+ c_cobble = ndef->getId("mapgen_cobble");
+ c_desert_sand = ndef->getId("mapgen_desert_sand");
+ c_desert_stone = ndef->getId("mapgen_desert_stone");
+ c_mossycobble = ndef->getId("mapgen_mossycobble");
+ c_sandbrick = ndef->getId("mapgen_sandstonebrick");
+ c_stair_cobble = ndef->getId("mapgen_stair_cobble");
+ c_stair_sandstone = ndef->getId("mapgen_stair_sandstone");
+ if (c_desert_sand == CONTENT_IGNORE)
+ c_desert_sand = c_sand;
+ if (c_desert_stone == CONTENT_IGNORE)
+ c_desert_stone = c_stone;
+ if (c_mossycobble == CONTENT_IGNORE)
+ c_mossycobble = c_cobble;
+ if (c_sandbrick == CONTENT_IGNORE)
+ c_sandbrick = c_desert_stone;
+ if (c_stair_cobble == CONTENT_IGNORE)
+ c_stair_cobble = c_cobble;
+ if (c_stair_sandstone == CONTENT_IGNORE)
+ c_stair_sandstone = c_sandbrick;
}
// Make some noise
calculateNoise();
- c_stone = ndef->getId("mapgen_stone");
- c_dirt = ndef->getId("mapgen_dirt");
- c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass");
- c_sand = ndef->getId("mapgen_sand");
- c_water_source = ndef->getId("mapgen_water_source");
- c_lava_source = ndef->getId("mapgen_lava_source");
- c_gravel = ndef->getId("mapgen_gravel");
- c_cobble = ndef->getId("mapgen_cobble");
- c_desert_sand = ndef->getId("mapgen_desert_sand");
- c_desert_stone = ndef->getId("mapgen_desert_stone");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sandbrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_stair_sandstone = ndef->getId("mapgen_stair_sandstone");
- if (c_desert_sand == CONTENT_IGNORE)
- c_desert_sand = c_sand;
- if (c_desert_stone == CONTENT_IGNORE)
- c_desert_stone = c_stone;
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
- if (c_sandbrick == CONTENT_IGNORE)
- c_sandbrick = c_desert_stone;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_stair_sandstone == CONTENT_IGNORE)
- c_stair_sandstone = c_sandbrick;
-
// Maximum height of the stone surface and obstacles.
// This is used to guide the cave generation
s16 stone_surface_max_y;
this->csize = v3s16(1, 1, 1) * params->chunksize * MAP_BLOCKSIZE;
- // amount of elements to skip for the next index
- // for noise/height/biome maps (not vmanip)
+ //// amount of elements to skip for the next index
+ //// for noise/height/biome maps (not vmanip)
this->ystride = csize.X;
this->zstride = csize.X * csize.Y;
MapgenV7Params *sp = (MapgenV7Params *)params->sparams;
- // Terrain noise
+ //// Terrain noise
noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Z);
noise_terrain_alt = new Noise(&sp->np_terrain_alt, seed, csize.X, csize.Z);
noise_terrain_persist = new Noise(&sp->np_terrain_persist, seed, csize.X, csize.Z);
noise_mount_height = new Noise(&sp->np_mount_height, seed, csize.X, csize.Z);
noise_ridge_uwater = new Noise(&sp->np_ridge_uwater, seed, csize.X, csize.Z);
- // 3d terrain noise
+ //// 3d terrain noise
noise_mountain = new Noise(&sp->np_mountain, seed, csize.X, csize.Y, csize.Z);
noise_ridge = new Noise(&sp->np_ridge, seed, csize.X, csize.Y, csize.Z);
- // Biome noise
+ //// Biome noise
noise_heat = new Noise(bmgr->np_heat, seed, csize.X, csize.Z);
- noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+ noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+
+ //// Resolve nodes to be used
+ INodeDefManager *ndef = emerge->ndef;
+
+ c_stone = ndef->getId("mapgen_stone");
+ c_dirt = ndef->getId("mapgen_dirt");
+ c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass");
+ c_sand = ndef->getId("mapgen_sand");
+ c_water_source = ndef->getId("mapgen_water_source");
+ c_lava_source = ndef->getId("mapgen_lava_source");
+ c_ice = ndef->getId("default:ice");
+ if (c_ice == CONTENT_IGNORE)
+ c_ice = CONTENT_AIR;
}
blockseed = emerge->getBlockSeed(full_node_min); //////use getBlockSeed2()!
- c_stone = ndef->getId("mapgen_stone");
- c_dirt = ndef->getId("mapgen_dirt");
- c_dirt_with_grass = ndef->getId("mapgen_dirt_with_grass");
- c_sand = ndef->getId("mapgen_sand");
- c_water_source = ndef->getId("mapgen_water_source");
- c_lava_source = ndef->getId("mapgen_lava_source");
- c_ice = ndef->getId("default:ice");
- if (c_ice == CONTENT_IGNORE)
- c_ice = CONTENT_AIR;
-
// Make some noise
calculateNoise();