From c18fe8aa45fa731a134c454dd16e1111742ca936 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Fri, 18 Sep 2020 00:20:50 +0200 Subject: Adding Generator For Single Piece Structures (#4830) * the beginning of a magnificent work - added basic files and classes without functionality * fixed checkstyle * added imports * moved imports * - Adding SinglePieceStructureGen - Adding a cPrefabChestStructure to generate Chests with contents - Added the options and calls to the ComposableGenerator * moved Globals to .h file * removed the chest thingy from the code (for now) * Update SinglePieceStructureGen.cpp * readded whitespace * renamed to SinglePieceStructuresGen for consistency added new classes to test * fixed small things (mostly style and cleanup) removed loottables * added small changes suggested by madmaxoft * small change to documentation * added check for allowed biomes * check only the biome of the origin position * fixed error on IsBiomeAllowed * added new cubesets * updated structures for with sponging * updated biome names * updated metadata to prevent crashing removed debug output * updated structures with sponging * added sponging to deserterWell to make it disappear in sand * small change in meta * rename DesertTemple -> DesertPyramid * minor style changes Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Alexander Harkness --- src/Generating/ComposableGenerator.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Generating/ComposableGenerator.cpp') diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index 5dd54a497..7c891f5fa 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -27,6 +27,7 @@ #include "Noise3DGenerator.h" #include "Ravines.h" #include "RoughRavines.h" +#include "SinglePieceStructuresGen.h" #include "VillageGen.h" #include "PieceStructuresGen.h" @@ -217,6 +218,7 @@ void cComposableGenerator::InitializeGeneratorDefaults(cIniFile & a_IniFile, eDi "Mineshafts, " "Trees, " "Villages, " + "SinglePieceStructures: JungleTemple|WitchHut|DesertPyramid|DesertWell, " "TallGrass, " "SprinkleFoliage, " "Ice, " @@ -606,6 +608,20 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) GridSize, MaxOffset ))); } + else if (NoCaseCompare(finisher, "SinglePieceStructures") == 0) + { + if (split.size() < 2) + { + LOGWARNING("The SinglePieceStructures generator needs the structures to use. Example: \"SinglePieceStructures: DesertPyramid\"."); + continue; + } + + auto Gen = std::make_shared(m_Seed); + if (Gen->Initialize(split[1], seaLevel, m_BiomeGen, m_CompositedHeightCache)) + { + m_FinishGens.push_back(Gen); + } + } else if (NoCaseCompare(finisher, "SoulsandRims") == 0) { m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSoulsandRims(m_Seed))); -- cgit v1.2.3