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
39 #define DECO_PLACE_CENTER_X 0x01
40 #define DECO_PLACE_CENTER_Y 0x02
41 #define DECO_PLACE_CENTER_Z 0x04
42 #define DECO_USE_NOISE 0x08
43 #define DECO_FORCE_PLACEMENT 0x10
45 extern FlagDesc flagdesc_deco[];
56 CutoffData(s16 x, s16 y, s16 z, s16 h) {
63 class Decoration : public ObjDef, public NodeResolver {
66 virtual ~Decoration();
68 virtual void resolveNodeNames();
70 size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
71 //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
73 virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) = 0;
74 virtual int getHeight() = 0;
78 std::vector<content_t> c_place_on;
86 //std::list<CutoffData> cutoffs;
87 //JMutex cutoff_mutex;
90 class DecoSimple : public Decoration {
92 virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p);
93 bool canPlaceDecoration(MMVManip *vm, v3s16 p);
94 virtual int getHeight();
96 virtual void resolveNodeNames();
98 std::vector<content_t> c_decos;
99 std::vector<content_t> c_spawnby;
105 class DecoSchematic : public Decoration {
109 virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p);
110 virtual int getHeight();
113 Schematic *schematic;
118 class DecoLSystem : public Decoration {
120 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
124 class DecorationManager : public ObjDefManager {
126 DecorationManager(IGameDef *gamedef);
127 virtual ~DecorationManager() {}
129 const char *getObjectTitle() const
134 static Decoration *create(DecorationType type)
138 return new DecoSimple;
140 return new DecoSchematic;
142 // return new DecoLSystem;
148 size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);