3 Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4 Copyright (C) 2015-2017 paramat
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef MG_DECORATION_HEADER
22 #define MG_DECORATION_HEADER
24 #include "util/cpp11_container.h"
40 #define DECO_PLACE_CENTER_X 0x01
41 #define DECO_PLACE_CENTER_Y 0x02
42 #define DECO_PLACE_CENTER_Z 0x04
43 #define DECO_USE_NOISE 0x08
44 #define DECO_FORCE_PLACEMENT 0x10
45 #define DECO_LIQUID_SURFACE 0x20
47 extern FlagDesc flagdesc_deco[];
58 CutoffData(s16 x, s16 y, s16 z, s16 h) {
65 class Decoration : public ObjDef, public NodeResolver {
68 virtual ~Decoration();
70 virtual void resolveNodeNames();
72 bool canPlaceDecoration(MMVManip *vm, v3s16 p);
73 size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
74 //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
76 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p) = 0;
77 virtual int getHeight() = 0;
81 std::vector<content_t> c_place_on;
87 std::vector<content_t> c_spawnby;
90 UNORDERED_SET<u8> biomes;
91 //std::list<CutoffData> cutoffs;
95 class DecoSimple : public Decoration {
97 virtual void resolveNodeNames();
98 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p);
99 virtual int getHeight();
101 std::vector<content_t> c_decos;
107 class DecoSchematic : public Decoration {
111 virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p);
112 virtual int getHeight();
115 Schematic *schematic;
120 class DecoLSystem : public Decoration {
122 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
126 class DecorationManager : public ObjDefManager {
128 DecorationManager(IGameDef *gamedef);
129 virtual ~DecorationManager() {}
131 const char *getObjectTitle() const
136 static Decoration *create(DecorationType type)
140 return new DecoSimple;
142 return new DecoSchematic;
144 // return new DecoLSystem;
150 size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);