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.
23 #include "irrlichttypes_extrabloated.h"
24 #include "util/container.h" // UniqueQueue
31 /////////////////// Mapgen flags
34 #define MG_DUNGEONS 0x04
35 #define MGV6_JUNGLES 0x08
36 #define MGV6_BIOME_BLEND 0x10
39 /////////////////// Ore generation flags
40 // Use absolute value of height to determine ore placement
41 #define OREFLAG_ABSHEIGHT 0x01
42 // Use 3d noise to get density of ore placement, instead of just the position
43 #define OREFLAG_DENSITY 0x02 // not yet implemented
44 // For claylike ore types, place ore if the number of surrounding
45 // nodes isn't the specified node
46 #define OREFLAG_NODEISNT 0x04 // not yet implemented
48 extern FlagDesc flagdesc_mapgen[];
49 extern FlagDesc flagdesc_ore[];
51 class BiomeDefManager;
55 class ManualMapVoxelManipulator;
56 class VoxelManipulator;
57 class INodeDefManager;
73 flags = MG_TREES | MG_CAVES | MGV6_BIOME_BLEND;
76 virtual bool readParams(Settings *settings) = 0;
77 virtual void writeParams(Settings *settings) {};
86 ManualMapVoxelManipulator *vm;
87 INodeDefManager *ndef;
89 void updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax);
90 void setLighting(v3s16 nmin, v3s16 nmax, u8 light);
91 void lightSpread(VoxelArea &a, v3s16 p, u8 light);
92 void calcLighting(v3s16 nmin, v3s16 nmax);
93 void calcLightingOld(v3s16 nmin, v3s16 nmax);
95 virtual void makeChunk(BlockMakeData *data) {};
96 virtual int getGroundLevelAtPoint(v2s16 p) = 0;
98 //Legacy functions for Farmesh (pending removal)
99 static bool get_have_beach(u64 seed, v2s16 p2d);
100 static double tree_amount_2d(u64 seed, v2s16 p);
101 static s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
104 struct MapgenFactory {
105 virtual Mapgen *createMapgen(int mgid, MapgenParams *params,
106 EmergeManager *emerge) = 0;
107 virtual MapgenParams *createMapgenParams() = 0;
116 #define ORE_RANGE_ACTUAL 1
117 #define ORE_RANGE_MIRROR 2
121 std::string ore_name;
122 std::string wherein_name;
125 content_t wherein; // the node to be replaced
126 u32 clust_scarcity; // ore cluster has a 1-in-clust_scarcity chance of appearing at a node
127 s16 clust_num_ores; // how many ore nodes are in a chunk
128 s16 clust_size; // how large (in nodes) a chunk of ore is
131 u32 flags; // attributes for this ore
132 float nthresh; // threshhold for noise at which an ore is placed
133 NoiseParams *np; // noise for distribution of clusters (NULL for uniform scattering)
137 ore = CONTENT_IGNORE;
138 wherein = CONTENT_IGNORE;
143 void resolveNodeNames(INodeDefManager *ndef);
144 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) = 0;
147 class OreScatter : public Ore {
148 void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
151 class OreSheet : public Ore {
152 void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
155 Ore *createOre(OreType type);