3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
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 "util/cpp11_container.h"
32 /////////////////// Ore generation flags
34 #define OREFLAG_ABSHEIGHT 0x01
35 #define OREFLAG_PUFF_CLIFFS 0x02
36 #define OREFLAG_PUFF_ADDITIVE 0x04
37 #define OREFLAG_USE_NOISE 0x08
39 #define ORE_RANGE_ACTUAL 1
40 #define ORE_RANGE_MIRROR 2
50 extern FlagDesc flagdesc_ore[];
52 class Ore : public ObjDef, public NodeResolver {
54 static const bool NEEDS_NOISE = false;
56 content_t c_ore; // the node to place
57 std::vector<content_t> c_wherein; // the nodes to be placed in
58 u32 clust_scarcity; // ore cluster has a 1-in-clust_scarcity chance of appearing at a node
59 s16 clust_num_ores; // how many ore nodes are in a chunk
60 s16 clust_size; // how large (in nodes) a chunk of ore is
63 u8 ore_param2; // to set node-specific attributes
64 u32 flags; // attributes for this ore
65 float nthresh; // threshold for noise at which an ore is placed
66 NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering)
68 UNORDERED_SET<u8> biomes;
73 virtual void resolveNodeNames();
75 size_t placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
76 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
77 v3s16 nmin, v3s16 nmax, u8 *biomemap) = 0;
80 class OreScatter : public Ore {
82 static const bool NEEDS_NOISE = false;
84 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
85 v3s16 nmin, v3s16 nmax, u8 *biomemap);
88 class OreSheet : public Ore {
90 static const bool NEEDS_NOISE = true;
92 u16 column_height_min;
93 u16 column_height_max;
94 float column_midpoint_factor;
96 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
97 v3s16 nmin, v3s16 nmax, u8 *biomemap);
100 class OrePuff : public Ore {
102 static const bool NEEDS_NOISE = true;
104 NoiseParams np_puff_top;
105 NoiseParams np_puff_bottom;
106 Noise *noise_puff_top;
107 Noise *noise_puff_bottom;
112 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
113 v3s16 nmin, v3s16 nmax, u8 *biomemap);
116 class OreBlob : public Ore {
118 static const bool NEEDS_NOISE = true;
120 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
121 v3s16 nmin, v3s16 nmax, u8 *biomemap);
124 class OreVein : public Ore {
126 static const bool NEEDS_NOISE = true;
134 virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
135 v3s16 nmin, v3s16 nmax, u8 *biomemap);
138 class OreManager : public ObjDefManager {
140 OreManager(IGameDef *gamedef);
141 virtual ~OreManager() {}
143 const char *getObjectTitle() const
148 static Ore *create(OreType type)
152 return new OreScatter;
168 size_t placeAllOres(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);