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
23 #include "util/cpp11_container.h"
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
44 #define DECO_LIQUID_SURFACE 0x20
46 extern FlagDesc flagdesc_deco[];
57 CutoffData(s16 x, s16 y, s16 z, s16 h) {
64 class Decoration : public ObjDef, public NodeResolver {
67 virtual ~Decoration();
69 virtual void resolveNodeNames();
71 bool canPlaceDecoration(MMVManip *vm, v3s16 p);
72 size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
73 //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
75 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p) = 0;
76 virtual int getHeight() = 0;
80 std::vector<content_t> c_place_on;
86 std::vector<content_t> c_spawnby;
89 UNORDERED_SET<u8> biomes;
90 //std::list<CutoffData> cutoffs;
94 class DecoSimple : public Decoration {
96 virtual void resolveNodeNames();
97 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p);
98 virtual int getHeight();
100 std::vector<content_t> c_decos;
106 class DecoSchematic : public Decoration {
110 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p);
111 virtual int getHeight();
114 Schematic *schematic;
119 class DecoLSystem : public Decoration {
121 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
125 class DecorationManager : public ObjDefManager {
127 DecorationManager(IGameDef *gamedef);
128 virtual ~DecorationManager() {}
130 const char *getObjectTitle() const
135 static Decoration *create(DecorationType type)
139 return new DecoSimple;
141 return new DecoSchematic;
143 // return new DecoLSystem;
149 size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);