3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MAPGENV6_HEADER
21 #define MAPGENV6_HEADER
25 #define AVERAGE_MUD_AMOUNT 4
33 extern NoiseParams nparams_v6_def_terrain_base;
34 extern NoiseParams nparams_v6_def_terrain_higher;
35 extern NoiseParams nparams_v6_def_steepness;
36 extern NoiseParams nparams_v6_def_height_select;
37 extern NoiseParams nparams_v6_def_mud;
38 extern NoiseParams nparams_v6_def_beach;
39 extern NoiseParams nparams_v6_def_biome;
40 extern NoiseParams nparams_v6_def_cave;
41 extern NoiseParams nparams_v6_def_humidity;
42 extern NoiseParams nparams_v6_def_trees;
43 extern NoiseParams nparams_v6_def_apple_trees;
45 struct MapgenV6Params : public MapgenParams {
48 NoiseParams np_terrain_base;
49 NoiseParams np_terrain_higher;
50 NoiseParams np_steepness;
51 NoiseParams np_height_select;
56 NoiseParams np_humidity;
58 NoiseParams np_apple_trees;
63 np_terrain_base = nparams_v6_def_terrain_base;
64 np_terrain_higher = nparams_v6_def_terrain_higher;
65 np_steepness = nparams_v6_def_steepness;
66 np_height_select = nparams_v6_def_height_select;
67 np_mud = nparams_v6_def_mud;
68 np_beach = nparams_v6_def_beach;
69 np_biome = nparams_v6_def_biome;
70 np_cave = nparams_v6_def_cave;
71 np_humidity = nparams_v6_def_humidity;
72 np_trees = nparams_v6_def_trees;
73 np_apple_trees = nparams_v6_def_apple_trees;
78 bool readParams(Settings *settings);
79 void writeParams(Settings *settings);
82 class MapgenV6 : public Mapgen {
84 EmergeManager *emerge;
94 v3s16 central_area_size;
97 Noise *noise_terrain_base;
98 Noise *noise_terrain_higher;
99 Noise *noise_steepness;
100 Noise *noise_height_select;
104 NoiseParams *np_cave;
105 NoiseParams *np_humidity;
106 NoiseParams *np_trees;
107 NoiseParams *np_apple_trees;
113 content_t c_dirt_with_grass;
115 content_t c_water_source;
116 content_t c_lava_source;
119 content_t c_desert_sand;
120 content_t c_desert_stone;
122 content_t c_mossycobble;
123 content_t c_sandbrick;
124 content_t c_stair_cobble;
125 content_t c_stair_sandstone;
127 MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge);
130 void makeChunk(BlockMakeData *data);
131 int getGroundLevelAtPoint(v2s16 p);
133 float baseTerrainLevel(float terrain_base, float terrain_higher,
134 float steepness, float height_select);
135 virtual float baseTerrainLevelFromNoise(v2s16 p);
136 virtual float baseTerrainLevelFromMap(v2s16 p);
137 virtual float baseTerrainLevelFromMap(int index);
139 s16 find_stone_level(v2s16 p2d);
140 bool block_is_underground(u64 seed, v3s16 blockpos);
141 s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
143 float getHumidity(v2s16 p);
144 float getTreeAmount(v2s16 p);
145 bool getHaveAppleTree(v2s16 p);
146 float getMudAmount(v2s16 p);
147 virtual float getMudAmount(int index);
148 bool getHaveBeach(v2s16 p);
149 bool getHaveBeach(int index);
150 BiomeType getBiome(v2s16 p);
151 BiomeType getBiome(int index, v2s16 p);
153 u32 get_blockseed(u64 seed, v3s16 p);
155 virtual void calculateNoise();
156 int generateGround();
158 void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos);
159 void addDirtGravelBlobs();
161 void placeTreesAndJungleGrass();
162 virtual void generateCaves(int max_stone_y);
163 virtual void generateExperimental() {}
166 struct MapgenFactoryV6 : public MapgenFactory {
167 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
168 return new MapgenV6(mgid, (MapgenV6Params *)params, emerge);
171 MapgenParams *createMapgenParams() {
172 return new MapgenV6Params();