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.
20 #ifndef MG_DECORATION_HEADER
21 #define MG_DECORATION_HEADER
28 class ManualMapVoxelManipulator;
38 #define DECO_PLACE_CENTER_X 0x01
39 #define DECO_PLACE_CENTER_Y 0x02
40 #define DECO_PLACE_CENTER_Z 0x04
41 #define DECO_USE_NOISE 0x08
43 extern FlagDesc flagdesc_deco[];
54 CutoffData(s16 x, s16 y, s16 z, s16 h) {
61 class Decoration : public GenElement, public NodeResolver {
63 INodeDefManager *ndef;
67 std::vector<content_t> c_place_on;
75 //std::list<CutoffData> cutoffs;
76 //JMutex cutoff_mutex;
79 virtual ~Decoration();
81 virtual void resolveNodeNames(NodeResolveInfo *nri);
83 size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
84 //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
86 virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
87 s16 max_y, v3s16 p) = 0;
88 virtual int getHeight() = 0;
91 class DecoSimple : public Decoration {
93 std::vector<content_t> c_decos;
94 std::vector<content_t> c_spawnby;
99 virtual void resolveNodeNames(NodeResolveInfo *nri);
101 bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p);
102 virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
104 virtual int getHeight();
107 class DecoSchematic : public Decoration {
110 Schematic *schematic;
111 std::string filename;
113 virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
115 virtual int getHeight();
120 class DecoLSystem : public Decoration {
122 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
126 class DecorationManager : public GenElementManager {
128 static const char *ELEMENT_TITLE;
129 static const size_t ELEMENT_LIMIT = 0x10000;
131 DecorationManager(IGameDef *gamedef);
132 ~DecorationManager() {}
134 Decoration *create(int type)
138 return new DecoSimple;
140 return new DecoSchematic;
142 // return new DecoLSystem;
150 size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);