From 51002b1629c69adb0053bc36d3667d2b790e5c21 Mon Sep 17 00:00:00 2001 From: paramat Date: Wed, 6 Sep 2017 22:20:09 +0100 Subject: Schematic decorations: Add 'place_offset_y' placement parameter For precise control of schematic vertical position relative to the 'place_on' node. Avoids workarounds that add empty nodes to a schematic and therefore reduce performance. Also remove long-unused decoration cutoff code. --- src/mg_decoration.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/mg_decoration.h') diff --git a/src/mg_decoration.h b/src/mg_decoration.h index fd6e89e79..01e063ca2 100644 --- a/src/mg_decoration.h +++ b/src/mg_decoration.h @@ -46,21 +46,6 @@ enum DecorationType { extern FlagDesc flagdesc_deco[]; -#if 0 -struct CutoffData { - VoxelArea a; - Decoration *deco; - //v3s16 p; - //v3s16 size; - //s16 height; - - CutoffData(s16 x, s16 y, s16 z, s16 h) { - p = v3s16(x, y, z); - height = h; - } -}; -#endif - class Decoration : public ObjDef, public NodeResolver { public: Decoration() = default; @@ -71,7 +56,6 @@ public: bool canPlaceDecoration(MMVManip *vm, v3s16 p); size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax, s16 deco_zero_level); - //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p) = 0; virtual int getHeight() = 0; @@ -90,6 +74,7 @@ public: std::unordered_set biomes; }; + class DecoSimple : public Decoration { public: virtual void resolveNodeNames(); @@ -102,6 +87,7 @@ public: u8 deco_param2; }; + class DecoSchematic : public Decoration { public: DecoSchematic() = default; @@ -110,6 +96,7 @@ public: virtual int getHeight(); Rotation rotation; + s16 place_offset_y = 0; Schematic *schematic = nullptr; }; @@ -121,6 +108,7 @@ public: }; */ + class DecorationManager : public ObjDefManager { public: DecorationManager(IGameDef *gamedef); -- cgit v1.2.3