Mapgen: Various fixes and improvements

Lua_api.txt: Document 'minetest.registered_biomes'
Minimal: Remove 'mapgen_air' alias
Cavegen: Add fallback node for 'mapgen_ice'
Dungeongen: Add fallback node for 'mapgen_river_water_source'
Mgv5: Remove unnecessary '#include util/directiontables.h'
Add missing 'this->'s in makeChunk()
Mgv6: Edit empty line formatting
Remove leading spaces in makeChunk()
Add missing spaces after 'for' and 'if'
Mgv7: Edit empty line formatting
This commit is contained in:
paramat 2016-01-11 00:30:03 +00:00
parent 3e0ea3c6ed
commit 8fc8cb819b
7 changed files with 22 additions and 14 deletions

@ -2461,6 +2461,8 @@ These functions return the leftover itemstack.
* Map of Lua entities, indexed by active object id * Map of Lua entities, indexed by active object id
* `minetest.registered_ores` * `minetest.registered_ores`
* List of registered ore definitions. * List of registered ore definitions.
* `minetest.registered_biomes`
* List of registered biome definitions.
* `minetest.registered_decorations` * `minetest.registered_decorations`
* List of registered decoration definitions. * List of registered decoration definitions.

@ -3,7 +3,6 @@
-- --
minetest.register_alias("mapgen_air", "air")
minetest.register_alias("mapgen_stone", "default:stone") minetest.register_alias("mapgen_stone", "default:stone")
minetest.register_alias("mapgen_dirt", "default:dirt") minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")

@ -44,6 +44,9 @@ CaveV5::CaveV5(Mapgen *mg, PseudoRandom *ps)
this->np_caveliquids = &nparams_caveliquids; this->np_caveliquids = &nparams_caveliquids;
this->ystride = mg->csize.X; this->ystride = mg->csize.X;
if (c_ice == CONTENT_IGNORE)
c_ice = CONTENT_AIR;
dswitchint = ps->range(1, 14); dswitchint = ps->range(1, 14);
flooded = ps->range(1, 2) == 2; flooded = ps->range(1, 2) == 2;

@ -68,6 +68,8 @@ DungeonGen::DungeonGen(Mapgen *mapgen, DungeonParams *dparams)
// For mapgens using river water // For mapgens using river water
dp.c_river_water = mg->ndef->getId("mapgen_river_water_source"); dp.c_river_water = mg->ndef->getId("mapgen_river_water_source");
if (dp.c_river_water == CONTENT_IGNORE)
dp.c_river_water = mg->ndef->getId("mapgen_water_source");
} }

@ -38,7 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mg_ore.h" #include "mg_ore.h"
#include "mg_decoration.h" #include "mg_decoration.h"
#include "mapgen_v5.h" #include "mapgen_v5.h"
#include "util/directiontables.h"
FlagDesc flagdesc_mapgen_v5[] = { FlagDesc flagdesc_mapgen_v5[] = {
@ -216,9 +215,9 @@ void MapgenV5::makeChunk(BlockMakeData *data)
data->blockpos_requested.Y <= data->blockpos_max.Y && data->blockpos_requested.Y <= data->blockpos_max.Y &&
data->blockpos_requested.Z <= data->blockpos_max.Z); data->blockpos_requested.Z <= data->blockpos_max.Z);
generating = true; this->generating = true;
vm = data->vmanip; this->vm = data->vmanip;
ndef = data->nodedef; this->ndef = data->nodedef;
//TimeTaker t("makeChunk"); //TimeTaker t("makeChunk");
v3s16 blockpos_min = data->blockpos_min; v3s16 blockpos_min = data->blockpos_min;

@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "mapgen.h" #include "mapgen.h"
#include "voxel.h" #include "voxel.h"
#include "noise.h" #include "noise.h"
@ -37,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mg_decoration.h" #include "mg_decoration.h"
#include "mapgen_v6.h" #include "mapgen_v6.h"
FlagDesc flagdesc_mapgen_v6[] = { FlagDesc flagdesc_mapgen_v6[] = {
{"jungles", MGV6_JUNGLES}, {"jungles", MGV6_JUNGLES},
{"biomeblend", MGV6_BIOMEBLEND}, {"biomeblend", MGV6_BIOMEBLEND},
@ -47,7 +49,8 @@ FlagDesc flagdesc_mapgen_v6[] = {
{NULL, 0} {NULL, 0}
}; };
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge)
@ -197,7 +200,6 @@ void MapgenV6Params::writeParams(Settings *settings) const
//////////////////////// Some helper functions for the map generator //////////////////////// Some helper functions for the map generator
// Returns Y one under area minimum if not found // Returns Y one under area minimum if not found
s16 MapgenV6::find_stone_level(v2s16 p2d) s16 MapgenV6::find_stone_level(v2s16 p2d)
{ {

@ -46,6 +46,7 @@ FlagDesc flagdesc_mapgen_v7[] = {
{NULL, 0} {NULL, 0}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////