The setting limits map generation but affects nothing else.
Add 'mapgen_limit' to global mapgen parameters.
Move 'blockpos_over_mapgen_limit()' to the only place it is called
from: map.cpp.
Allow teleportation to any part of the world even if over the set
mapgen limit.
Simplify the reading of this limit in mgvalleys.
Remove the 'map_generation_limit' setting.
p.y = tonumber(p.y)
p.z = tonumber(p.z)
if p.x and p.y and p.z then
- local lm = tonumber(minetest.setting_get("map_generation_limit") or 31000)
+ local lm = 31000
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
return false, "Cannot teleport out of map bounds!"
end
# From how far blocks are generated for clients, stated in mapblocks (16 nodes).
max_block_generate_distance (Max block generate distance) int 6
-# Where the map generator stops.
-# Please note:
-# - Limited to 31000 (setting above has no effect)
-# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).
-# - Those groups have an offset of -32, -32 nodes from the origin.
-# - Only groups which are within the map_generation_limit are generated
-map_generation_limit (Map generation limit) int 31000 0 31000
+# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
+# Only mapchunks completely within the mapgen limit are generated.
+# Value is stored per-world.
+mapgen_limit (Map generation limit) int 31000 0 31000
# Global map generation attributes.
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
# type: int
# max_block_generate_distance = 6
-# Where the map generator stops.
-# Please note:
-# - Limited to 31000 (setting above has no effect)
-# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).
-# - Those groups have an offset of -32, -32 nodes from the origin.
-# - Only groups which are within the map_generation_limit are generated
+# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0).
+# Only mapchunks completely within the mapgen limit are generated.
+# Value is stored per-world.
# type: int min: 0 max: 31000
-# map_generation_limit = 31000
+# mapgen_limit = 31000
# Global map generation attributes.
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
// Mapgen
settings->setDefault("mg_name", "v7");
settings->setDefault("water_level", "1");
+ settings->setDefault("mapgen_limit", "31000");
settings->setDefault("chunksize", "5");
settings->setDefault("mg_flags", "dungeons");
settings->setDefault("fixed_map_seed", "");
- settings->setDefault("map_generation_limit", "31000");
settings->setDefault("max_block_generate_distance", "7");
settings->setDefault("enable_mapgen_debug_info", "false");
return getMapgenParams()->water_level;
}
+bool ServerMap::blockpos_over_mapgen_limit(v3s16 p)
+{
+ const s16 mapgen_limit_bp = rangelim(
+ getMapgenParams()->mapgen_limit, 0, MAX_MAP_GENERATION_LIMIT) /
+ MAP_BLOCKSIZE;
+ return p.X < -mapgen_limit_bp ||
+ p.X > mapgen_limit_bp ||
+ p.Y < -mapgen_limit_bp ||
+ p.Y > mapgen_limit_bp ||
+ p.Z < -mapgen_limit_bp ||
+ p.Z > mapgen_limit_bp;
+}
+
bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
{
s16 csize = getMapgenParams()->chunksize;
/*
Blocks are generated by using these and makeBlock().
*/
+ bool blockpos_over_mapgen_limit(v3s16 p);
bool initBlockMake(v3s16 blockpos, BlockMakeData *data);
void finishBlockMake(BlockMakeData *data,
std::map<v3s16, MapBlock*> *changed_blocks);
#include "modifiedstate.h"
#include "util/numeric.h" // getContainerPos
#include "settings.h"
+#include "mapgen.h"
class Map;
class NodeMetadataList;
p.Z > max_limit_bp;
}
-inline bool blockpos_over_mapgen_limit(v3s16 p)
-{
- const s16 mapgen_limit_bp = rangelim(
- g_settings->getS16("map_generation_limit"), 0, MAX_MAP_GENERATION_LIMIT) /
- MAP_BLOCKSIZE;
- return p.X < -mapgen_limit_bp ||
- p.X > mapgen_limit_bp ||
- p.Y < -mapgen_limit_bp ||
- p.Y > mapgen_limit_bp ||
- p.Z < -mapgen_limit_bp ||
- p.Z > mapgen_limit_bp;
-}
-
/*
Returns the position of the block where the node is located
*/
Mapgen::Mapgen()
{
- generating = false;
- id = -1;
- seed = 0;
- water_level = 0;
- flags = 0;
+ generating = false;
+ id = -1;
+ seed = 0;
+ water_level = 0;
+ mapgen_limit = 0;
+ flags = 0;
vm = NULL;
ndef = NULL;
Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) :
gennotify(emerge->gen_notify_on, &emerge->gen_notify_on_deco_ids)
{
- generating = false;
- id = mapgenid;
- water_level = params->water_level;
- flags = params->flags;
- csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE);
+ generating = false;
+ id = mapgenid;
+ water_level = params->water_level;
+ mapgen_limit = params->mapgen_limit;
+ flags = params->flags;
+ csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE);
/*
We are losing half our entropy by doing this, but it is necessary to
this->mgtype = Mapgen::getMapgenType(mg_name);
settings->getS16NoEx("water_level", water_level);
+ settings->getS16NoEx("mapgen_limit", mapgen_limit);
settings->getS16NoEx("chunksize", chunksize);
settings->getFlagStrNoEx("mg_flags", flags, flagdesc_mapgen);
settings->set("mg_name", Mapgen::getMapgenName(mgtype));
settings->setU64("seed", seed);
settings->setS16("water_level", water_level);
+ settings->setS16("mapgen_limit", mapgen_limit);
settings->setS16("chunksize", chunksize);
settings->setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX);
s16 chunksize;
u64 seed;
s16 water_level;
+ s16 mapgen_limit;
u32 flags;
BiomeParams *bparams;
chunksize(5),
seed(0),
water_level(1),
+ mapgen_limit(MAX_MAP_GENERATION_LIMIT),
flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS),
bparams(NULL)
{
public:
s32 seed;
int water_level;
+ int mapgen_limit;
u32 flags;
bool generating;
int id;
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
this->m_bgen = (BiomeGenOriginal *)biomegen;
- this->map_gen_limit = MYMIN(MAX_MAP_GENERATION_LIMIT,
- g_settings->getU16("map_generation_limit"));
-
BiomeParamsOriginal *bp = (BiomeParamsOriginal *)params->bparams;
this->spflags = params->spflags;
const float massive_cave_threshold = 0.6f;
// mct: 1 = small rare caves, 0.5 1/3rd ground volume, 0 = 1/2 ground volume.
- float yblmin = -map_gen_limit + massive_cave_blend * 1.5f;
+ float yblmin = -mapgen_limit + massive_cave_blend * 1.5f;
float yblmax = massive_cave_depth - massive_cave_blend * 1.5f;
bool made_a_big_one = false;
// lava_depth varies between one and ten as you approach
// the bottom of the world.
- s16 lava_depth = ceil((lava_max_height - node_min.Y + 1) * 10.f / map_gen_limit);
+ s16 lava_depth = ceil((lava_max_height - node_min.Y + 1) * 10.f / mapgen_limit);
// This allows random lava spawns to be less common at the surface.
s16 lava_chance = MYCUBE(lava_features_lim) * lava_depth;
// water_depth varies between ten and one on the way down.
- s16 water_depth = ceil((map_gen_limit - abs(node_min.Y) + 1) * 10.f / map_gen_limit);
+ s16 water_depth = ceil((mapgen_limit - abs(node_min.Y) + 1) * 10.f / mapgen_limit);
// This allows random water spawns to be more common at the surface.
s16 water_chance = MYCUBE(water_features_lim) * water_depth;
private:
BiomeGenOriginal *m_bgen;
- float map_gen_limit;
-
bool humid_rivers;
bool use_altitude_chill;
float humidity_adjust;